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

activeClip → Rect
Returns the current active clip rectangle, defaulting to full buffer bounds if stack is empty.
no setter
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.
drawCautionTape(Rect rect, int offsetX, int offsetY) → void
Draws a patterned caution tape in the specified rectangular bounds.
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.
fillRect(Rect rect, {String? char, int? fg, int? bg, int? modifiers}) → void
Fills a rectangular region with the given character and attributes.
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.
isCellValid(int x, int y) → bool
Whether cell (x, y) is valid and inside the current active clip bounds.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
popClip() → void
Pops the most recently pushed clip rectangle from the stack.
pushClip(Rect clipRect) → void
Pushes a new clip rectangle onto the stack, intersecting it with the current active clip.
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.
toAnsiString() → String

Available on Buffer, provided by the BufferAnsiSerialization extension

Serializes this Buffer grid into an ANSI escape sequence string.
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