onResponse method

  1. @override
void onResponse(
  1. Response response,
  2. ResponseInterceptorHandler handler
)
override

Called when the response is about to be resolved.

Implementation

@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
  // Log the response status code and data
  if (responseBody) {
    logDebug('onResponse: StatusCode: ${response.statusCode}, Data: ${_prettyJsonEncode(response.data)}',
        level: Level.debug); // Log formatted response data
  }

  // Call the super class to continue handling the response
  return super.onResponse(response, handler);
}