toogleSelectionFor method

bool toogleSelectionFor(
  1. DocumentReference<Object?> ref
)

Implementation

bool toogleSelectionFor(DocumentReference ref) {
  if (!_selectionIsActive) {
    _selectionIsActive = true;
    selectedRefs.clear();
  }
  if (selectedRefs.any((x) => x.id == ref.id)) {
    selectedRefs.removeWhere((x) => x.id == ref.id);
    notifyListeners();
    return false;
  } else {
    selectedRefs.add(ref);
    notifyListeners();
    return true;
  }
}