onError method

  1. @override
Future onError(
  1. DioException err,
  2. ErrorInterceptorHandler handler
)

Called when an exception was occurred during the request.

Implementation

@override
Future onError(DioException err, ErrorInterceptorHandler handler) async {
  //请求错误也需要处理清除缓存和Loading的逻辑
  handleEndWithRequestOption(err.requestOptions);
  super.onError(err, handler);
}