setCell method

void setCell(
  1. int x,
  2. int y,
  3. String char,
  4. Style style,
)

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.

Implementation

void setCell(int x, int y, String char, Style style) {
  if (x < 0 || x >= width || y < 0 || y >= height) return;
  final runes = char.runes;
  final c = runes.isEmpty ? ' ' : String.fromCharCode(runes.first);
  _cells[_index(x, y)] = Cell(c, style);
}