Function to determine if a retry should be attempted.
If null (default) all errors will be retried.
null
final FutureOr<bool> Function(Object error, int attempt)? retryIf;