Difference Between Deactivate and Dispose?

deactivate:

Called when object is removed from the tree. In some cases, the framework will reinsert the State object into another part of the tree (e.g., if the subtree containing this State object is grafted from one location in the tree to another). source

dispose:

Called when this object is removed from the tree permanently. source

By understanding both sentences, you'll see that deactivate will be called for widgets that are removed from the tree, temporarily or permanently, whereas dispose will only be called for widgets being removed permanently.

Thanks to Antonio Oliveira for the links, now I understand.


dispose is definitive. deactivate is not.

deactivate is called when a widget may be disposed. But that is not guaranteed.

A typical situation where deactivate is called but not dispose,is when moving widgets in the widget tree using a GlobalKey.