The single I/O boundary between the framework and a real terminal.
All bytes that ever reach stdout come through write; widget code never gets a reference to this. Input events arrive via events as typed TuiEvents — the byte-level escape-sequence parsing is internal to the driver's implementation.
The contract:
- enter is called once at startup. It puts the terminal into the configured TerminalMode (raw input, alt screen, etc.) and hooks resize / signal handlers.
- restore is called once at shutdown. It MUST be safe to call
in a
finallyblock after an exception; the driver tracks what it actually changed and only undoes those changes. Successful restoration is an ownership barrier: pending startup or handoff work must not subsequently reacquire modes, input, or output. Fence or finish those operations before reporting success. Throw if terminal ownership cannot be safely released. - write is the single output path. Implementations buffer at their own discretion; the framework calls it from the renderer and expects bytes to land before the next frame is asked for.
- events is a broadcast stream. Multiple subscribers (focus dispatcher, dev tools, debug overlay) can listen.
- Implementers
Properties
- capabilities → TerminalCapabilities
-
What the terminal can render — color depth, supported modes, etc.
no setter
-
events
→ Stream<
TuiEvent> -
Stream of typed input + resize events. Broadcast.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Whether the driver is currently in interactive mode (between
enter and restore).
no setter
- isInteractive → bool
-
Whether this driver is backed by an interactive terminal display —
i.e. standard output is a real TTY rather than a pipe or file.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → CellSize
-
Current terminal size in cells. Reflects the most recent resize.
no setter
Methods
-
enter(
TerminalMode mode) → Future< TerminalSessionProfile> -
Puts the terminal into
modeand returns the session facts established by setup/negotiation. Calling it on an already-entered driver is an error. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
restore(
) → Future< void> - Reverses everything enter configured. Safe to call after an exception. Idempotent — calling twice has no further effect.
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
String data) → void - Writes raw bytes to the terminal's output stream. The framework guarantees these are pre-sanitized ANSI from the diff renderer — the driver does not re-validate.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited