onResponse method
Called when the response is about to be resolved.
Implementation
@override
Future onResponse(
dio.Response response, dio.ResponseInterceptorHandler handler) {
super.onResponse(response, handler);
if (!((response.statusCode! < 200) ||
(response.statusCode! >= 300) ||
(response.data == null))) {
var jsonResult = response.data;
if (response.statusCode == 200) {
if (jsonResult is Map) {
json.encode(jsonResult).logMx();
}
if (jsonResult == null || jsonResult.length == 0) {
response.data = {"code": 1, "message": "成功"};
}
}
} else {
response.data['code'] = response.statusCode;
"errorResponse:${response.realUri.path},${response.data}".printXNetLog();
}
return Future.value(true);
}