deactivate method
The framework calls this method whenever it removes this State object from the tree.
Implementation
@protected
@override
@mustCallSuper
void deactivate() {
/// The framework calls this method whenever it removes this [State] object
/// from the tree. It might reinsert it into another part of the tree.
/// Subclasses should override this method to clean up any links between
/// this object and other elements in the tree (e.g. if you have provided an
/// ancestor with a pointer to a descendant's [RenderObject]).
/// No 'setState()' functions are allowed to fully function at this point.
_rebuildAllowed = false;
for (final listener in _beforeList) {
listener.deactivate();
}
for (final con in _beforeList) {
con.deactivate();
}
for (final listener in _beforeList) {
listener.deactivate();
}
super.deactivate();
_rebuildAllowed = true;
/// In some cases, if then reinserted back in another part of the tree
/// the build is called, and so setState() is not necessary.
_rebuildRequested = false;
}