printAbove method

void printAbove(
  1. String text
)

Prints text above the prompt, keeping what's been typed so far.

When no line is being read, text is printed as a line on its own.

Implementation

void printAbove(String text) {
  if (_reading == null || !_interactive) {
    _output.writeln(text);
    return;
  }
  if (_ansi) {
    _output.write('\r\x1B[K$text\n');
    _refresh();
  } else {
    _output.write(
      '\n$text\n${_stripAnsi(_prompt)}${String.fromCharCodes(_line)}',
    );
  }
}