onError method

Future<Object?> onError(
  1. DioException error
)

Called when the interceptor should process an error

Return a future with (modified) DioException to continue the chain or an instance of Response (or subclasses) to halt processing and mark the request as successful. NOTE: When returning Response, no other interceptors will be called.

Any other values will simply call the next interceptor with error

Implementation

Future<Object?> onError(DioException error) {
  return Future.value(error);
}