getConversationsFromServer method
- @Deprecated('Use [fetchConversationsByOptions] instead')
从服务器获取会话列表。
Return 返回获取的会话列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。
Implementation
@Deprecated('Use [fetchConversationsByOptions] instead')
///
///
/// 从服务器获取会话列表。
///
/// **Return** 返回获取的会话列表。
///
/// **Throws** 如果有异常会在这里抛出,包含错误码和错误描述,详见 [ChatError]。
///
Future<List<ChatConversation>> getConversationsFromServer() async {
Map result = await ChatChannel.invokeMethod(
ChatMethodKeys.getConversationsFromServer);
try {
ChatError.hasErrorFromResult(result);
List<ChatConversation> conversationList = [];
result[ChatMethodKeys.getConversationsFromServer]?.forEach((element) {
conversationList.add(ChatConversation.fromJson(element));
});
return conversationList;
} on ChatError catch (e) {
throw e;
}
}