deleteConversation method Null safety
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 {@link EMError}.
Implementation
Future<bool> deleteConversation(
String conversationId, {
bool deleteMessages = true,
}) async {
Map req = {"con_id": conversationId, "deleteMessages": deleteMessages};
Map result = await EMMethodChannel.ChatManager.invokeMethod(
ChatMethodKeys.deleteConversation, req);
try {
EMError.hasErrorFromResult(result);
return result.boolValue(ChatMethodKeys.deleteConversation);
} on EMError catch (e) {
throw e;
}
}