CharacterActivator class Null safety

A shortcut combination that is triggered by a key event that produces a specific character.

Keys often produce different characters when combined with modifiers. For example, it might be helpful for the user to bring up a help menu by pressing the question mark ('?'). However, there is no logical key that directly represents a question mark. Although 'Shift+Slash' produces a '?' character on a US keyboard, its logical key is still considered a Slash key, and hard-coding 'Shift+Slash' in this situation is unfriendly to other keyboard layouts.

For example, CharacterActivator('?') is triggered when a key combination results in a question mark, which is 'Shift+Slash' on a US keyboard, but 'Shift+Comma' on a French keyboard.

In the following example, when a key combination results in a question mark, the counter is increased:
To create a local project with this code sample, run:
flutter create --sample=widgets.CharacterActivator.1 mysample

See also:

  • SingleActivator, an activator that represents a single key combined with modifiers, such as Ctrl+C.
Implemented types
Mixed in types


CharacterActivator(String character)
Create a CharacterActivator from the triggering character.


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


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.
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.