SelectionController<T> class Null safety

Constructors

SelectionController({required String indexGetter(T), required Iterable<T> selectableOptions, String groupNameGetter(T)?, Iterable<String>? initiallySelected, SelectionMode mode = SelectionMode.multiple})
Each selectableOptions must somehow can be identified uniquely in String. Specify how that identification is done on indexGetter.

Properties

groupNameGetter String Function(T)
To translate T into groupName in String.
read / write
groups Set<String>
Get all the groupName (as generated by groupNameGetter).
read-only
hashCode int
The hash code for this object.
read-onlyinherited
indexGetter String Function(T)
To translate T into index in String.
read / write
isAllSelected bool
Return true if all options are selected.
read-only
isNoneSelected bool
Return true if no option selected at all.
read-only
mode SelectionMode
Selector runtime mode.
final
options Set<T>
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
selected Set<T>
Return all options that currently selected.
read-only

Methods

clone({SelectionMode? newMode}) SelectionController<T>
Return new SelectionController initialized with same arguments. But you can define the newMode for the new SelectionController.
getGroupsWhereSelected() Set<String>
Return groupName(s) where there is at least one option on that group that selected. Based on isGroupSelected.
getGroupsWhereSelectedAll() Set<String>
Return groupName(s) where all options on that group are selected. Based on isGroupSelectedAll.
getOptionsOnGroup(String groupName) Set<T>
Return all options on a group.
getSelectedInGroup(String groupName) Set<T>
Return all selected options in a group.
isChanged() bool
Check if there are any changes in selection.
isGroupSelected(String? groupName) bool
Check if there is at least one option selected in a group.
isGroupSelectedAll(String groupName) bool
Check if all options are selected in a group.
isSelected(dynamic o) bool
Check selection status of an option. Return true if the option selected. Which option to check can be defined by the index (String) or by the option (T) object itself.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
select(dynamic o) → void
Change the option status to be selected. Which option to select can be defined by the index (String) or by the option (T) object itself.
selectAll() → void
Do nothing if mode is SelectionMode.single.
selectGroup(String groupName) → void
Select all options in a group (defined by groupName).
toggle(dynamic o) → void
Change the option status (depending on isSelected result). Which option to be toggled can be defined by the index (String) or by the option (T) object itself.
toggleAll() → void
Do unselectAll when isAllSelected is true. Else, will do selectAll.
toggleGroup(String groupName) → void
Calling unselectGroup or selectGroup depending on isGroupSelectedAll result.
toString() String
A string representation of this object.
inherited
unselect(dynamic o) → void
Change the option status to be unselected. Which option to unselect can be defined by the index (String) or by the option (T) object itself.
unselectAll() → void
Will unselect all options.
unselectGroup(String groupName) → void
Unselect all options in a group.
updateOptions(Iterable<T> choosableOptions) → void
If currently all options are selected (isAllSelected returns true), that state will be preserved. If not, what options are currently selected will stay the same.

Operators

operator ==(Object other) bool
The equality operator.
inherited