getUsers method

  1. @override
Future<List<User>> getUsers(
  1. Room room
)
override

Implementation

@override
Future<List<User>> getUsers(Room room) async {
  final users = <User>[];
  final keys = (await _roomMembersBox.getAllKeys())
      .where((key) => TupleKey.fromString(key).parts.first == room.id)
      .toList();
  final states = await _roomMembersBox.getAll(keys);
  states.removeWhere((state) => state == null);
  states.forEach(
    (state) => users.add(Event.fromJson(copyMap(state!), room).asUser),
  );

  return users;
}