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

Constructors

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

Properties

character String
The character of the triggering event. [...]
final
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

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. [...]
override
debugDescribeKeys() String
Returns a description of the key set that is short and readable. [...]
override
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object. [...]
inherited
toStringShort() String
A brief description of this object, usually just the runtimeType and the hashCode. [...]
inherited

Operators

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