removeItem method

void removeItem(
  1. bool test(
    1. T item
    )
)

Implementation

void removeItem(bool Function(T item) test) {
  if (state is! ListLoaded<T>) return;
  final current = state as ListLoaded<T>;
  final updatedItems = current.items.where((item) => !test(item)).toList();
  emit(current.copyWith(items: updatedItems));
}