select method
- RxChatContact? contact,
- RxUser? user,
- RxChat? chat,
- RxUser? recent,
Selects or unselects the specified contact
, user
, chat
or recent
.
Implementation
void select({
RxChatContact? contact,
RxUser? user,
RxChat? chat,
RxUser? recent,
}) {
if (contact != null) {
if (selectedContacts.contains(contact)) {
selectedContacts.remove(contact);
} else {
selectedContacts.add(contact);
}
}
if (user != null) {
if (selectedUsers.contains(user)) {
selectedUsers.remove(user);
} else {
selectedUsers.add(user);
}
}
if (chat != null) {
if (selectedChats.contains(chat)) {
selectedChats.remove(chat);
} else {
selectedChats.add(chat);
}
}
if (recent != null) {
if (selectedRecent.contains(recent)) {
selectedRecent.remove(recent);
} else {
selectedRecent.add(recent);
}
}
if (contact != null || user != null || chat != null || recent != null) {
onSelected?.call(
SearchViewResults(
selectedChats,
selectedUsers,
selectedContacts,
selectedRecent,
),
);
}
}