deleteConversation static method

dynamic deleteConversation(
  1. String conversationWith,
  2. String conversationType, {
  3. required dynamic onSuccess(
    1. String message
    )?,
  4. required dynamic onError(
    1. 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 (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
}