drawText method
Draws text at the specified position with styling options.
This is the primary method for text rendering. Text extends horizontally from the given position and will be clipped at buffer boundaries.
Example:
// Simple text
buffer.drawText('Hello', 0, 0, Color.white);
// Styled text with background
buffer.drawText('Error!', 10, 5, Color.red,
bg: Color.yellow, attributes: Attr.bold);
x and y must fit unsigned 32-bit values and attributes an unsigned
32-bit value; violations throw a pre-invocation RangeError after the
lifecycle check.
Implementation
void drawText(
String text,
int x,
int y,
Color fg, {
Color? bg,
int attributes = 0,
}) {
_checkValid();
_checkUnsignedAbi(x, 0xFFFFFFFF, 'x');
_checkUnsignedAbi(y, 0xFFFFFFFF, 'y');
_checkUnsignedAbi(attributes, 0xFFFFFFFF, 'attributes');
_bindings.bufferDrawText(_ptr, text, x, y, fg, bg, attributes);
}