pause method

void pause({
  1. String? ref,
})

Pauses the stopwatch for ref and accumulates elapsed time.

Implementation

void pause({String? ref}) {
  ref ??= currentReference;
  if (_stopwatches.containsKey(ref) && _stopwatches[ref]!.isRunning) {
    _stopwatches[ref]!.stop();
    _accumulatedTime[ref] = _accumulatedTime[ref]! + _stopwatches[ref]!.elapsed.inSeconds;
    _stopwatches[ref]!.reset();
    AppConfig.logger.i('NeomStopwatch paused for $ref; accumulated: ${_accumulatedTime[ref]}s.');
  }
}