getAudienceList method

Future<void> getAudienceList()

Implementation

Future<void> getAudienceList() async {
  try {
    final userListResult = await liveService.getUserList(0);

    if (TUIError.success == userListResult.code && userListResult.data != null) {
      userState.userList.value.clear();

      final userInfoSet = <UserInfo>{};
      for (final userInfo in userListResult.data!.userInfoList) {
        if (userInfo.userId == roomState.ownerInfo.userId) {
          continue;
        }
        final liveUserInfo = UserInfo.fromTUIUserInfo(userInfo);
        userInfoSet.add(liveUserInfo);
      }
      userState.addUserList(userInfoSet);
    } else {
      ErrorHandler.onError(userListResult.code);
    }
  } catch (error, stackTrace) {
    LiveKitLogger.error('getAudienceList Error: $error\n$stackTrace');
  }
}