flutterdartwidgetstateful

Difference Between Deactivate and Dispose?


In Flutter, StatefulWidget has dispose() and deactivate(). How are they different?


Solution

  • 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.