Buffer class

A 2D grid of cell data stored in parallel flat lists.

Implementers
Available extensions

Constructors

Buffer(int width, int height)
Creates a new buffer of width by height initialized with transparent empty cell data.
Buffer.blank(int width, int height)
Creates a new buffer of width by height initialized with solid blank cell data.

Properties

attributes Uint32List
Single unified data array for fg, bg, and modifiers. layout: fg, bg, mod, fg, bg, mod...
getter/setter pair
characters List<String>
Flat list of characters representing the grid.
getter/setter pair
effects List<RegisteredEffect>
The list of terminal effects registered in this buffer.
final
hashCode int
The hash code for this object.
no setterinherited
height int
The height of the buffer in rows.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
The width of the buffer in columns.
getter/setter pair

Methods

addEffect(RegisteredEffect effect) → void
Adds a terminal effect to this buffer.
clear() → void
Resets all cells in the buffer to transparent empty cells.
fillAttributes({String? char, int? fg, int? bg, int? modifiers}) → void
Fills the entire buffer with the specified attributes.
fillBackgroundStyle(Rect bounds, Style style, BlendOption blend) → void

Available on Buffer, provided by the EffectHelpers extension

Fills the background style of all cells in bounds using blend.
fillForegroundStyle(Rect bounds, Style style, BlendOption blend) → void

Available on Buffer, provided by the EffectHelpers extension

Fills the foreground style of all cells in bounds using blend.
getBackground(int x, int y) int
Gets the background color at (x, y). Returns 0 if coordinates are out of bounds.
getCharacter(int x, int y) String
Gets the character at (x, y). Returns a space if coordinates are out of bounds.
getForeground(int x, int y) int
Gets the foreground color at (x, y). Returns 0 if coordinates are out of bounds.
getModifiers(int x, int y) int
Gets the modifiers at (x, y). Returns transparent if coordinates are out of bounds.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resize(int newWidth, int newHeight) → void
Resizes the buffer to the new dimensions, preserving existing content where it fits.
rotateColumn(Rect bounds, int colIndex, int amount) → void

Available on Buffer, provided by the EffectHelpers extension

Rotates a specific column within the given bounds by amount downward.
rotateRow(Rect bounds, int rowIndex, int amount) → void

Available on Buffer, provided by the EffectHelpers extension

Rotates a specific row within the given bounds by amount rightward.
setAttributes(int x, int y, {String? char, int? fg, int? bg, int? modifiers}) → void
Sets the cell attributes at (x, y). Does nothing if coordinates are out of bounds.
setBackground(int x, int y, int bg) → void
Sets background color at coordinates.
setCell(int x, int y, String char, int fg, int bg, int mod) → void
Sets character, colors, and modifiers at coordinates.
setCharacter(int x, int y, String char) → void
Sets character at coordinates.
setForeground(int x, int y, int fg) → void
Sets foreground color at coordinates.
setModifiers(int x, int y, int mod) → void
Sets modifiers at coordinates.
toString() String
A string representation of this object.
inherited
writeString(int x, int y, String text, Style style) → void
Writes styled text to the buffer starting at (x, y).

Operators

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