removeEvent method

  1. @override
Future<void> removeEvent(
  1. String eventId,
  2. String roomId
)
override

Implementation

@override
Future<void> removeEvent(String eventId, String roomId) async {
  await _eventsBox.delete(MultiKey(roomId, eventId).toString());
  for (final key in _timelineFragmentsBox.keys) {
    final multiKey = MultiKey.fromString(key);
    if (multiKey.parts.first != roomId) continue;
    final List eventIds = await _timelineFragmentsBox.get(key) ?? [];
    final prevLength = eventIds.length;
    eventIds.removeWhere((id) => id == eventId);
    if (eventIds.length < prevLength) {
      await _timelineFragmentsBox.put(key, eventIds);
    }
  }
  return;
}