present method

  1. @override
void present(
  1. ScreenBuffer frame, {
  2. int? cursorX,
  3. int? cursorY,
})
override

Renders frame, diffed against the previous one, optionally placing the hardware cursor.

Implementation

@override
void present(ScreenBuffer frame, {int? cursorX, int? cursorY}) {
  final out =
      StringBuffer('\x1b[?25l') // hide while painting
        ..write(frame.renderDiff(_front));
  if (cursorX != null && cursorY != null) {
    out.write('\x1b[${cursorY + 1};${cursorX + 1}H\x1b[?25h');
  }
  writeAnsi(out.toString());
  _front = frame;
}