elapsedTime method

Duration elapsedTime([
  1. DateTime? now
])

Returns the time elapsed since the computation was resolved.

If the computation has not yet been resolved, returns Duration.zero. The optional now parameter allows using a custom reference time.

Implementation

Duration elapsedTime([DateTime? now]) {
  var resolvedAt = this.resolvedAt;
  if (resolvedAt == null) return Duration.zero;
  now ??= DateTime.now();
  return now.difference(resolvedAt);
}