getParticipants method

List<User> getParticipants([
  1. List<Membership> membershipFilter = const [Membership.join, Membership.invite, Membership.knock]
])

Returns all participants for this room. With lazy loading this list may not be complete. Use requestParticipants in this case. List membershipFilter defines with what membership do you want the participants, default set to [Membership.join, Membership.invite, Membership.knock]

Implementation

List<User> getParticipants(
    [List<Membership> membershipFilter = const [
      Membership.join,
      Membership.invite,
      Membership.knock,
    ]]) {
  final members = states[EventTypes.RoomMember];
  if (members != null) {
    return members.entries
        .where((entry) => entry.value.type == EventTypes.RoomMember)
        .map((entry) => entry.value.asUser)
        .where((user) => membershipFilter.contains(user.membership))
        .toList();
  }
  return <User>[];
}