defaultRetryEvaluator static method
默认判断重试的条件
Implementation
static FutureOr<bool> defaultRetryEvaluator(DioError error, int attempt) {
bool shouldRetry;
if (error.type == DioErrorType.response) {
final statusCode = error.response?.statusCode;
if (statusCode != null) {
shouldRetry = HttpStatusCode.isRetryable(statusCode);
} else {
shouldRetry = true;
}
} else {
shouldRetry =
error.type != DioErrorType.cancel && error.error is! FormatException;
}
return shouldRetry;
}