getThreadConversation method

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

~english Gets the thread conversation by thread ID.

Param threadId The thread ID.

Return The conversation object.

Throws A description of the exception. See ChatError. ~end

~chinese 根据thread ID 获取 thread 会话。

Param threadId Thread ID.

Return 会话对象.

Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end

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;
  }
}