【发布时间】:2019-08-10 02:30:48
【问题描述】:
我是 Dart/Flutter 的新手。所以请原谅我。我正在尝试创建一个下面提到的 TestData 对象类。 TestData 中的变量之一是 TestChildClass 的 Map。如何访问子变量并设置它们。并得到它们。
class TestData{
int id;
var childClass = new Map<TestChildClass, String>();
TestData.items({
this.id,
this.childClass
});
}
class TestChildClass{
int childid;
}
List <TestData> data = [
TestData.items(
id: 1,
//childClass: {TestChildClass.:1, 1} how do i set and get this
)
];
也是对此的跟进。
如何遍历 Map 并迭代字符串中的值。我想要一个简单的 childClass.getData 函数。它通过 childClass 并转换字符串中的所有 Key 值。
谢谢!
【问题讨论】: