fetchConversationListFromServer method
- @Deprecated('Use [fetchConversation] instead')
Gets the list of conversations from the server.
Param pageNum
The current page number.
Param pageSize
The number of conversations to get on each page.
Return The conversation list of the current user.
Throws A description of the exception. See ChatError.
Implementation
@Deprecated('Use [fetchConversation] instead')
///
/// Gets the list of conversations from the server.
///
/// Param [pageNum] The current page number.
///
/// Param [pageSize] The number of conversations to get on each page.
///
/// **Return** The conversation list of the current user.
///
/// **Throws** A description of the exception. See [ChatError].
///
///
///
Future<List<ChatConversation>> fetchConversationListFromServer({
int pageNum = 1,
int pageSize = 20,
}) async {
Map request = {
"pageNum": pageNum,
"pageSize": pageSize,
};
Map result = await ChatChannel.invokeMethod(
ChatMethodKeys.fetchConversationsFromServerWithPage,
request,
);
try {
ChatError.hasErrorFromResult(result);
List<ChatConversation> conversationList = [];
result[ChatMethodKeys.fetchConversationsFromServerWithPage]
?.forEach((element) {
conversationList.add(ChatConversation.fromJson(element));
});
return conversationList;
} on ChatError catch (e) {
throw e;
}
}