removeItem method

Future<void> removeItem(
  1. int index, {
  2. Duration? duration,
  3. bool disappear = false,
})

Remove an item by index duration used can be animation disappear user can be just remove it quickly, without animation

Implementation

Future<void> removeItem (int index, {Duration? duration, bool disappear = false}) async {

  if (index >= 0 && index < _items.length) {
    int oldLen = _items.length;
    await _removeItem(index, RefazynistCallType.item, duration: duration, disappear: disappear);
    oldLen--;
    if (_frontWidget == null && oldLen == 0) {
      _frontWidget = widget.emptyBuilder(context);
      setState(() {

      });
    }
    _setSharedPreferences();
  }
}