removeAt method

Future<void> removeAt(
  1. int index, {
  2. bool isQuiet = false,
})

Remove the item at index. Set isQuiet = true to avoid rendering loading state, default false.

Implementation

Future<void> removeAt(int index, {bool isQuiet = false}) async {
  _error = null;
  _isRemoving = true;
  if (_isMounted && !isQuiet) notifyListeners();

  try {
    final result = await onRemove(index);
    _data.removeAt(result);
    _isRemoving = false;
    if (_isMounted && !isQuiet) notifyListeners();
  } catch (e) {
    _isRemoving = false;
    _setError(e);
  }
}