clearScreen method

void clearScreen({
  1. TerminalClearMode mode = TerminalClearMode.all,
})

Clears the screen. If ansi escape sequences are not supported this is a no op. This call does not update the cursor position so in most cases you will want to call home after calling clearScreen.

 Terminal()
  ..clearScreen()
  ..home();

Implementation

void clearScreen({TerminalClearMode mode = TerminalClearMode.all}) {
  switch (mode) {
    // case AnsiClearMode.scrollback:
    //   write('${esc}3J', newline: false);
    //   break;

    case TerminalClearMode.all:
      _console.clearScreen();
      break;
    case TerminalClearMode.fromCursor:
      write('${Ansi.esc}0Jm');
      break;
    case TerminalClearMode.toCursor:
      write('${Ansi.esc}1Jm');
      break;
  }
}