OrbitStoreRef<T extends OrbitStore> class

A reference to a store, created once via defineStore.

Calling it (counterStore()) returns the app-wide singleton, same as Orbit.use — but because the factory lives in exactly one place, it's impossible for two call sites to accidentally register the store with different constructor arguments and silently get whichever one happened to run first.

It's also directly usable wherever a T Function() is expected, so it drops straight into OrbitBuilder/OrbitSelector's store: parameter.

Constructors

OrbitStoreRef(T _create())
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

builder({Key? key, required Widget builder(BuildContext context, T store, Widget? child), Widget? child}) Widget
Returns an OrbitBuilder listening to this store.
call() → T
Returns the singleton instance, creating it on first access.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
of(BuildContext context, {bool listen = true}) → T
Accesses this store from the nearest OrbitScope, falling back to the app-wide singleton if no scope is found.
select<S>({Key? key, required S selector(T store), required Widget builder(BuildContext context, S value), bool equals(S previous, S next)?}) Widget
Returns an OrbitSelector listening to a selected slice of this store.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited