onResponse method
The callback will be executed on success.
If you want to continue the response, call handler.next
.
If you want to complete the response with some custom data directly,
you can resolve a Response
object with handler.resolve
and other
response interceptor(s) will not be executed.
If you want to complete the response with an error message,
you can reject a DioError
object with handler.reject
.
Implementation
@override
Future onResponse(
Response response, ResponseInterceptorHandler handler) async {
_endTime = DateTime.now();
final int duration = _endTime!.difference(_startTime!).inMilliseconds;
// 输出结果
log('----------End: $duration 毫秒----------');
return super.onResponse(response, handler);
}