init method

  1. @override
FutureOr<void> init()
override

Called exactly once, immediately after the store is first created by Orbit.use (or OrbitScope). Override to run setup logic — e.g. loading persisted state from disk, or an initial network fetch. Can be synchronous or asynchronous.

A synchronous init (or the default no-op) has already finished by the time the store is returned to its caller — ready is immediately complete. An asynchronous init keeps running in the background; the store is still usable right away (its fields just haven't been touched by init yet), and ready completes once it finishes.

If init throws synchronously, the store is disposed and never registered — the caller's Orbit.use/OrbitScope rethrows immediately. If the returned future fails instead, the store stays registered (it was already handed out) but initError is set and ready completes with that error.

Implementation

@override
FutureOr<void> init() {
  _subscribe();
}