of static method

QueryClient of(
  1. BuildContext context
)

The nearest client above context.

Throws when there is none: a missing provider is a wiring mistake, and a nullable return would only move the crash somewhere less helpful.

Implementation

static QueryClient of(BuildContext context) {
  final scope = context.dependOnInheritedWidgetOfExactType<QueryScope>();
  if (scope == null) {
    throw _missingProvider();
  }
  return scope.client;
}