clear method

void clear()

Finishes the section by clearing the scrolling lines so the area can be overwritten.

If successMessage is non-null it replaces the heading; otherwise the heading is left in place. The spinner is replaced with a success icon (). The (now sole) header line is kept in place and the cursor moved below it. Only when there is no header at all is the region cleared entirely.

Implementation

void clear() {
  if (_finished) return;
  _finished = true;
  _success = true;
  _stopSpinner();
  _finishMessage = successMessage;
  final header = _buildHeaderLine(_terminal.columns);
  if (header != null) {
    _renderer.finish(lines: [header]);
  } else {
    _renderer.clear();
  }
}