elapsed method

int elapsed({
  1. String? ref,
})

Returns total elapsed seconds for ref (accumulated + current if running).

Implementation

int elapsed({String? ref}) {
  ref ??= currentReference;
  if (_stopwatches.containsKey(ref)) {
    return _accumulatedTime[ref]! +
        (_stopwatches[ref]!.isRunning ? _stopwatches[ref]!.elapsed.inSeconds : 0);
  }
  return 0;
}