contains method
Tests key according to mode. All-matching mode returns true unless
the key is excluded; the caller is responsible for query membership.
Implementation
bool contains(K key) => switch (mode) {
CollectionSelectionMode.none => false,
CollectionSelectionMode.single ||
CollectionSelectionMode.multiple => selectedKeys.contains(key),
CollectionSelectionMode.allMatching => !excludedKeys.contains(key),
};