delete method

  1. @override
void delete({
  1. required String topic,
  2. String? id,
})
override

Implementation

@override
void delete({required String topic, String? id}) {
  if (id == null) {
    _map.remove(topic);
    return;
  }
  if (!_map.containsKey(topic)) return;
  final ids = get(topic);
  if (!exists(topic, id)) return;
  final remaining = ids.where((x) => x != id).toList();
  if (remaining.isEmpty) {
    _map.remove(topic);
    return;
  }
  _map[topic] = remaining;
}