defineStore<T extends OrbitStore> function

OrbitStoreRef<T> defineStore<T extends OrbitStore>(
  1. T create()
)

Declares a store once, Pinia-defineStore-style:

final counterStore = defineStore(() => CounterStore());

// anywhere in the app:
counterStore().increment();

OrbitBuilder<CounterStore>(
  store: counterStore,
  builder: (context, store, child) => Text('${store.count}'),
)

This is the recommended way to reach for a store — prefer it over calling Orbit.use<T>(() => T()) directly at each call site, since only defineStore's factory is guaranteed to run.

Implementation

OrbitStoreRef<T> defineStore<T extends OrbitStore>(T Function() create) =>
    OrbitStoreRef<T>(create);