selectRow method

void selectRow(
  1. int index, {
  2. required bool isSelected,
})

Implementation

void selectRow(int index, {required bool isSelected}) {
  if (index < 0 || index > data.length) {
    throw Exception('Index out of bounds');
  }
  if (data[index].selected != isSelected) {
    _selectedCount += isSelected ? 1 : -1;
    assert(_selectedCount >= 0, 'Selected count cannot be less than 0');
    data[index].selected = isSelected;
    notifyListeners();
  }
}