Buffer class
A grid of Cells representing the desired terminal content.
Buffers are double-buffered: the current frame is drawn into one buffer while the previous frame is kept for diffing. Only changed cells are sent to the terminal.
- Available extensions
Constructors
-
Buffer(Rect area, List<
Cell> ? content) - Buffer.empty(Rect area)
-
Creates a buffer filled with empty cells covering
area.factory - Buffer.filled(Rect area, Cell cell)
-
Creates a buffer with every cell initialized to
cell.factory -
Buffer.withLines(List<
String> lines) -
Creates a buffer from a list of strings, one per row.
factory
Properties
- area ↔ Rect
-
The area covered by this buffer.
getter/setter pair
-
content
↔ List<
Cell> -
Flat list of cells in row-major order (length = area.width * area.height).
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cellAt(
Position position) → Cell? -
diff(
Buffer other) → List< CellUpdate> -
Compute a list of CellUpdates needed to turn this buffer into
other. -
diffIter(
Buffer other) → BufferDiff -
Lazy iterator over the diff between this buffer and
other. -
indexOf(
int x, int y) → int -
indexOfOpt(
Position position) → int? -
merge(
Buffer other) → void -
Merge
otherbuffer into this one. Overlapping cells fromotherwin. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
posOf(
int index) → Position -
reset(
) → void - Reset all cells to empty.
-
resize(
Rect newArea) → void -
Resize buffer to cover
newArea. Truncates or extends as needed. -
setCell(
Position position, Cell cell) → void -
setString(
int x, int y, String string, Style style) → void -
Write
stringto the buffer at position (x,y) withstyle. -
setStringN(
int x, int y, String string, int maxWidth, Style style) → void -
Write at most
maxWidthcharacters ofstringat (x,y). -
setStyleIn(
Rect styleArea, Style style) → void -
Apply
styleto all cells withinstyleArea. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
Position position) → Cell? -
Available on Buffer, provided by the BufferIndex extension
-
operator []=(
Position position, Cell cell) → void -
Available on Buffer, provided by the BufferIndex extension