removeItem method

void removeItem(
  1. int index,
  2. AnimatedListRemovedItemBuilder builder, {
  3. Duration duration = _kDuration,
})

Remove the item at index and start an animation that will be passed to builder when the item is visible.

Items are removed immediately. After an item has been removed, its index will no longer be passed to the AnimatedList.itemBuilder. However the item will still appear in the list for duration and during that time builder must construct its widget as needed.

This method's semantics are the same as Dart's List.remove method: it decreases the length of the list by one and shifts all items at or before index towards the beginning of the list.

Implementation

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