fetchPublicChatRoomsFromServer method
Gets chat room data from the server with pagination.
Param pageNum The page number, starting from 1.
Param pageSize The number of records per page.
Return Chat room data. See ChatPageResult.
Throws A description of the exception. See ChatError.
Implementation
Future<ChatPageResult<ChatRoom>> fetchPublicChatRoomsFromServer({
int pageNum = 1,
int pageSize = 200,
}) async {
try {
Map result = await platform_interface.Client.instance.chatRoomManager.callNativeMethod(
ChatMethodKeys.fetchPublicChatRoomsFromServer,
{"pageNum": pageNum, "pageSize": pageSize});
ChatError.hasErrorFromResult(result);
return ChatPageResult<ChatRoom>.fromJson(
result[ChatMethodKeys.fetchPublicChatRoomsFromServer],
dataItemCallback: (map) {
return ChatRoom.fromJson(map);
});
} catch (e) {
rethrow;
}
}