deleteContact method

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

Deletes a contact and all the related conversations.

Param userId 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 userId, {
  bool keepConversation = false,
}) async {
  try {
    Map req = {'userId': userId, 'keepConversation': keepConversation};
    Map result = await platform_interface.Client.instance.contactManager
        .callNativeMethod(ChatMethodKeys.deleteContact, req);
    ChatError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}