shouldRetry method
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;
}