toggleSelection method

void toggleSelection(
  1. String id
)

Toggles the selection state of the item with the given id.

Implementation

void toggleSelection(String id) {
  if (value.contains(id)) {
    value.remove(id);
  } else {
    value.add(id);
  }
  notifyListeners();
}