leaveChatThread method
~english Leave Chat Thread.
The operation is available to Chat Thread members. After leave 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 exit event is EMMultiDevicesEvent.CHAT_THREAD_LEAVE.
Param chatThreadId
Chat Thread ID.
Throws A description of the exception. See EMError. ~end
~chinese 退出子区。
@note 子区中的所有成员均可调用该方法。 多端多设备登录情况下,其他设备会收到 EMMultiDeviceEventHandler.onChatThreadEvent 回调,Event 的值为 EMMultiDevicesEvent.CHAT_THREAD_LEAVE。
Param chatThreadId
要退出的子区 ID。
Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end
Implementation
Future<void> leaveChatThread({
required String chatThreadId,
}) async {
Map req = {
"threadId": chatThreadId,
};
Map result = await _channel.invokeMethod(
ChatMethodKeys.leaveChatThread,
req,
);
try {
EMError.hasErrorFromResult(result);
} on EMError catch (e) {
throw e;
}
}