onInterceptResponse method

  1. @protected
Future<void> onInterceptResponse(
  1. StreamedResponse response
)

Implementation

@protected
Future<void> onInterceptResponse(StreamedResponse response) async {
  final responseInterceptors = this.responseInterceptors;
  if (responseInterceptors == null || responseInterceptors.isEmpty) return;

  for (final interceptor in responseInterceptors) {
    try {
      await interceptor(response);
    } catch (e, s) {
      unawaitedResponse(response);
      throw ResponseInterceptorException(
        'Response Interceptor failed due to an error',
        uri: response.request?.url,
        innerException: e,
        innerStackTrace: s,
      );
    }
  }
}