Keep a list from provider up to date with AnimatedListView

Viewed 450

I'm using the Provider library and have a class that extends ChangeNotifier. The class provides an UnmodifiableListView of historicalRosters to my widgets.

I want to create an AnimatedListView that displays these rosters. The animated list supposedly needs a separate list which will tell the widget when the widget to animate in or out new list items.

final GlobalKey<AnimatedListState> _listKey = GlobalKey<AnimatedListState>();

This example uses a model to update both the list attached to the widget's state and the AnimateListState at the same time.

// Inside model
void insert(int index, E item) {
  _items.insert(index, item);
  _animatedList.insertItem(index);
}

I want to do the same thing but I'm having trouble thinking how. That is, what's a good way I can update the list provided by provider and also change the AnimatedListState.

0 Answers
Related