fetchConversationsByOptions method

Future<EMCursorResult<EMConversation>> fetchConversationsByOptions({
  1. required ConversationFetchOptions options,
})

~english Gets conversations from the server by conversation filter options.

Param options The conversation filter options. See ConversationFetchOptions. Returns The list of retrieved conversations. Throws A description of the exception. See EMError. ~end ~chinese 根据会话过滤选项获取服务端的会话。 Param options 会话过滤选项, 详见 ConversationFetchOptions。 Returns 会话列表。 Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。 ~end

Implementation

Future<EMCursorResult<EMConversation>> fetchConversationsByOptions({
  required ConversationFetchOptions options,
}) async {
  try {
    Map req = options.toJson();
    Map result = await Client.instance.chatManager
        .callNativeMethod(ChatMethodKeys.fetchConversationsByOptions, req);
    EMError.hasErrorFromResult(result);
    return EMCursorResult<EMConversation>.fromJson(
        result[ChatMethodKeys.fetchConversationsByOptions],
        dataItemCallback: (value) {
      return EMConversation.fromJson(value);
    });
  } catch (e) {
    rethrow;
  }
}