getUnimportantRoomEventStatesForRoom method

  1. @override
Future<List<Event>> getUnimportantRoomEventStatesForRoom(
  1. List<String> events,
  2. Room room
)
override

Implementation

@override
Future<List<Event>> getUnimportantRoomEventStatesForRoom(
    List<String> events, Room room) async {
  final keys = (await _roomStateBox.getAllKeys()).where((key) {
    final tuple = TupleKey.fromString(key);
    return tuple.parts.first == room.id && !events.contains(tuple.parts[1]);
  });

  final unimportantEvents = <Event>[];
  for (final key in keys) {
    final states = await _roomStateBox.get(key);
    if (states == null) continue;
    unimportantEvents.addAll(
        states.values.map((raw) => Event.fromJson(copyMap(raw), room)));
  }
  return unimportantEvents;
}