ScreenBuffer class

An off-screen grid of Cells the widgets paint into, plus a diff-based renderDiff that emits the minimal ANSI to turn a previous frame into this one (so only changed cells are rewritten — no flicker, minimal bytes).

The buffer is terminal-agnostic: it produces a string of escape sequences and never touches IO. The owning app holds the "front" buffer (the last frame shown) and feeds it to renderDiff.

Constructors

ScreenBuffer(int width, int height)

Properties

hashCode int
The hash code for this object.
no setterinherited
height int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
final

Methods

cellAt(int x, int y) Cell
The cell at (x,y), or Cell.blank when out of bounds.
clear([Style style = Style.none]) → void
Resets every cell to a blank in style.
drawText(int x, int y, String text, Style style, {int? maxWidth}) int
Draws text starting at (x,y), one cell per rune, clipped to the row and to maxWidth columns (when given). Tabs expand to a single space. Returns the column just past the last painted cell.
fillRect(int left, int top, int w, int h, String char, Style style) → void
Fills rect's area (clipped to the buffer) with char in style.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
renderDiff(ScreenBuffer? previous) String
Emits the ANSI needed to turn previous into this frame, rewriting only the cells that changed. When previous is null (or a different size) the whole frame is drawn.
setCell(int x, int y, String char, Style style) → void
Paints a single character at (x,y); out-of-bounds writes are ignored. A multi-rune char is truncated to its first rune; an empty string paints a space.
toString() String
A string representation of this object.
inherited

Operators

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