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