I have a ListView like this but it isn't updating when the value of "mats" changes. The build function is called every time there is an update of my list of mats. The print shows the correct data but the ListView doesn't update correct. Only the number of items updates correct.
flutter: MATS: [[8163b55b-9a4c-44e8-a95e-064b3f5e8a67, , 26.06.2019, [], 0.00 EUR]] flutter: MATS: [[8163b55b-9a4c-44e8-a95e-064b3f5e8a67, Unnamed, 26.06.2019, [], 0.00 EUR]]
Widget build(BuildContext context) {
print('MATS: $mats');
return Padding(
padding: const EdgeInsets.all(8.0),
child: mats.length == 0
? Center(
child: Text('Add your first mat to start the party.'),
)
: mats != null
? ListView.builder(
key: Key('matsList'),
itemCount: mats?.length ?? 0,
itemBuilder: (context, index) {
final viewModel = mats[index];
return MatCardView(
key: Key('viewModel.toString()'),
viewModel: viewModel,
onSelect: onSelect,
);
})
: Container(
child: Center(
child: Text('No beer mat yet'),
),
),
);
}