getThreadConversation method

Future<ChatConversation?> getThreadConversation(
  1. String threadId
)

Gets the thread conversation by thread ID.

Param threadId The thread ID.

Return The conversation object.

Throws A description of the exception. See ChatError.

Implementation

Future<ChatConversation?> getThreadConversation(String threadId) async {
  try {
    Map req = {"convId": threadId};
    Map result = await platform_interface.Client.instance.chatManager
        .callNativeMethod(ChatMethodKeys.getThreadConversation, req);
    ChatError.hasErrorFromResult(result);
    if (result.containsKey(ChatMethodKeys.getThreadConversation)) {
      return ChatConversation.fromJson(
          result[ChatMethodKeys.getThreadConversation]);
    } else {
      return null;
    }
  } catch (e) {
    rethrow;
  }
}