onResponse method
Called when the response is about to be resolved.
Implementation
@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
handler.next(response);
final id = response.requestOptions.extra['iad_id'] as int?;
if (id == null) return;
final request = _requests[id]?.$1;
if (request == null) {
return;
}
final response0 = _Response(
statusCode: response.statusCode ?? -1,
headers: response.headers.map,
data: response.data,
statusMessage: response.statusMessage,
timestamp: DateTime.timestamp(),
duration: request.timestamp.difference(DateTime.timestamp()),
);
_requests[id] = (request, response0);
notifyListeners();
}