orbitRead<T extends OrbitStore> method
Accesses store T without subscribing this widget to rebuilds.
Works with both scoped stores (OrbitScope) and global stores (Orbit.use / defineStore).
Implementation
T orbitRead<T extends OrbitStore>([OrbitStoreRef<T>? storeRef]) {
if (storeRef != null) {
return storeRef.of(this, listen: false);
}
final scoped = OrbitScope.maybeOf<T>(this, listen: false);
if (scoped != null) return scoped;
final existing = Orbit.read<T>();
if (existing != null) return existing;
throw FlutterError(
'context.orbitRead<$T>() was called, but store $T is not created yet.\n'
'Provide a store ref: context.orbitRead(counterStore), or wrap your app in '
'OrbitScope<$T>, or define the store via defineStore.',
);
}