active_observers library

Mixins

ActiveObservers<T extends StatefulWidget>
A type of observers that subscribes itself to the target State's lifecycle. Like ordinary observers, an active observer listens from one or many observables and reactive to the events, but the subscription is managed by the active observer rather than the observable. After subscription, data still flows from the observable to the observer. The word "active" means the observer acts actively, rather than "passively": [...]
DetailedLifecycle<T extends StatefulWidget>
DetailedLifecycleInState

Functions

observeContext<T>(T dependency(BuildContext)) ValueListenable<T>
observeDispose(void onDispose()) → void
observeInheritedWidget<T extends InheritedWidget>([T orElse()]) ValueListenable<T>
observeLifecycle(StateLifecyclePhase on, VoidCallback observer) → void
observePaint(void callback(), {bool rerunWhen()}) → void
Run callback after initial paint, then call it again when this state is updated and rerunWhen returns true. Since callback is called after paint, it can read geometric information in current and descendant widgets. Notice: this observer will not be triggered by paints caused by parent widgets, e.g. constraint updates from parent widget.
observeUpdate(VoidCallback effect(), {bool restartWhen(), Iterable values()}) → void
effect will be called in State's initState. effect should return a callback that will be called in dispose. Typically, the callback should contain effect's clean up logic. Whenever the widget is updated(didUpdateWidget), if restartWhen returns false the callback returned by previous effect will be called to clean up previous effect , then effect is called again. tl;dr effect will be restarted.

Enums

StateLifecyclePhase