select method
Returns selection including key. Single mode replaces the previous
key; multiple mode adds it; all-matching mode removes its exclusion.
Disabled mode is unchanged.
Implementation
CollectionSelection<K> select(K key) => switch (mode) {
CollectionSelectionMode.none => this,
CollectionSelectionMode.single => CollectionSelection<K>.single(key),
CollectionSelectionMode.multiple => CollectionSelection<K>.multiple({
...selectedKeys,
key,
}),
CollectionSelectionMode.allMatching => CollectionSelection<K>.allMatching(
excludedKeys.where((candidate) => candidate != key),
),
};