AnsiTerminalDriver class abstract

A TerminalDriver base that turns ScreenBuffer frames into ANSI byte output, leaving the byte sink, size, and input/resize streams to subclasses.

The alternate-screen / SGR / cursor sequences and the frame diffing are identical for every terminal, so they live here once and are shared by the native TTY driver (Terminal, which writes to stdout and manages raw mode) and browser drivers (which write to a terminal widget). Subclasses implement writeAnsi (the sink) plus size/input/resizeEvents (from TerminalDriver), and may override onEnter/onLeave for sink-specific setup such as raw mode or flow control.

Implemented types

Constructors

AnsiTerminalDriver()

Properties

hashCode int
The hash code for this object.
no setterinherited
input Stream<List<int>>
The raw input byte stream.
no setterinherited
resizeEvents Stream<void>
Terminal resize notifications.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size → ({int cols, int rows})
The current size in cells.
no setterinherited

Methods

enter() → void
Enters full-screen mode (alternate screen + raw input).
override
invalidate() → void
Forces the next present to repaint in full.
override
leave() → void
Leaves full-screen mode, restoring the prior screen and input mode.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onEnter() → void
Hook run during enter, before the alternate-screen sequence is written (e.g. enable raw mode / disable flow control). Default: no-op.
onLeave() → void
Hook run during leave, after the screen-restore sequence is written (e.g. restore the previous input mode). Default: no-op.
present(ScreenBuffer frame, {int? cursorX, int? cursorY}) → void
Renders frame, diffed against the previous one, optionally placing the hardware cursor.
override
toString() String
A string representation of this object.
inherited
writeAnsi(String ansi) → void
Writes ansi (already-encoded escape/text) to the underlying terminal.

Operators

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