toggle method

void toggle(
  1. int index,
  2. bool value
)

Toggles the selection state of a specific item.

This method is typically called when a user taps on an individual checkbox to select or deselect a single item.

Implementation

void toggle(int index, bool value) {
  if (index < 0 || index >= _selected.length) return;
  _selected[index] = value;
  notifyListeners();
}