fetchChatRoomAllowListFromServer method

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

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 ChatError.

Implementation

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

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