useJson function

Implementation

ResponseInterceptor useJson() {
  return ResponseInterceptor(interceptor: (Response response) async {
    try {
      var data = response.data is String ? jsonDecode(response.data) : response.data;
      return ResponseInterceptorFlow(
        Response<Map<String, dynamic>>(
          data: data,
          body: response.body,
          statusCode: response.statusCode,
        ),
        terminate: false,
      );
    } catch (e) {
      return ResponseInterceptorFlow(response, terminate: false);
    }
  });
}