onResponse method Null safety

  1. @override
Future onResponse(
  1. Response data,
  2. HasuraConnect hasuraConnect
)

Implementation

@override
Future onResponse(Response data, HasuraConnect hasuraConnect) async {
  try {
    final metric = _mapMetric[data.request.query.hashCode];
    metric?.httpResponseCode = data.statusCode;
    metric?.responsePayloadSize = data.data.toString().length;
    await metric?.stop();
    _mapMetric.remove(data.request.query.hashCode);
    // ignore: avoid_catches_without_on_clauses
  } catch (e, stackTrace) {
    debugPrintStack(
      label: e.toString(),
      stackTrace: stackTrace,
    );
  }
  return super.onResponse(data, hasuraConnect);
}