addParticipantsList method

void addParticipantsList(
  1. RxList<UserListModel> userList
)

Implementation

void addParticipantsList(RxList<UserListModel> userList) {
  for (var model in userList) {
    var chatModelList = ChatListModel(model.name!, model.clientId!, []);
    privateChatListData.add(chatModelList);

    if (model.role == 'participant') {
      var userModel = UserModel(
          model.clientId!,
          model.name!,
          model.role!,
          model.audioMuted!,
          model.videoMuted!,
          false,
     "" );
      participantsList.add(userModel);
    } else {
      var userModel = UserModel(
          model.clientId!,
          model.name!,
          model.role!,
          model.audioMuted!,
          model.videoMuted!,
          false,""
      );
      moderatorsList.add(userModel);
    }
  }

  moderatorsList.refresh();
  participantsList.refresh();

  // Clear fullList before adding updated lists to prevent duplicates
  fullList.clear();
  fullList.addAll(moderatorsList);
  fullList.addAll(participantsList);

  EnxSetting.instance.setParticipantList(fullList);
}