Buffer extension type

A buffer that maps to the desired content of a terminal after rendering.

Widgets and other renderable objects do not typically interact directly with a terminal and instead draw their state to an intermediate buffer, which is a grid where each Cell contains a single symbol (grapheme) and an optional Style.

on
Implemented types

Constructors

Buffer(int width, int height, [Cell fill = Cell.empty])
Creates a new buffer with the given width and height.
factory
Buffer.empty()
Creates an empty buffer with no cells.
factory
Buffer.fromCells(Iterable<Cell> cells, {required int width})
Creates a new buffer from the given cells and width.
factory
Buffer.fromLines(Iterable<Line> lines)
Creates a new buffer from the given lines.
factory
Buffer.fromRows(Iterable<Iterable<Cell>> rows)
Creates a new grid from the given rows.
factory
Buffer.view(Buffer buffer, Rect bounds)
Creates a sub-buffer view into this grid within the given bounds.
factory

Properties

cells Iterable<Cell>
Cells in the grid.
no setterinherited
columns Iterable<Iterable<Cell>>
Each column of cells in the grid from left to right.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
height int
Height of the buffer.
no setterinherited
indexed Iterable<(int, int, Cell)>
Each cell in the grid with its x and y coordinates.
no setterinherited
rows Iterable<Iterable<Cell>>
Each row of cells in the grid from top to bottom.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
Width of the buffer.
no setterinherited

Methods

area([Offset offset = Offset.zero]) Rect
Returns the area of the grid as a rectangle with an optional offset.
inherited
fillCells([Cell fill = Cell.empty, Rect? area]) → void
Fills the buffer with the given fill cell.
fillStyle(Style style, [Rect? area]) → void
Sets the style of all cells in the buffer to style.
get(int x, int y) Cell
Returns the cell at the given x and y coordinates.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
print(int x, int y, String string, {Style style = Style.reset, int? maxWidth}) → void
Prints a string, starting at the given x and y coordinates.
printSpan(int x, int y, Span span, {int? maxWidth}) → void
Prints a span of text starting at the given x and y coordinates.
set(int x, int y, Cell cell) → void
Sets the cell at the given x and y coordinates to cell.
inherited
setLine(int x, int y, Line line, {int? maxWidth}) → void
Sets cells starting at the given x and y coordinates to line.
subGrid(Rect bounds) Buffer
Returns a sub-buffer view into this grid within the given bounds.
override
toString() String
A string representation of this object.
inherited

Operators

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