timeLog method

int? timeLog(
  1. String? id, {
  2. bool endTimer = false,
})

Implementation

int? timeLog(String? id, {bool endTimer = false}) {
  id ??= _defaultTimerId;
  int? t;
  if (_stopwatches.containsKey(id)) {
    t = _stopwatches[id]!.elapsedMilliseconds;
    log('$id: $t ms');
    if (endTimer) {
      _stopwatches[id]!.stop();
      _stopwatches.remove(id);
    }
  } else {
    error('Timer \'$id\' does not exist.');
  }
  return t;
}