state property

T get state

The computed value.

Normally recomputation happens reactively: OrbitStore.dispose() notifies dependents immediately when a dependency is torn down (e.g. via Orbit.reset<T>()), which triggers _recompute right away. This getter's own disposed-dependency check is just a fallback for anything that disposed a dependency without going through the normal notify path.

Implementation

T get state {
  // Reading .state on a store that's still mid-computation (i.e.
  // it's on the compute stack below us) means a cycle: Orbit.use()
  // already registered this instance before its first _runCompute()
  // finished, so whoever's reading it back mid-flight would
  // otherwise hit a bare "LateInitializationError" on _state instead
  // of a clear explanation. See _computeStack.
  _assertNotComputing();
  if (_hasDisposedDependencies()) {
    _recompute();
  }
  return _state;
}