onResponse method

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

Called when the response is about to be resolved.

Implementation

@override
onResponse(Response response, ResponseInterceptorHandler handler) async {
  var ct = response.headers.value("content-type");
  if(ct!=null && ( ct.contains("application/json") || ct.contains("text/html"))){
    var data = response.data;
    if(onHookResponse!=null) onHookResponse!(data);
  }
  return handler.next(response);
}