Difference Between Deactivate and Dispose?

强颜欢笑 提交于 2020-02-24 03:37:23

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/56387243/difference-between-deactivate-and-dispose

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!