简体   繁体   English

如何在 flutter 中迭代 rendred 小部件?

[英]how to iterate through rendred widgets in flutter?

I have 4 widgets named OptionCard (it's their Type) i'de like to iterate through them to check the value of their variables how can I do it?我有 4 个名为 OptionCard 的小部件(这是它们的类型)我想遍历它们以检查它们的变量值我该怎么做?

tried OptionCard.forEach but it doesn't work尝试了 OptionCard.forEach 但它不起作用

This is not the way Flutter widgets are supposed to be used.这不是应该使用 Flutter 小部件的方式。 Widgets (even StatefulWidgets) generally do not hold application state.小部件(甚至是 StatefulWidgets)通常不保存应用程序状态。 They should only provide a view on state managed elsewhere.他们应该只提供对别处管理的状态的看法。

There are many proven methods of application state management that are popular and well supported in Flutter.有许多经过验证的应用程序状态管理方法在 Flutter 中很流行并且得到了很好的支持。

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

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