nextDelay method

  1. @override
Duration nextDelay(
  1. int attempt
)
override

Implementation

@override
Duration nextDelay(int attempt) {
  if (attempt <= 0) return Duration.zero;

  final int exponential = (baseMillis * pow(2, attempt - 1)).toInt();
  final int capped = min(exponential, maxMillis);
  if (capped <= 0) return Duration.zero;

  final int half = capped ~/ 2;
  final int jitter = half + _rnd.nextInt(half + 1);

  return Duration(milliseconds: jitter);
}