fetchConversationsByOptions method

Future<ChatCursorResult<ChatConversation>> fetchConversationsByOptions({
  1. required ConversationFetchOptions options,
})

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 ChatError.

Implementation

Future<ChatCursorResult<ChatConversation>> fetchConversationsByOptions({
  required ConversationFetchOptions options,
}) async {
  Map req = options.toJson();
  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.fetchConversationsByOptions,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult<ChatConversation>.fromJson(
      result[ChatMethodKeys.fetchConversationsByOptions],
      dataItemCallback: (value) {
        return ChatConversation.fromJson(value);
      },
    );
  } on ChatError catch (e) {
    throw e;
  }
}