onResponse method

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

Called when the response is about to be resolved.

Implementation

@override
Future onResponse(
    Response response, ResponseInterceptorHandler handler) async {
  CommonWidgets.logPrint('*** Api Response - Start ***');

  printKV('URI', response.requestOptions.uri);
  printKV('STATUS CODE', response.statusCode ?? '');
  printKV('REDIRECT', response.isRedirect);
  CommonWidgets.logPrint('BODY:');
  printAll(response.data ?? '');

  CommonWidgets.logPrint('*** Api Response - End ***');

  return handler.next(response);
}