getConversationsFromServer method
- @Deprecated('Use [fetchConversationsByOptions] instead')
~english Gets the conversation list from the server.
Return The conversation list of the current user.
Throws A description of the exception. See EMError. ~end
~chinese 从服务器获取会话列表。
Return 返回获取的会话列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end
Implementation
@Deprecated('Use [fetchConversationsByOptions] instead')
/// ~english
/// Gets the conversation list from the server.
///
/// **Return** The conversation list of the current user.
///
/// **Throws** A description of the exception. See [EMError].
/// ~end
///
/// ~chinese
/// 从服务器获取会话列表。
///
/// **Return** 返回获取的会话列表。
///
/// **Throws** 如果有异常会在这里抛出,包含错误码和错误描述,详见 [EMError]。
/// ~end
Future<List<EMConversation>> getConversationsFromServer() async {
try {
Map result = await Client.instance.chatManager
.callNativeMethod(ChatMethodKeys.getConversationsFromServer);
EMError.hasErrorFromResult(result);
List<EMConversation> conversationList = [];
result[ChatMethodKeys.getConversationsFromServer]?.forEach((element) {
conversationList.add(EMConversation.fromJson(element));
});
return conversationList;
} catch (e) {
rethrow;
}
}