fetchAllowListFromServer method

Future<List<String>> fetchAllowListFromServer(
  1. String groupId
)

~english Gets the allow list of the group from the server.

Only the group owner or admin can call this method.

Param groupId The group ID.

Return The allow list of the group.

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

~chinese 获取群组白名单列表。

仅群主和管理员可调用此方法。

Param groupId 群组 ID。

Return 群组的白名单。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end

Implementation

Future<List<String>> fetchAllowListFromServer(String groupId) async {
  Map req = {'groupId': groupId};
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.getGroupWhiteListFromServer, req);
  try {
    List<String> list = [];
    EMError.hasErrorFromResult(result);
    result[ChatMethodKeys.getGroupWhiteListFromServer]?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });
    return list;
  } on EMError catch (e) {
    throw e;
  }
}