removeAt method

E removeAt(
  1. int index
)

Implementation

E removeAt(int index) {
  try {
    final E removedItem = runInAction(() {
      final removed = _items.removeAt(index);
      if (container != null && attribute != null) {
        container![attribute!] = _items;
      }
      return removed;
    });
    if (removedItem != null) {
      if (_animatedList == null) {
        log.info("Something weird is going on!");
      }
      _animatedList?.removeItem(index,
          (BuildContext context, Animation<double> animation) {
        final removed =
            removedItemBuilder!(context, removedItem, index, animation);
        return removed;
      });
    }
    _sync();
    return removedItem;
  } catch (e) {
    log.info("Error updating list state: $e");
    rethrow;
  }
}