KeyCode class

Represents a key pressed on the keyboard. This class is used for the legacy key events as well the enhanced key events. used on the Kitty protocol.

Note: need to have KeyboardEnhancementFlags.disambiguateEscapeCodes enabled to identify some keys as media keys, leftCtrl, etc.

ref: https://sw.kovidgoyal.net/kitty/keyboard-protocol/

Annotations
  • @immutable

Constructors

KeyCode.char(String char, {int baseLayoutKey = 0})
Constructs a character key
const
KeyCode.named(KeyCodeName name, {int baseLayoutKey = 0})
Constructs a named key (F1-F35, Enter, Escape, arrows, etc.)
const

Properties

baseLayoutKey int
Base layout key
final
char String
Contains the character of the key if is a printable character. Only populated when kind == KeyCodeKind.char
final
hashCode int
The hash code for this object.
no setteroverride
kind KeyCodeKind
Discriminator indicating which type of key this represents
final
name KeyCodeName
Contains the name of the key if is a named key (enter, esc, pgUp, etc). Only populated when kind == KeyCodeKind.named
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({KeyCodeKind? kind, KeyCodeName? name, String? char, int? baseLayoutKey}) KeyCode
Create a new instance of KeyCode with the given parameters.
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