elapseBlocking method

void elapseBlocking(
  1. Duration duration
)

Simulates the synchronous passage of time, resulting from blocking or expensive calls.

Neither timers nor microtasks are run during this call, but if this is called within elapse they may fire afterwards.

Throws an ArgumentError if duration is negative.

Implementation

void elapseBlocking(Duration duration) {
  if (duration.inMicroseconds < 0) {
    throw ArgumentError('Cannot call elapse with negative duration');
  }

  _elapsed += duration;
  var elapsingTo = _elapsingTo;
  if (elapsingTo != null && _elapsed > elapsingTo) _elapsingTo = _elapsed;
}