deleteRemoteConversation method

Future<void> deleteRemoteConversation(
  1. String conversationId,
  2. {ChatConversationType conversationType = ChatConversationType.Chat,
  3. bool isDeleteMessage = true}
)

Deletes the specified conversation and the related historical messages from the server.

Param conversationId The conversation ID.

Param conversationType The conversation type. See ChatConversationType.

Param isDeleteMessage Whether to delete the chat history when deleting the conversation.

  • true: (default) Yes.
  • false: No.

Throws A description of the exception. See ChatError.

Implementation

Future<void> deleteRemoteConversation(
  String conversationId, {
  ChatConversationType conversationType = ChatConversationType.Chat,
  bool isDeleteMessage = true,
}) async {
  Map req = {};
  req["conversationId"] = conversationId;
  if (conversationType == ChatConversationType.Chat) {
    req["conversationType"] = 0;
  } else if (conversationType == ChatConversationType.GroupChat) {
    req["conversationType"] = 1;
  } else {
    req["conversationType"] = 2;
  }
  req["isDeleteRemoteMessage"] = isDeleteMessage;

  Map data = await ChatChannel.invokeMethod(
      ChatMethodKeys.deleteRemoteConversation, req);
  try {
    ChatError.hasErrorFromResult(data);
  } on ChatError catch (e) {
    throw e;
  }
}