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<dynamic> response,
  ResponseInterceptorHandler handler,
) {
  _saveCookies(response)
      .then((_) => handler.next(response))
      .catchError((dynamic e, dynamic stackTrace) {
    final DioException err = DioException(
      requestOptions: response.requestOptions,
      error: e,
      stackTrace: stackTrace as StackTrace,
    );
    handler.reject(err, true);
  });
}