List 从列表中获取itemCount
我有这个List 从列表中获取itemCount,list,flutter,listview,dart,List,Flutter,Listview,Dart,我有这个json结构 "abc":{ current_checklist:[ { .... }, { "sections":[ ... ] }, { ... } ] } 我想使用ListView
json
结构
"abc":{
current_checklist:[
{
....
},
{
"sections":[
...
]
},
{
...
}
]
}
我想使用ListView
,其中itemCount
基于节。我该怎么写呢
Widget _displayCheckList(ABCData abcData) {
return ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount:
abcData.abc.currentChecklist.???,length, // how to get the "sections" length?
itemBuilder: (context, index) {
return Text("Hello");
},
);
}
}
如果能看到一些有效的json样本数据就好了 你有没有试过这样的方法:
abcData.abc.currentChecklist[0].sections or
abcData.abc.currentChecklist[1].sections
部分是否仅在当前清单
的一个对象中可用,还是在所有对象中都可用?@RaviSinghLodhi