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