orbit library

Orbit — a tiny, Pinia-style state management library for Flutter.

Zero external dependencies. Built entirely on top of Flutter's own ChangeNotifier, AnimatedBuilder, and InheritedNotifier — the same primitives that power AnimationController, ValueNotifier, and Theme.of(context)-style lookups in the Flutter SDK.

Classes

AsyncData<T>
The successful state of an asynchronous operation containing value.
AsyncError<T>
The failure state of an asynchronous operation containing error and optional stackTrace.
AsyncLoading<T>
The loading state of an asynchronous operation.
AsyncValue<T>
Represents the state of an asynchronous operation.
ComputedStore<T>
An OrbitStore that computes derived state from other stores.
FutureProvider<T>
An OrbitStore that exposes the state of a Future.
Orbit
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.
OrbitBatchWatchdog
Configuration for the Orbit debug-mode batch watchdog.
OrbitBuilder<T extends OrbitStore>
Rebuilds builder whenever store T changes.
OrbitMutation
A single recorded mutation, produced by OrbitStore.mutate and passed to every Orbit.observe callback (and, in debug builds, to Orbit.changeLog).
OrbitScope<T extends OrbitStore>
Creates a store instance scoped to this widget's subtree, instead of the app-wide singleton Orbit.use<T>() returns. Useful for dialogs, tabs, nested navigators, or any reusable component that needs its own independent copy of a store's state.
OrbitSelector<T extends OrbitStore, S>
Like OrbitBuilder, but only rebuilds when the value returned by selector actually changes — useful when a store holds a lot of state but a given widget only cares about one slice of it. Also picks up an ancestor OrbitScope<T> automatically, same as OrbitBuilder.
OrbitStore
Base class for all Orbit stores.
OrbitStoreRef<T extends OrbitStore>
A reference to a store, created once via defineStore.
OrbitUndoEntry
Represents a single store state change record in Orbit's undo/redo history.
OrbitUndoGroup
Represents a group of state mutations captured during a single batch execution.
OrbitUndoItem
Base class for items stored in Orbit's undo/redo stacks.
StoreReader
An interface passed to the compute function in ComputedStore to read other stores.
StreamProvider<T>
An OrbitStore that exposes the state of a Stream.

Mixins

Undoable
A mixin on OrbitStore that opts the store into global undo/redo support.

Extensions

OrbitContextExtension on BuildContext
Ergonomic extensions on BuildContext for accessing and watching Orbit stores.

Functions

defineStore<T extends OrbitStore>(T create()) OrbitStoreRef<T>
Declares a store once, Pinia-defineStore-style:

Typedefs

OrbitObserver = void Function(OrbitStore store, OrbitMutation mutation)
Called for every mutation, on every store, once registered via Orbit.observe. Gets both the store (already reflecting the new state) and the OrbitMutation describing what happened.