observable_state_lifecycle 0.3.0 copy "observable_state_lifecycle: ^0.3.0" to clipboard
observable_state_lifecycle: ^0.3.0 copied to clipboard

outdated

Make Flutter StatefulWidget's lifecycle observable.

observable_state_lifecycle #

Make Flutter StatefulWidget's lifecycle observable.

Getting Started #

When creating your StatefulWidget, add a mixin from this library:

// A Widget named Test

import 'package:observable_state_lifecycle/observable_state_lifecycle.dart';

class _TestState extends State<Test> with ObservableStateLifecycle<Test> {

}

Then you can call addLifecycleObserver in your state:

class _TestState extends State<Test> with ObservableStateLifecycle<Test> {
  _TestState() {
    addLifecycleObserver((phase){
      if(phase == StateLifecyclePhase.initState) {
        setState((){
          n = 2;
        });
      }
    });

    int n = 1;
  }
}

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Make Flutter StatefulWidget's lifecycle observable.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on observable_state_lifecycle