onError method
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 (_onError != null) {
return _onError!(err);
}
}