getSelectedGroups method

List<Group> getSelectedGroups()

Get the list of selected Group objects

Returns a list of Group objects whose GUIDs are in the selectedGroups set. Returns an empty list if the state is not GroupsLoaded.

Requirement: 8.4

Implementation

List<Group> getSelectedGroups() {
  if (state is! GroupsLoaded) return [];
  final loaded = state as GroupsLoaded;
  return items.where((g) => loaded.selectedGroups.contains(g.guid)).toList();
}