LogicalKeySet class

A set of LogicalKeyboardKeys that can be used as the keys in a map.

LogicalKeySet can be used as a ShortcutActivator. It is not recommended to use LogicalKeySet for a common shortcut such as Delete or Ctrl+C, prefer SingleActivator when possible, whose behavior more closely resembles that of typical platforms.

When used as a ShortcutActivator, LogicalKeySet will activate the intent when all keys are pressed, and no others, except that modifier keys are considered without considering sides (e.g. control left and control right are considered the same).

In the following example, the counter is increased when the following key sequences are pressed:

  • Control left, then C.
  • Control right, then C.
  • C, then Control left.

But not when:

  • Control left, then A, then C.
link

To create a local project with this code sample, run:
flutter create --sample=widgets.LogicalKeySet.1 mysample

This is also a thin wrapper around a Set, but changes the equality comparison from an identity comparison to a contents comparison so that non-identical sets with the same keys in them will compare as equal.

Inheritance
Implemented types
Mixed in types

Constructors

LogicalKeySet(LogicalKeyboardKey key1, [LogicalKeyboardKey? key2, LogicalKeyboardKey? key3, LogicalKeyboardKey? key4])
A constructor for making a LogicalKeySet of up to four keys.
LogicalKeySet.fromSet(Set<LogicalKeyboardKey> keys)
Create a LogicalKeySet from a set of LogicalKeyboardKeys.

Properties

hashCode int
The hash code for this object.
latefinalinherited
keys Set<LogicalKeyboardKey>
Returns a copy of the KeyboardKeys in this KeySet.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
triggers Iterable<LogicalKeyboardKey>
An optional property to provide all the keys that might be the final event to trigger this shortcut.
no setteroverride

Methods

accepts(KeyEvent event, HardwareKeyboard 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 nonexistent 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