observeLifecycle function

void observeLifecycle (
  1. StateLifecyclePhase on,
  2. VoidCallback observer
)

Implementation

void observeLifecycle(StateLifecyclePhase on, VoidCallback observer) {
  if (activeObservable == null)
    throw 'Active observers can only be initialized in assembleActiveObservers() method in State';
  (activeObservable._observerRegistry.value[on] ??= QueueList()).add(observer);
}