toggle method

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

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, bool enableHapticFeedback) {
  if (index < 0 || index >= _selected.length) return;
  _selected[index] = value;
  if (enableHapticFeedback) {
    HapticFeedback.lightImpact();
  }
  notifyListeners();
}