有状态的小部件在Redux/Flutter应用程序中有意义吗? [英] Does stateful widgets make sense in a Redux/Flutter app?

查看:61
本文介绍了有状态的小部件在Redux/Flutter应用程序中有意义吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究将Redux与Flutter结合使用,我有一个问题,如果您遵循redux架构,在Flutter中使有状态的小部件有意义吗?我可以认为对于动画和小小部件来说更好创建一个有状态的小部件,而不是真正的appState的新属性,但我不确定...我需要有人来澄清这个假问题.

I am studying Redux combining it with Flutter, and I have this question, does making stateful widgets make sense in Flutter if you follow redux architecture? I could think that for animations and little widgets it's better to make a stateful widget rather than a new attribute to the real appState, but I am not really sure... I need someone to clarify me this dummy question.

推荐答案

Redux甚至还不能替代StatefulWidget.

Redux is not even close to replacing StatefulWidget.

一个简单的例子是动画.它们每个都需要存储,放置和与 AnimationController/Tweens 进行交互.

A simple example is animations. Each of them requires to store, dispose and interact with an AnimationController/Tweens.

Redux确实适用于可序列化状态.通常来自您的API的内容,您可能会或可能不想将其存储在设备上.

Redux really is for a serializable state. Typically what comes from your API, which you may or may not want to store on the device.

StatefulWidget 用于其他所有功能.

这篇关于有状态的小部件在Redux/Flutter应用程序中有意义吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆