ListView does not refresh whereas attached list does (Flutter)

Flutter is based around immutable data. Meaning that if the reference to an object didn’t change, the content didn’t either.

The problem is, in your case you always send to ListView the same array, and instead mutate its content. But this leads to ListView assuming the list didn’t change and therefore prevent useless render.

You can change your setState to keep that in mind :

setState(() {
  _objectList = List.from(_objectList)
    ..add(Text("foo"));
});

Leave a Comment