nextDelay method

Duration nextDelay()

The next backoff delay, advancing the attempt counter.

Implementation

Duration nextDelay() {
  final baseMs = (initial.inMilliseconds * pow(factor, _attempt))
      .clamp(0, max.inMilliseconds)
      .toInt();
  _attempt++;
  final jitter = _random == null
      ? 0
      : _random.nextInt((baseMs ~/ 4).clamp(1, 1000));
  return Duration(milliseconds: baseMs + jitter);
}