joinChatThread method

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

~english Join Chat Thread.

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

Param chatThreadId Chat Thread ID.

Return The joined chat thread object;

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

~chinese 加入子区。

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

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

Param chatThreadId 子区 ID。

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

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

Implementation

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