triggers property Null safety

Iterable<LogicalKeyboardKey> triggers
override

All the keys that might be the final event to trigger this shortcut.

For example, for Ctrl-A, the KeyA is the only trigger, while Ctrl is not, because the shortcut should only work by pressing KeyA after Ctrl, but not before. For Ctrl-A-E, on the other hand, both KeyA and KeyE should be triggers, since either of them is allowed to trigger.

The trigger keys are used as the first-pass filter for incoming events, as Intents are stored in a Map and indexed by trigger keys. Subclasses should make sure that the return value of this method does not change throughout the lifespan of this object.

This method might also return null, which means this activator declares all keys as the trigger key. All activators whose triggers returns null will be tested with accepts on every event. Since this becomes a linear search, and having too many might impact performance, it is preferred to return non-null triggers whenever possible.

Implementation

@override
Iterable<LogicalKeyboardKey> get triggers {
  return <LogicalKeyboardKey>[trigger];
}