onError method Null safety

  1. @override
Future onError(
  1. HasuraError error,
  2. HasuraConnect hasuraConnect
)

Implementation

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