joinChatThread method Null safety

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

Join Chat Thread.

Group members have permission. Join successfully, return the Chat Thread details {@link 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 {@link ChatMultiDeviceListener} to listen on the event. The event callback function is {@link ChatMultiDeviceListener#onChatThreadEvent(int, String, List), where the first parameter is the event, and chat thread join event is {@ChatMultiDeviceListener#ChatMultiDevicesEvent.CHAT_THREAD_JOIN}.

Param chatThreadId Chat Thread ID.

Return The joined chat thread object;

Throws A description of the exception. See {@link 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;
  }
}