dismiss method

void dismiss(
  1. RxChatContact contact
)

Dismisses the contact, adding it to the dismissed.

Implementation

void dismiss(RxChatContact contact) {
  for (var e in List<DismissedContact>.from(dismissed, growable: false)) {
    e._done(true);
  }
  dismissed.clear();

  DismissedContact? entry;

  entry = DismissedContact(
    contact,
    onDone: (d) {
      if (d) {
        deleteFromContacts(contact.contact.value);
      } else {
        for (var e in contacts) {
          if (e.id == contact.id) {
            e.hidden.value = false;
          }
        }
      }

      dismissed.remove(entry!);
    },
  );

  dismissed.add(entry);

  for (var e in contacts) {
    if (e.id == contact.id) {
      e.hidden.value = true;
    }
  }
}