insert method

void insert({
  1. int index = 0,
  2. required T item,
  3. bool animation = true,
})

Insert Grid Item to update itemList, and render DragGrid

Implementation

void insert({int index = 0, required T item, bool animation = true}) {
  if (index < 0) {
    index = itemList.length + index;
  }

  if (index >= 0 && index < _itemList.length) {
    _itemList.removeWhere((opt) => opt == item);
    _itemList.insert(index, item);
    _animation = animation;
    notifyListeners();
  }
}