SingleActivator class Null safety

A shortcut key combination of a single key and modifiers.

The SingleActivator implements typical shortcuts such as:

  • ArrowLeft
  • Shift + Delete
  • Control + Alt + Meta + Shift + A

More specifically, it creates shortcut key combinations that are composed of a trigger key, and zero, some, or all of the four modifiers (control, shift, alt, meta). The shortcut is activated when the following conditions are met:

  • The incoming event is a down event for a trigger key.
  • If control is true, then at least one control key must be held. Otherwise, no control keys must be held.
  • Similar conditions apply for the alt, shift, and meta keys.

This resembles the typical behavior of most operating systems, and handles modifier keys differently from LogicalKeySet in the following way:

  • SingleActivators allow additional non-modifier keys being pressed in order to activate the shortcut. For example, pressing key X while holding ControlLeft and key A will be accepted by SingleActivator(LogicalKeyboardKey.keyX, control: true).
  • SingleActivators do not consider modifiers to be a trigger key. For example, pressing ControlLeft while holding key X will not activate a SingleActivator(LogicalKeyboardKey.keyX, control: true).

See also:

  • CharacterActivator, an activator that represents key combinations that result in the specified character, such as question mark.
Implemented types
Mixed in types


SingleActivator(LogicalKeyboardKey trigger, {bool control = false, bool shift = false, bool alt = false, bool meta = false, bool includeRepeats = true})
Triggered when the trigger key is pressed while the modifiers are held.


alt bool
Whether either (or both) alt keys should be held for trigger to activate the shortcut.
control bool
Whether either (or both) control keys should be held for trigger to activate the shortcut.
hashCode int
The hash code for this object.
includeRepeats bool
Whether this activator accepts repeat events of the trigger key.
meta bool
Whether either (or both) meta keys should be held for trigger to activate the shortcut.
runtimeType Type
A representation of the runtime type of the object.
shift bool
Whether either (or both) shift keys should be held for trigger to activate the shortcut.
trigger LogicalKeyboardKey
The non-modifier key of the shortcut that is pressed after all modifiers to activate the shortcut.
triggers Iterable<LogicalKeyboardKey>
All the keys that might be the final event to trigger this shortcut.


accepts(RawKeyEvent event, RawKeyboard state) bool
Whether the triggering event and the keyboard state at the time of the event meet required conditions, providing that the event is a triggering event.
debugDescribeKeys() String
Returns a short and readable description of the key combination.
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
serializeForMenu() ShortcutSerialization
Implement this in a ShortcutActivator subclass to allow it to be serialized for use in a PlatformMenuBar.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
toString({DiagnosticLevel minLevel =}) String
A string representation of this object.
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode.


operator ==(Object other) bool
The equality operator.