有一组List:
final List items = [
[
['小红', 123],
['小明', 456]
],
[
['小白', 000],
['小陈', 090]
],
[
['小懂', 731],
['小黑', 222]
]
];
- 要让它显示在Widget里,尝试了很久没成功,我失败的方法:
children: items.map((i) {
return Tab(
// text: i.toString(),
child: Row(
children: i.map((ii) {
return Column(
children: ii.map((iii) {
return Text('data');
}).toList(),
);
}).toList(),
),
);
}).toList(),
第一个map没问题,从第二个map开始就一直出错,错误有的是:Another exception was thrown: type 'MappedListIterable<String, dynamic>' is not a subtype of type 'List<Widget>'
有的是类型不对,但是我是从一个List里取出来的,为何会这样?第一个map没报错,后面的就不行。
已解决,注意使用<Widget>声明,并使用index提取数据