backOff method

Future<T> backOff({
  1. Duration delayFactor = const Duration(milliseconds: 200),
  2. double randomizationFactor = 0.25,
  3. Duration maxDelay = const Duration(seconds: 30),
  4. int maxAttempts = 8,
  5. FutureOr<bool> retry(
    1. Object error,
    2. int attempt
    )?,
})

Converts this into a BackOff function.

Implementation

Future<T> backOff({
  Duration delayFactor = const Duration(milliseconds: 200),
  double randomizationFactor = 0.25,
  Duration maxDelay = const Duration(seconds: 30),
  int maxAttempts = 8,
  FutureOr<bool> Function(Object error, int attempt)? retry,
}) =>
    BackOff(
      this,
      delayFactor: delayFactor,
      randomizationFactor: randomizationFactor,
      maxDelay: maxDelay,
      maxAttempts: maxAttempts,
      retryIf: retry,
    ).call();