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) {
  if (showLogging) {
    if (kDebugMode) {
      print(
          'OS BASECODE - RESPONSE[${response.statusCode}] => PATH: ${response.requestOptions.path}');
      if (response.extra['cacheResponse'] != null) {
        print('OS BASECODE - Data from cache');
      } else {
        print('OS BASECODE - Data from server');
      }
    }
  }
  handleResponse(response);
  return super.onResponse(response, handler);
}