onResponse method

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

Called when the response is about to be resolved.

Implementation

@override
void onResponse(Response response, ResponseInterceptorHandler handler) {
  super.onResponse(response, handler);
  if (!settings.enabled) {
    return;
  }
  final accepted = settings.responseFilter?.call(response) ?? true;
  if (!accepted) {
    return;
  }
  try {
    final message = '${response.requestOptions.uri}';
    final httpLog = DioResponseLog(
      message,
      settings: settings,
      response: response,
    );
    _talker.logCustom(httpLog);
  } catch (_) {
    //pass
  }
}