deleteContact method

Future<void> deleteContact(
  1. String username,
  2. {bool keepConversation = false}
)

Deletes a contact and all the related conversations.

Param username The contact to be deleted.

Param keepConversation Whether to retain conversations of the deleted contact.

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

Throws A description of the exception. See ChatError.

Implementation

Future<void> deleteContact(
  String username, {
  bool keepConversation = false,
}) async {
  Map req = {'username': username, 'keepConversation': keepConversation};
  Map result = await _channel.invokeMethod(ChatMethodKeys.deleteContact, req);
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}