shouldRetry method

  1. @override
bool shouldRetry(
  1. int attempt,
  2. Object error,
  3. StackTrace stackTrace
)
override

Whether the task should be retried

attempt is the current attempt number (0-based for first attempt). error is the error that caused the failure. stackTrace is the stack trace of the error.

Implementation

@override
bool shouldRetry(int attempt, Object error, StackTrace stackTrace) {
  return attempt < maxAttempts - 1;
}