fetchChatRoomAllowListFromServer method

Future<List<String>> fetchChatRoomAllowListFromServer(
  1. String roomId
)

~english Gets the allow list from the server.

Only the chat room owner or admin can call this method.

Param roomId The chat room ID.

Return The chat room allow list.

Throws A description of the exception. See EMError. ~end

~chinese 从服务器获取白名单列表。

仅聊天室所有者和管理员可调用此方法。

Param roomId 聊天室 ID。

Return 聊天室白名单列表。

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end

Implementation

Future<List<String>> fetchChatRoomAllowListFromServer(String roomId) async {
  Map req = {"roomId": roomId};
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.fetchChatRoomWhiteListFromServer, req);

  try {
    EMError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.fetchChatRoomWhiteListFromServer]
        ?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });
    return list;
  } on EMError catch (e) {
    throw e;
  }
}