VtTerminal class final

A WindowBackend for an app in the inline mode whose frames go into a Vt (vt) with a scrollback, below history: what a user would see on a normal screen, the lines printed before the app included. Input is delivered with type, and resize resizes it as a terminal that keeps what it shows. setTitle writes the title to frames as a terminal is sent it; it shows no notifications (notify).

A frame written below the line the shell printed, read back:

final term = VtTerminal(width: 20, height: 4, history: [r'$ dart run']);
term.write(Uint8List.fromList('hello'.codeUnits));
assert(term.lines.take(2).join('|') == r'$ dart run|hello');

Constructors

VtTerminal({int width = 40, int height = 10, List<String> history = const [], bool atLineStart = true})
A width x height normal screen showing history, the last line with its line break when atLineStart. The history is guarded: the emulator fails on any write to it, and on any absolute row. Input is decoded by a HeadlessTerminal.

Properties

closed ↔ bool
Whether close was called.
getter/setter pair
events → Stream<InputEvent>
Decoded input, plus a ResizeEvent each time the size changes.
no setter
frames → List<Uint8List>
Every frame written, as written.
final
hashCode → int
The hash code for this object.
no setterinherited
height → int
The number of rows, kept up to date from resize events.
no setter
history → List<String>
What was printed before the app.
final
info ↔ TerminalInfo
What the terminal was found to be as it opened.
latefinal
lines → List<String>
Every line: the scrollback, then the screen.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
vt → Vt
What the screen shows.
final
width → int
The number of columns, kept up to date from resize events.
no setter

Methods

close() → Future<void>
Restores the terminal. Safe to call more than once.
flush() → Future<void>
Completes when everything written so far reached the OS.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify(String title, String body) → void
Nothing: the terminal shows no notifications (TerminalInfo.notifications is NotificationProtocol.none).
resize(int width, int height, {bool pull = false}) → void
The terminal becomes width x height and keeps what it shows (see Vt.resizeKeeping); a ResizeEvent follows.
setTitle(String title) → void
Writes the sequence that sets the window's title to title (titleSequence), which the screen does not show.
toString() → String
A string representation of this object.
inherited
type(String text) → void
Delivers text as typed input.
write(Uint8List bytes) → void
Writes one frame. The bytes are copied: the caller may reuse its buffer as soon as this returns.

Operators

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