writeAt method

void writeAt(
  1. int x,
  2. int y,
  3. String text, [
  4. Color? fore,
  5. Color? back,
])

Writes text starting at column x, row y using fore as the text color and back as the background color.

Implementation

void writeAt(int x, int y, String text, [Color? fore, Color? back]) {
  fore ??= foreColor;
  back ??= backColor;

  // TODO: Bounds check.
  for (var i = 0; i < text.length; i++) {
    if (x + i >= width) break;
    drawGlyph(x + i, y, Glyph.fromCharCode(text.codeUnitAt(i), fore, back));
  }
}