getConversationsFromServer method
- @Deprecated('Use [fetchConversationsByOptions] instead')
~english Gets the conversation list from the server.
To use this function, you need to contact our business manager to activate it. After this function is activated, users can pull 10 conversations within 7 days by default (each conversation contains the latest historical message). If you want to adjust the number of conversations or time limit, please contact our business manager.
Return The conversation list of the current user.
Throws A description of the exception. See ChatError. ~end
~chinese 从服务器获取会话列表。
该功能需联系商务开通,开通后,用户默认可拉取 7 天内的 10 个会话(每个会话包含最新一条历史消息),如需调整会话数量或时间限制请联系商务经理。
Return 返回获取的会话列表。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
@Deprecated('Use [fetchConversationsByOptions] instead')
/// ~english
/// Gets the conversation list from the server.
///
/// To use this function, you need to contact our business manager to activate it. After this function is activated, users can pull 10 conversations within 7 days by default (each conversation contains the latest historical message). If you want to adjust the number of conversations or time limit, please contact our business manager.
///
/// **Return** The conversation list of the current user.
///
/// **Throws** A description of the exception. See [ChatError].
/// ~end
///
/// ~chinese
/// 从服务器获取会话列表。
///
/// 该功能需联系商务开通,开通后,用户默认可拉取 7 天内的 10 个会话(每个会话包含最新一条历史消息),如需调整会话数量或时间限制请联系商务经理。
///
/// **Return** 返回获取的会话列表。
///
/// **Throws** 如果有异常会在这里抛出,包含错误码和错误描述,详见 [ChatError]。
/// ~end
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;
}
}