fetchPublicChatRoomsFromServer method Null safety
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 {@link EMPageResult}.
Throws A description of the exception. See {@link EMError}.
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;
}
}