KeySet<T extends KeyboardKey>.fromSet constructor Null safety

KeySet<T extends KeyboardKey>.fromSet(
  1. Set<T> keys
)

Create a KeySet from a set of KeyboardKeys.

Do not mutate the keys set after passing it to this object.

The keys set must not be empty.

Implementation

KeySet.fromSet(Set<T> keys)
    : assert(keys != null),
      assert(keys.isNotEmpty),
      assert(!keys.contains(null)),
      _keys = HashSet<T>.of(keys);