flutter - Flutter:动态地将值添加到复杂的地图中
问题描述
在地图中
Map test = {};
从 textFields onChanged 事件添加值的方法是什么:
onChanged: (value) {
// This is the onChanged Method of quantity textField
test['$index'] = ? /* This is the V/K 'qty': value */
},
我还有两个 texFields:
onChanged: (value) {
// This is the onChanged Method of element1 textField
test['$index'] = ? /* This is theV/K 'el1': value */
},
和:
onChanged: (value) {
// This is the onChanged Method of element2 textField
test['$index'] = ? /* This is theV/K 'el2': value */
},
这是最终的愿望地图:
{
0: {qty: 100, el1: element1, el2: element2},
1: {qty: 200, el1: element1, el2: element2},
2: {qty: 300, el1: element1, el2: element2}
}
其中 0,1,2...N 是索引
我将永远感谢任何帮助或建议
解决方案
推荐阅读
- c - 谁能解释这个 C 代码的输出?
- django - 将上下文从一个视图传递到另一个视图
- java - 当你点击它时,用消失的文本制作一个 JTextField
- android - RecyclerView 显示为灰色框,其名称位于中心。对于已实现的音频可视化器视图也是如此
- html - 为什么带有 (@media print display: none; ) 的 html 元素在打印时显示为空白以及如何删除空白?
- java - Android 不考虑 URL 中的完整 GET 参数
- jupyter-notebook - 使用 Latex 将 Juypter Notebook 导出到 Markdown 时遇到问题
- ios - iOS Simulator 如何自动化用户操作然后继续调试
- electron - 从主进程与菜单栏窗口的通信不起作用
- ansible - 任务仅在所需的目录文件夹不可用时运行,否则它将跳过该任务