joinChatThread method

Future<ChatThread> joinChatThread({
  1. required String chatThreadId,
})

~english Join Chat Thread.

Group members have permission. Join successfully, return the Chat Thread details ChatThread, the details do not include the number of members. Repeated addition will throw an ChatError. After joining chat thread, the multiple devices will receive the notification event. You can set ChatMultiDeviceEventHandler to listen on the event. The event callback function is ChatMultiDeviceEventHandler.onChatThreadEvent, where the first parameter is the event, and chat thread join event is ChatMultiDevicesEvent.CHAT_THREAD_JOIN.

Param chatThreadId Chat Thread ID.

Return The joined chat thread object;

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

~chinese 加入子区。

@note 子区所属群组的所有成员均可调用该方法。

加入成功后,多端多设备登录情况下,其他设备会收到 ChatMultiDeviceEventHandler.onChatThreadEvent,Event 的值为 ChatMultiDevicesEvent.CHAT_THREAD_JOIN

Param chatThreadId 子区 ID。

Return 若调用成功,返回子区详情 ChatThread,详情中不含成员数量;失败则抛出异常。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError。 ~end

Implementation

Future<ChatThread> joinChatThread({
  required String chatThreadId,
}) async {
  Map req = {
    "threadId": chatThreadId,
  };
  Map result = await _channel.invokeMethod(
    ChatMethodKeys.joinChatThread,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
    return ChatThread.fromJson(result[ChatMethodKeys.joinChatThread]);
  } on ChatError catch (e) {
    throw e;
  }
}