I'm working with a ListView.builder in Flutter. For now all was working fine, I have the follwing lines of code in the callback methods:
@override
void initState(){
items = new List();
for(int index = 0; index < dataList.length; index++){
items.add(...creating widget ..);
}
}
@override
Widget build(BuildContext context) {
return Container(
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: dataList.length,
itemBuilder: (BuildContext context, int index) {
return Container(
width: width,
height: 160 ,
key: UniqueKey(),
padding: EdgeInsets.all(10),
child: items[index],
);
},
),
);
}
The problem is when the data of the dataList is updated, how should I implement this list to make the list update the UI if the data values are updated, removed or place changed. Is StreamBuilder the solution?