joinChatThread method

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

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.

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