I have a class and I want to know when my class leave my tree widget. I think I can do that with lifecycle of app but I don't know how to do that.
please help
CodePudding user response:
enter code here
one thing you could do is useStatefullWidget
and in that class we have a one function called deactivate()
void deactivate() {
// USE YOUR FUNCTION
print("deactiv");
super.deactivate();
}
CodePudding user response:
in StatefullWidget there is a method name deactivate just call that method and place your code in it which will execute when widget is deactivated from widget tree
@override
void deactivate() {
log('Deactivated');
// TODO : Place your code here which will execute at deactivation
super.deactivate();
}