InputEvent class sealed
One thing a terminal sent: what the user did (KeyEvent, MouseEvent, PasteEvent, FocusEvent), the terminal's new size (ResizeEvent), a reply to a query, or a sequence nothing here maps (UnknownSequence).
The class is sealed, so a switch over an event names every kind or
has a default. A program reads them from Terminal.events, or is
handed each one by TwkApp.run; the replies the terminal answers its
own queries with go to it, and the rest to the program:
final terminal = await Terminal.open();
await for (final event in terminal.events) {
switch (event) {
case KeyEvent(code: KeyCode.char, char: 'q'):
await terminal.close();
case MouseEvent(kind: MouseKind.down, :final x, :final y):
terminal.setTitle('pressed at $x, $y');
case ResizeEvent(:final width, :final height):
terminal.setTitle('$width x $height');
default:
}
}
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
-
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