deleteContact method

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

~english 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. ~end

~chinese 删除联系人及其相关的会话。

Param userId 要删除的联系人用户 ID。

Param keepConversation 是否保留要删除的联系人的会话。

  • true:是;
  • (默认)false:否。

Throws 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 ChatError。 ~end

Implementation

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