KeyCode class final
One logical key: a printable character or a special key.
KeyCode unifies the two vocabularies a terminal reports — characters
(KeyCode.char('a'), KeyCode.char('?')) and specials
(KeyCode.enter, KeyCode.f1, …) — into a single value type with
structural equality, so KeyCode.a == KeyCode.char('a') and codes work
as map keys and in case patterns.
A KeyCode names the key itself, never its modifiers: Ctrl+C is a
KeyEvent carrying KeyCode.c plus {KeyModifier.ctrl}. Committed
text (IME composition, paste, multi-grapheme input) is not a keypress
and arrives as TextInputEvent, never as a code.
Per RFC 0018, KeyCode is the one-step, unmodified form of a
KeySequence: every KeyCode is a valid single-key sequence, so .enter
and .char('?') bind directly, while .ctrl.s and .g.g are the
modified/multi-step sequences.
- Inheritance
-
- Object
- KeySequence
- KeyCode
- Implemented types
- Available extensions
- Annotations
-
- @immutable
Constructors
- KeyCode.char(String character)
-
A printable-character key.
const
Properties
- a → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - alt → PendingKeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - b → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - backspace → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - c → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - character → String?
-
The printable character, or null for a special key.
final
- ctrl → PendingKeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - d → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - delete → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - down → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - e → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - end → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - enter → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - escape → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f1 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f10 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f11 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f12 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f2 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f3 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f4 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f5 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f6 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f7 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f8 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - f9 → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - g → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - h → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hintLabel → String
-
Short human-readable label:
j/Ctrl+S/↑/Ctrl+X Ctrl+S. Round-trips through parse.no setterinherited - home → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - i → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - insert → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - isCharacter → bool
-
Whether this code is a printable character (as opposed to a special
key).
no setter
- j → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - k → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - l → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - left → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - m → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - meta → PendingKeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - n → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - o → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - p → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - pageDown → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - pageUp → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - q → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - r → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - right → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- s → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - shift → PendingKeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - space → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - special → SpecialKey?
-
The special key, or null for a printable character.
final
- stepCount → int
-
Number of steps (
1for a single-keystroke sequence).no setteroverride - superKey → PendingKeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - t → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - tab → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - u → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - up → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - v → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - w → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - x → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - y → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter - z → KeySequence
-
Available on KeySequence, provided by the KeySequenceChain extension
no setter
Methods
-
char(
String character) → KeySequence -
Available on KeySequence, provided by the KeySequenceChain extension
Append a dynamic character atom (digits, punctuation, Unicode). -
code(
KeySelector keyCode) → KeySequence -
Available on KeySequence, provided by the KeySequenceChain extension
Append a key identity held in a variable — a logical KeyCode or a physical KeyPosition. -
isPrefixOf(
KeySequence other) → bool -
Whether every step of this sequence is a prefix of
other— used to warn about remap conflicts where one binding delays another (e.g.gdelaysg g).inherited -
matches(
KeyEvent event) → bool -
Whether this sequence's first step matches
event. Multi-step sequences have their continuation matched step-by-step by the InputDispatcher.inherited -
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
-
forCharacter(
String character) → KeyCode -
Looks up the canonical instance for a printable
character. -
forSpecial(
SpecialKey key) → KeyCode -
Looks up the canonical const instance for
key.
Constants
- a → const KeyCode
- arrowDown → const KeyCode
- arrowLeft → const KeyCode
- arrowRight → const KeyCode
- arrowUp → const KeyCode
- b → const KeyCode
- backspace → const KeyCode
- c → const KeyCode
- capsLock → const KeyCode
- d → const KeyCode
- delete → const KeyCode
- e → const KeyCode
- end → const KeyCode
- enter → const KeyCode
- escape → const KeyCode
- f → const KeyCode
- f1 → const KeyCode
- f2 → const KeyCode
- f3 → const KeyCode
- f4 → const KeyCode
- f5 → const KeyCode
- f6 → const KeyCode
- f7 → const KeyCode
- f8 → const KeyCode
- f9 → const KeyCode
- f10 → const KeyCode
- f11 → const KeyCode
- f12 → const KeyCode
- f13 → const KeyCode
- f14 → const KeyCode
- f15 → const KeyCode
- f16 → const KeyCode
- f17 → const KeyCode
- f18 → const KeyCode
- f19 → const KeyCode
- f20 → const KeyCode
- f21 → const KeyCode
- f22 → const KeyCode
- f23 → const KeyCode
- f24 → const KeyCode
- f25 → const KeyCode
- f26 → const KeyCode
- f27 → const KeyCode
- f28 → const KeyCode
- f29 → const KeyCode
- f30 → const KeyCode
- f31 → const KeyCode
- f32 → const KeyCode
- f33 → const KeyCode
- f34 → const KeyCode
- f35 → const KeyCode
- g → const KeyCode
- h → const KeyCode
- home → const KeyCode
- i → const KeyCode
- insert → const KeyCode
- isoLevel3Shift → const KeyCode
- isoLevel5Shift → const KeyCode
- j → const KeyCode
- k → const KeyCode
- keypad0 → const KeyCode
- keypad1 → const KeyCode
- keypad2 → const KeyCode
- keypad3 → const KeyCode
- keypad4 → const KeyCode
- keypad5 → const KeyCode
- keypad6 → const KeyCode
- keypad7 → const KeyCode
- keypad8 → const KeyCode
- keypad9 → const KeyCode
- keypadAdd → const KeyCode
- keypadBegin → const KeyCode
- keypadDecimal → const KeyCode
- keypadDelete → const KeyCode
- keypadDivide → const KeyCode
- keypadDown → const KeyCode
- keypadEnd → const KeyCode
- keypadEnter → const KeyCode
- keypadEqual → const KeyCode
- keypadHome → const KeyCode
- keypadInsert → const KeyCode
- keypadLeft → const KeyCode
- keypadMultiply → const KeyCode
- keypadPageDown → const KeyCode
- keypadPageUp → const KeyCode
- keypadRight → const KeyCode
- keypadSeparator → const KeyCode
- keypadSubtract → const KeyCode
- keypadUp → const KeyCode
- l → const KeyCode
- leftAlt → const KeyCode
- leftControl → const KeyCode
- leftHyper → const KeyCode
- leftMeta → const KeyCode
- leftShift → const KeyCode
- leftSuper → const KeyCode
- m → const KeyCode
- mediaFastForward → const KeyCode
- mediaPause → const KeyCode
- mediaPlay → const KeyCode
- mediaPlayPause → const KeyCode
- mediaRecord → const KeyCode
- mediaReverse → const KeyCode
- mediaRewind → const KeyCode
- mediaStop → const KeyCode
- mediaTrackNext → const KeyCode
- mediaTrackPrevious → const KeyCode
- n → const KeyCode
- numLock → const KeyCode
- o → const KeyCode
- p → const KeyCode
- pageDown → const KeyCode
- pageUp → const KeyCode
- pause → const KeyCode
- printScreen → const KeyCode
- q → const KeyCode
- r → const KeyCode
- rightAlt → const KeyCode
- rightControl → const KeyCode
- rightHyper → const KeyCode
- rightMeta → const KeyCode
- rightShift → const KeyCode
- rightSuper → const KeyCode
- s → const KeyCode
- scrollLock → const KeyCode
- space → const KeyCode
- t → const KeyCode
- tab → const KeyCode
- u → const KeyCode
- v → const KeyCode
- volumeDown → const KeyCode
- volumeMute → const KeyCode
- volumeUp → const KeyCode
- w → const KeyCode
- x → const KeyCode
- y → const KeyCode
- z → const KeyCode