setAttributes method
Sets the cell attributes at (x, y). Does nothing if coordinates are out of bounds.
Implementation
void setAttributes(
int x,
int y, {
String? char,
int? fg,
int? bg,
int? modifiers,
}) {
if (x < 0 || x >= width || y < 0 || y >= height) return;
final idx = (y * width + x) * 3;
if (char != null) characters[y * width + x] = char;
if (fg != null) attributes[idx + 0] = fg;
if (bg != null) attributes[idx + 1] = bg;
if (modifiers != null) attributes[idx + 2] = modifiers;
}