deleteConversation static method
dynamic
deleteConversation(
- String conversationWith,
- String conversationType, {
- required dynamic onSuccess(
- String message
- required dynamic onError(
- CometChatException excep
Method deletes the conversation only for the logged-in user.
conversationWith
The ID of the message above which all messages for a particular conversation are to be marked as read.
conversationType
The type of conversation you want to delete . It can be either user or group
method could throw PlatformException with error codes specifying the cause
Implementation
static deleteConversation(String conversationWith, String conversationType, {required Function(String message)? onSuccess, required Function(CometChatException excep)? onError}) async {
try {
final result = await channel.invokeMethod('deleteConversation', {
'conversationWith': conversationWith,
'conversationType': conversationType
});
if(onSuccess != null) onSuccess(result);
} on PlatformException catch (platformException) {
if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
} catch (e) {
debugPrint("Error: $e");
if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
}
}