fetchPublicGroupsFromServer method
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 ChatError.
Implementation
Future<ChatCursorResult<ChatGroupInfo>> fetchPublicGroupsFromServer({
int pageSize = 200,
String? cursor,
}) async {
try {
Map req = {'pageSize': pageSize};
req.putIfNotNull("cursor", cursor);
Map result = await platform_interface.Client.instance.groupManager
.callNativeMethod(ChatMethodKeys.getPublicGroupsFromServer, req);
ChatError.hasErrorFromResult(result);
return ChatCursorResult<ChatGroupInfo>.fromJson(
result[ChatMethodKeys.getPublicGroupsFromServer],
dataItemCallback: (value) {
return ChatGroupInfo.fromJson(value);
});
} catch (e) {
rethrow;
}
}