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 {
  Map result = await ChatChannel.invokeMethod(
    ChatMethodKeys.getThreadConversation,
    {"convId": threadId},
  );

  try {
    ChatConversation? ret;
    ChatError.hasErrorFromResult(result);
    if (result[ChatMethodKeys.getThreadConversation] != null) {
      ret = ChatConversation.fromJson(
          result[ChatMethodKeys.getThreadConversation]);
    }
    return ret;
  } on ChatError catch (e) {
    throw e;
  }
}