state_lifecycle_observer 0.0.6 copy "state_lifecycle_observer: ^0.0.6" to clipboard
state_lifecycle_observer: ^0.0.6 copied to clipboard

A reusable Flutter state observer pattern implementation.

0.0.6 #

  • Replace assert with StateError for missing mixin, correct addLifecyccleCallback typo.

0.0.5 #

  • Add addLifecyccleCallback
  void initState() {
    super.initState();
    addLifecycleCallback(
      onInitState: () {
        widget.log.onInitState++;
      },
      onDidUpdateWidget: () {
        widget.log.onDidUpdateWidget++;
      },
      onDispose: () {
        widget.log.onDispose++;
      },
      onBuild: (context) {
        widget.log.onBuild++;
      },
    );
  }

0.0.4 #

  • Breaking Change: Renamed LifecycleObserverMixin to LifecycleOwnerMixin to better reflect its role.
  • Breaking Change: LifecycleObserver initialization is now deferred. target is available only after onInitState is called (which happens automatically). Accessing it prematurely throws LateInitializationError.
  • Enhancement: Added automatic synchronization for "late" observers. Observers added after initState are now immediately initialized to catch up with the lifecycle.
  • Refactor: Introduced LifecycleState enum (created, initialized, disposed) to track component state.
  • Fix: Removed StateWithObservers interface in favor of checking against LifecycleOwnerMixin directly.

0.0.3 #

  • Enhancement: Introduced safeSetState in LifecycleObserver to handle state updates safely across different scheduler phases.
  • Fix: FutureObserver and StreamObserver now use safeSetState to prevent errors when updates are triggered during build, layout, or paint phases.
  • Docs: Reorganized README to clearly categorize built-in observers (Base, Widget, Anim) and added clarification on key usage.

0.0.2 #

  • Breaking Change: Renamed onUpdate to onDidUpdateWidget to better align with Flutter's lifecycle naming.
  • Breaking Change: Removed onInit. Initialization logic should be moved to the constructor or buildTarget.
  • Enhancement: Added safety assertion to ensure state mixes in LifecycleObserverMixin.
  • Docs: Updated README with key usage explanation and new API examples.

0.0.1 #

  • Initial release.
  • Added LifecycleObserver base class and LifecycleOwnerMixin.
  • Included common observers:
    • AnimControllerObserver (supports full AnimationController params)
    • ScrollControllerObserver
    • TabControllerObserver
    • TextEditingControllerObserver
  • Implemented automatic lifecycle management (onInit, onUpdate, onDispose).
  • Seamless integration via super.build(context).
2
likes
0
points
84
downloads

Publisher

unverified uploader

Weekly Downloads

A reusable Flutter state observer pattern implementation.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on state_lifecycle_observer