简体   繁体   English

Flutter:如何重置提供者视图模型数据?

[英]Flutter: How to reset provider view model data?

Is there any way to reset all view model data (ChangeNotifier)?有没有办法重置所有视图模型数据(ChangeNotifier)? Tried to dispose the view model but didn't work.试图处理视图模型但没有工作。 I want to clear all data when user logout.我想在用户注销时清除所有数据。

Does this help you? 对你有帮助吗? Basically adding an ObjectKey to your Provider which you change when the user logs out or whatever.基本上是将一个 ObjectKey 添加到您的 Provider 中,您可以在用户注销或其他任何情况下更改它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM