fetchAllowListFromServer method

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

~english Gets the group allowlist from the server.

Param groupId The group ID.

Returns The group allowlist.

Throws Exception description, see EMError. ~end

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

Param groupId 群组 ID。

Return 群组白名单列表。

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

Implementation

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