fetchPublicGroupsFromServer method
~english Gets public groups within the specified range from the server.
Param cursor The cursor for getting public groups, null for the first call.
Param pageSize The number of results expected to be returned.
Returns The result of retrieved public groups.
Throws Exception description, see EMError. ~end
~chinese 从服务器获取指定范围内的公开群。
Param cursor 获取公开群的游标,首次调用传空。
Param pageSize 期望返回结果的数量。
Return 获取到的公开群结果。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError. ~end
Implementation
Future<EMCursorResult<EMGroupInfo>> fetchPublicGroupsFromServer({
int pageSize = 200,
String? cursor,
}) async {
try {
Map req = {'pageSize': pageSize};
req.putIfNotNull("cursor", cursor);
Map result = await Client.instance.groupManager
.callNativeMethod(ChatMethodKeys.getPublicGroupsFromServer, req);
EMError.hasErrorFromResult(result);
return EMCursorResult<EMGroupInfo>.fromJson(
result[ChatMethodKeys.getPublicGroupsFromServer],
dataItemCallback: (value) {
return EMGroupInfo.fromJson(value);
});
} catch (e) {
rethrow;
}
}