Flutter AnimatedList - how to update an existing item?

64 Views Asked by At

AnimatedList has two methods, insert and delete for items in the list. https://api.flutter.dev/flutter/widgets/AnimatedList-class.html

In my case I have complex items, and their properties can change.

How would I update an existing item in an AnimatedList if a property changes without removing or inerting the whole item again?

Would it be a simple setState call?

1

There are 1 best solutions below

0
harsh bangari On BEST ANSWER

Use the setState method for updating the list item builder. Reference

 setState(() {
                  items[index].checked = value!;
                });