joinChatThread method Null safety

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

Join Chat Thread.

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

Param chatThreadId Chat Thread ID.

Return The joined chat thread object;

Throws A description of the exception. See {@link EMError}.

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