fetchConversationsByOptions method

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

~english Fetches conversations by options. Param options The options for fetching conversations, see ConversationFetchOptions. Returns The list of 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 {
  Map req = options.toJson();
  Map result = await ChatChannel.invokeMethod(
      ChatMethodKeys.fetchConversationsByOptions, req);
  try {
    EMError.hasErrorFromResult(result);
    return EMCursorResult<EMConversation>.fromJson(
        result[ChatMethodKeys.fetchConversationsByOptions],
        dataItemCallback: (value) {
      return EMConversation.fromJson(value);
    });
  } on EMError catch (e) {
    throw e;
  }
}