drawText method
Draws the string of characters in text starting at column x, row y
of this Terminal using the given foreground and background Colors
(or default colors). The text will be truncated if it runs beyond the
bounds of the terminal.
Implementation
void drawText(int x, int y, String text,
[Color? foreground, Color? background]) {
foreground ??= this.foreground;
background ??= this.background;
for (var i = 0; i < text.length; i++) {
if (x + i >= width) break;
drawChar(
x + i, y, Char.create(text.codeUnits[i], foreground, background));
}
}