update method
void
update(
- ProgressEvent e
Renders e, throttled; safe to call on every event. The terminal done
phase is left for finish to terminate, preserving the last drawn line.
Implementation
void update(ProgressEvent e) {
if (!_enabled || e.phase == ProgressPhase.done) return;
final line = _render(e);
if (line == null) return;
final last = e.total != null && e.completed == e.total;
final ms = _sw.elapsedMilliseconds;
if (!last && ms - _lastRenderMs < 100) return;
_lastRenderMs = ms;
_dirty = true;
final pad = _lastLen > line.length ? ' ' * (_lastLen - line.length) : '';
_out.write('\r$line$pad');
_lastLen = line.length;
}