printLine method

void printLine(
  1. String text
)

Appends text as persistent log line(s) above the rendered view.

Lines are stored in a bounded buffer and composited with the view content on each render.

Implementation

void printLine(String text) {
  _initialize();
  if (text.isEmpty) return;

  final lines = text.replaceAll('\r\n', '\n').split('\n');
  for (final line in lines) {
    if (line.isEmpty) continue;
    _printLines.add(line);
    if (_printLines.length > _maxPrintLines) {
      _printLines.removeAt(0);
    }
  }
}