KeyCombo class final

A key with the modifiers held with it, as Trigger.key names it: Enter, Meta+Enter, Shift+Tab, Meta+b, ArrowDown, Escape. Every part but the last is a modifier: Meta (also Cmd, Command, Ctrl, Control, Mod: Command on macOS, Control elsewhere), Shift, Alt (also Option). The key compares without case or spaces; Esc reads as Escape, Return as Enter.

Annotations
  • @immutable

Constructors

KeyCombo(String key, {bool meta = false, bool shift = false, bool alt = false})
const

Properties

alt → bool
final
hashCode → int
The hash code for this object.
no setteroverride
key → String
The key, lower case, without spaces.
final
meta → bool
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shift → bool
final

Methods

matches(String label, {bool meta = false, bool shift = false, bool alt = false}) → bool
Whether key label pressed with these modifiers is this combination. Modifiers match exactly, except Shift on a one-character key the combination doesn't shift (typing ? takes Shift).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

normalizeKey(String label) → String
label as combinations compare it.
tryParse(String? text) → KeyCombo?
text (Meta+Enter) as a combination; null when empty or naming an unknown modifier.