finish method

void finish()

Clears the live block and resets state so the bar can be reused across successive transfers (e.g. a long-running watch). The caller then prints its own final report where the block was.

Implementation

void finish() {
  if (_enabled && _drawnLines > 0) {
    final b = StringBuffer('\x1b[${_drawnLines}A');
    for (var i = 0; i < _drawnLines; i++) {
      b.write('\x1b[2K\n');
    }
    b.write('\x1b[${_drawnLines}A');
    _out.write(b.toString());
  }
  _active.clear();
  _completed = 0;
  _total = 0;
  _coarse = null;
  _drawnLines = 0;
  _lastRenderMs = -1000;
}