admin管理员组文章数量:1278789
For the ideal separation of view and logic how does one initialize a mobx store that makes an asynchronous API call, for a page/widget without the use of FutureBuilder? e.g. I log in and navigate to home page, home page needs to initialize 3 stores to get a bunch of info and display it.
I don’t believe initialization in initState is the way to do it as initState cannot be async and making an async call without await inside initState for something that impacts the UI directly is not ideal?
One could initialize the stores at startup but most of the API calls requiring authentication happen post login. For the stores that don’t need authentication it’s simple to initialize them at startup.
Trying to find the cleanest way to do this following a design pattern.
This question most likely applies to other state management methods also.
本文标签: dartCorrect use of MobX stores without using FutureBuilder in FlutterStack Overflow
版权声明:本文标题:dart - Correct use of MobX stores without using FutureBuilder in Flutter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741301230a2371100.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论