Terminal class

Terminal represents a terminal screen that can be manipulated and drawn to.

It manages a Buffer representing the screen state, handles input event decoding, and provides methods for drawing text, shapes, and images.

Implemented types

Constructors

Terminal({Stream<List<int>>? input, StringSink? output, List<String>? env, bool? isWindows, bool? isTty})

Properties

buffer → Buffer
The backing Buffer for this terminal.
no setter
capabilities → TerminalCapabilities
final
events → Stream<Event>
A stream of decoded terminal Events.
no setter
hashCode → int
The hash code for this object.
no setterinherited
lastDrawOutput → String
The exact ANSI/content string emitted by the most recent draw or flush.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

bestImageDrawableForTerminal(Image image, {int? columns, int? rows}) → Drawable
Returns the best Drawable for the given image based on this terminal's capabilities.
bounds() → Rectangle
The bounding rectangle of the terminal screen.
override
cellAt(int x, int y) → Cell?
Returns the Cell at the given x and y coordinates.
override
clear() → void
Clears the terminal buffer.
override
clearScreen() → void
Clears the physical screen on the next draw.
clone() → Buffer
Returns a clone of the current terminal buffer.
override
cloneArea(Rectangle area) → Buffer?
Returns a clone of the specified area of the terminal buffer.
override
disableBracketedPaste() → void
Disables bracketed paste mode.
disableFocusReporting() → void
Disables focus reporting.
disableKeyboardEnhancements() → void
Disables keyboard enhancements (Kitty Keyboard Protocol).
disableMouse() → void
Disables mouse tracking.
draw() → void
Draws the current buffer state to the terminal.
enableBracketedPaste() → void
Enables bracketed paste mode.
enableFocusReporting() → void
Enables focus reporting.
enableKeyboardEnhancements(int flags) → void
Enables keyboard enhancements (Kitty Keyboard Protocol) with the specified flags.
enableMouse() → void
Enables mouse tracking.
enterAltScreen() → void
Enters the alternate screen buffer.
exitAltScreen() → void
Exits the alternate screen buffer.
fill(Cell? cell) → void
Fills the entire terminal screen with the given cell.
override
fillArea(Cell? cell, Rectangle area) → void
Fills the specified area with the given cell.
override
flush() → void
Flushes any pending output to the terminal.
getSize() → Future<Size>
Returns the current size of the terminal.
hideCursor() → void
Hides the terminal cursor.
moveTo(int x, int y) → void
Moves the cursor to the given x and y position.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prependString(String s) → void
Adds the given string to the top of the terminal screen.
queryCapabilities() → void
Queries the terminal for its capabilities.
resize(int width, int height) → void
Resizes the terminal buffer and renderer.
setBackspace(bool v) → void
Sets whether to use backspace as a movement optimization.
setCell(int x, int y, Cell? cell) → void
Sets the cell at the given x and y coordinates.
override
setCellOwned(int x, int y, Cell? cell) → void
Sets the cell at (x, y) and may take ownership of cell.
override
setColorProfile(Profile profile) → void
Sets the color profile to use for downsampling colors.
setEscTimeout(Duration d) → void
Sets the escape sequence timeout.
setFullscreen(bool v) → void
Sets whether the terminal is in fullscreen mode.
setHasTab(bool v) → void
Sets whether to use hard tabs as a movement optimization.
setRelativeCursor(bool v) → void
Sets whether to use relative cursor movements.
setScrollOptim(bool v) → void
Sets whether to use scroll optimizations.
setSynchronizedOutput(bool v) → void
Sets whether rendered frames should use synchronized terminal updates.
setTabStops(int width) → void
Sets the tab stops for the terminal and enables hard tabs movement optimizations.
showCursor() → void
Shows the terminal cursor.
start({bool handleSignals = true}) → Future<void>
Starts the terminal session.
stop() → Future<void>
Stops the terminal session and restores the original state.
toString() → String
A string representation of this object.
inherited
widthMethod() → WidthMethod
The method used to calculate character widths.
override

Operators

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

Static Methods

bestImageDrawable(Image image, {required TerminalCapabilities capabilities, int? columns, int? rows}) → Drawable
Returns the best Drawable for the given image based on terminal capabilities.