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