removeAllItems method
Removes multiple objects from the container.
This method extracts the ID from each item using getId, then removes all corresponding objects from the backend in a single batch operation. After removal, key-specific listeners for each key are notified, followed by all global listeners.
Parameters:
items- The objects to remove. IDs are extracted using getId.
Throws:
- ArgumentError if any extracted ID is invalid
See also:
- removeItem for removing a single object
- removeAll for removing multiple objects by key
- clear for removing all objects
Implementation
@override
Future<void> removeAllItems(Iterable<E> items) async {
final keys = items.map(getId).toList();
await backend.removeAll(keys.map(encodeKey));
for (final key in keys) {
notifyKeyListeners(key);
}
notifyListeners();
}