deleteConversation method
~english Deletes a conversation and its related messages from the local database.
If you set deleteMessages
to true
, the local historical messages are deleted when the conversation is deleted.
Param conversationId
The conversation ID.
Param deleteMessages
Whether to delete the historical messages when deleting the conversation.
true
: (default) Yes.false
: No.
Return Whether the conversation is successfully deleted.
true
: Yes;false
: No.
Throws A description of the exception. See ChatError. ~end
~chinese 删除本地会话。
Param deleteMessages
删除会话时是否同时删除本地的聊天记录。
- true
表示删除;
- false
表示不删除。
Return 删除会话结果。
- true
代表删除成功;
- false
代表删除失败。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError。 ~end
Implementation
Future<bool> deleteConversation(
String conversationId, {
bool deleteMessages = true,
}) async {
Map req = {"convId": conversationId, "deleteMessages": deleteMessages};
Map result =
await ChatChannel.invokeMethod(ChatMethodKeys.deleteConversation, req);
try {
ChatError.hasErrorFromResult(result);
return result.boolValue(ChatMethodKeys.deleteConversation);
} on ChatError catch (e) {
throw e;
}
}