KeyDecoder class

Turns raw terminal input bytes (read in raw mode) into KeyEvents.

The decoder is streaming: feed it each chunk from stdin with decode and it returns the events that completed in that chunk, buffering any partial escape sequence or partial UTF-8 character until the rest arrives. This keeps multi-byte input (arrow keys, accented characters pasted a chunk at a time) robust without the caller reasoning about byte boundaries.

Constructors

KeyDecoder()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(List<int> bytes) List<KeyEvent>
Decodes bytes, returning the keys that completed. Incomplete trailing sequences are retained for the next call.
flush() List<KeyEvent>
Flushes any buffered bytes as a best-effort final decode (e.g. a lone trailing ESC). Call when input ends.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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