onError method

  1. @override
Future onError (
  1. DioError err
)
override

The callback will be executed on error.

If you want to resolve the request with some custom data, you can return a Response object or return dio.resolve. If you want to continue the request, return the DioError object.

Implementation

@override
Future onError(DioError err) async {
  if (error) {
    logPrint('*** DioError ***:');
    logPrint('uri: ${err.request.uri}');
    logPrint('$err');
    if (err.response != null) {
      _printResponse(err.response);
    }
    logPrint('');
  }
}