flush method

void flush()

Renders only the changed cells to the terminal since the last flush.

Implementation

void flush() {
  final StringBuffer buffer = StringBuffer();
  TextStyle? currentStyle;
  for (int y = 0; y < terminal.height; y++) {
    for (int x = 0; x < terminal.width; x++) {
      currentStyle = _flushCell(buffer, x, y, currentStyle);
    }
  }
  buffer.write('\x1b[0m');
  buffer.write('\x1b[1;1H');
  terminal.backend.write(buffer.toString());
  terminal.backend.flush();
}