ShortcutActivator class Null safety

An interface to define the keyboard key combination to trigger a shortcut.

ShortcutActivators are used by Shortcuts widgets, and are mapped to Intents, the intended behavior that the key combination should trigger. When a Shortcuts widget receives a key event, its ShortcutManager looks up the first matching ShortcutActivator, and signals the corresponding Intent, which might trigger an action as defined by a hierarchy of Actions widgets. For a detailed introduction on the mechanism and use of the shortcut-action system, see Actions.

The matching ShortcutActivator is looked up in the following way:

  • Find the registered ShortcutActivators whose triggers contain the incoming event.
  • Of the previous list, finds the first activator whose accepts returns true in the order of insertion.

See also:

  • SingleActivator, an implementation that represents a single key combined with modifiers (control, shift, alt, meta).
  • CharacterActivator, an implementation that represents key combinations that result in the specified character, such as question mark.
  • LogicalKeySet, an implementation that requires one or more LogicalKeyboardKeys to be pressed at the same time. Prefer SingleActivator when possible.
Implementers

Constructors

ShortcutActivator()
Abstract const constructor. This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
const

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
triggers Iterable<LogicalKeyboardKey>?
All the keys that might be the final event to trigger this shortcut.
read-only

Methods

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 description of the key set that is short and readable.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

isActivatedBy(ShortcutActivator activator, RawKeyEvent event) bool
Returns true if the event and keyboard state would cause this ShortcutActivator to be activated.