RetryInterceptor constructor
RetryInterceptor({})
Implementation
RetryInterceptor({
required this.dio,
this.logPrint,
this.retries = 3,
this.retryDelays = const [
Duration(seconds: 1),
Duration(seconds: 3),
Duration(seconds: 5),
],
RetryEvaluator? retryEvaluator,
this.ignoreRetryEvaluatorExceptions = false,
this.retryableExtraStatuses = const {},
}) : _retryEvaluator = retryEvaluator ??
DefaultRetryEvaluator({
...defaultRetryableStatuses,
...retryableExtraStatuses,
}).evaluate {
if (retryEvaluator != null && retryableExtraStatuses.isNotEmpty) {
throw ArgumentError(
'[retryableExtraStatuses] works only if [retryEvaluator] is null.'
' Set either [retryableExtraStatuses] or [retryEvaluator].'
' Not both.',
'retryableExtraStatuses',
);
}
if (retries < 0) {
throw ArgumentError(
'[retries] cannot be less than 0',
'retries',
);
}
}