void flushTimers()

in lib/fake_async.dart [206:224]


  void flushTimers(
      {Duration timeout = const Duration(hours: 1),
      bool flushPeriodicTimers = true}) {
    var absoluteTimeout = _elapsed + timeout;
    _fireTimersWhile((timer) {
      if (timer._nextCall > absoluteTimeout) {
        // TODO(nweiz): Make this a [TimeoutException].
        throw StateError('Exceeded timeout $timeout while flushing timers');
      }

      if (flushPeriodicTimers) return _timers.isNotEmpty;

      // Continue firing timers until the only ones left are periodic *and*
      // every periodic timer has had a change to run against the final
      // value of [_elapsed].
      return _timers
          .any((timer) => !timer.isPeriodic || timer._nextCall <= _elapsed);
    });
  }