insertItem method Null safety

void insertItem(
  1. int index,
  2. {Duration duration = _kDuration}
)

Insert an item at index and start an animation that will be passed to AnimatedList.itemBuilder when the item is visible.

This method's semantics are the same as Dart's List.insert method: it increases the length of the list by one and shifts all items at or after index towards the end of the list.

Implementation

void insertItem(int index, { Duration duration = _kDuration }) {
  _sliverAnimatedListKey.currentState!.insertItem(index, duration: duration);
}