Orbit class
Global registry of store singletons — the same role Pinia plays when
it keeps one live instance of each store for the whole app, reachable
from anywhere without threading a BuildContext through.
You usually won't call this directly; OrbitBuilder and
OrbitSelector call use for you under the hood. It's public
so you can also read or act on a store from outside the widget tree —
services, background isolate callbacks, tests, etc.
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- canRedo → bool
-
Whether there is at least one undone mutation that can be redone.
no setter
- canUndo → bool
-
Whether there is at least one mutation that can be undone.
no setter
-
changeLog
→ List<
OrbitMutation> -
The most recent mutations across every store, oldest first, capped
at the last 200. Only populated while debugLogging is on. Useful
to inspect in a debugger, print in a bug report, or render in your
own debug overlay.
no setter
- debugLogging ↔ bool
-
Whether mutations are printed to the console and recorded in
changeLog. Defaults to
kDebugMode, so there's no console noise or retained history in release builds unless you turn this on explicitly. This does not gate observe — observers registered via observe always run, in every build mode, since they're meant to power things like persistence and analytics, not just dev-time logging.getter/setter pair - undoStackLimit ↔ int
-
Maximum number of undo steps retained in history (default 50).
getter/setter pair
Static Methods
-
batch<
T> (FutureOr< T> fn(), {String? label}) → FutureOr<T> -
Runs
fninside a global batch. -
clearChangeLog(
) → void - Clears changeLog. Mainly useful between test cases.
-
jsonSafeForTest(
Object? value) → Object? -
Exposed helper for testing
_jsonSafedirectly. -
observe(
OrbitObserver observer) → void Function() -
Registers
observerto run after every mutation, on every store — mutation middleware, in the spirit of Pinia's$onAction. Enables logging, analytics, or persistence without touching store code: -
override<
T extends OrbitStore> (T instance) → void -
Registers
instanceas the singleton for storeT, replacing (and disposing) any existing one. Mainly for widget tests, to swap in a fake/mock store before pumping the widget under test: -
read<
T extends OrbitStore> () → T? -
Returns the existing instance of store
T, ornullif it hasn't been created yet. Useful when you want to read a store without accidentally instantiating it. -
redo(
) → void - Re-applies the most recently undone mutation (or batch of mutations).
-
reset<
T extends OrbitStore> () → void -
Disposes and removes store
Tfrom the registry — e.g. on logout, so the next use call builds a fresh instance. Runs OrbitStore.onDispose on the way out. -
resetAll(
) → void -
Disposes and clears every registered store. Mainly useful in test
tearDownto stop state leaking between test cases. -
undo(
) → void - Reverts the most recent mutation (or batch of mutations) across all Undoable stores.
-
use<
T extends OrbitStore> (T create()) → T -
Returns the singleton instance of store
T, creating it viacreatethe first time it's requested. Every later call — from any widget, anywhere — returns that same instance.