SelectionController<T> constructor
SelectionController<T> ({})
Each selectableOptions
must somehow can be identified uniquely in String.
Specify how that identification is done on indexGetter.
You can groups options (selectableOptions
's elements) by some String identification (like index) which you can specify on groupNameGetter
.
Implementation
SelectionController({
required this.indexGetter,
required Iterable<T> selectableOptions,
String Function(T)? groupNameGetter,
Iterable<String>? initiallySelected,
this.mode = SelectionMode.multiple,
}) {
assert(T is! String);
// fill default
this.groupNameGetter = groupNameGetter ?? (t) => 'noGroup';
_selected = Set.from(initiallySelected ?? <String>[]);
_init(selectableOptions);
_originalSelected = Set.from(_constrainedSelected());
// constraint only done at runtime
}