removeItem method

Future<void> removeItem(
  1. T item, [
  2. int? index
])

Implementation

Future<void> removeItem(T item, [int? index]) async {
  var _list = dataList;
  int _index = index ?? _list.indexOf(item);

  if (_index != -1) {
    await callOnRemove(_index, skipDelay: true);
    dataSubject.add(DataWrapper(_list, null));

    if (dataLength == 0 && listLength == 1) {
      await callOnRemove(0, skipDelay: true);
    }
  }
}