fetchPublicChatRoomsFromServer method
~english 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 EMPageResult
.
Throws A description of the exception. See EMError. ~end
~chinese 以分页的方式从服务器获取聊天室数据。
Param pageNum
当前页码,从 1 开始。
Param pageSize
每页返回的记录数。
Return 分页获取结果,详见 EMPageResult
。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end
Implementation
Future<EMPageResult<EMChatRoom>> fetchPublicChatRoomsFromServer({
int pageNum = 1,
int pageSize = 200,
}) async {
Map result = await _channel.invokeMethod(
ChatMethodKeys.fetchPublicChatRoomsFromServer,
{"pageNum": pageNum, "pageSize": pageSize});
try {
EMError.hasErrorFromResult(result);
return EMPageResult<EMChatRoom>.fromJson(
result[ChatMethodKeys.fetchPublicChatRoomsFromServer],
dataItemCallback: (map) {
return EMChatRoom.fromJson(map);
});
} on EMError catch (e) {
throw e;
}
}