onResponse method
Emits a 'response' debug event containing the full response context.
The data map includes the status code, status message, response
headers, response body, content type, and content length.
Forwards the response to the next handler after emitting.
Implementation
@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
onDebug(
event: 'response',
message:
'[${response.statusCode}] ${response.requestOptions.method} ${response.requestOptions.uri}',
data: {
'statusCode': response.statusCode,
'statusMessage': response.statusMessage,
'headers': response.headers.map,
'data': response.data,
'contentType': response.headers.value('content-type'),
'contentLength': response.headers.value('content-length'),
},
);
super.onResponse(response, handler);
}