deleteRemoteConversation method
- String conversationId, {
- ChatConversationType conversationType = ChatConversationType.Chat,
- bool isDeleteMessage = true,
~english Deletes the specified conversation and the related historical messages from the server.
Param conversationId
The conversation ID.
Param conversationType
The conversation type. See ChatConversationType.
Param isDeleteMessage
Whether to delete the chat history when deleting the conversation.
true
: (default) Yes.false
: No.
Throws A description of the exception. See ChatError. ~end
~chinese 删除服务端的指定 ID 的会话和聊天记录。
Param conversationId
会话 ID。
Param conversationType
会话类型,详见 ChatConversationType。
Param isDeleteMessage
删除会话时是否同时删除历史消息记录。
- (默认)
true
:是; false
:否。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
Future<void> deleteRemoteConversation(
String conversationId, {
ChatConversationType conversationType = ChatConversationType.Chat,
bool isDeleteMessage = true,
}) async {
Map req = {};
req["conversationId"] = conversationId;
if (conversationType == ChatConversationType.Chat) {
req["conversationType"] = 0;
} else if (conversationType == ChatConversationType.GroupChat) {
req["conversationType"] = 1;
} else {
req["conversationType"] = 2;
}
req["isDeleteRemoteMessage"] = isDeleteMessage;
Map data = await ChatChannel.invokeMethod(
ChatMethodKeys.deleteRemoteConversation, req);
try {
ChatError.hasErrorFromResult(data);
} on ChatError catch (e) {
throw e;
}
}