toggleCheckbox method

void toggleCheckbox(
  1. int r,
  2. int c
)

Toggle a checkbox cell (boolean column) at (r, c). One undoable step.

Implementation

void toggleCheckbox(int r, int c) {
  final col = columns[c];
  if (col.type != EditableColumnType.checkbox || col.setValue == null) return;
  final cur = truthy(col.value(_rows[r]));
  final next = List<T>.from(_rows);
  next[r] = col.setValue!(next[r], cur ? '0' : '1');
  _sel = CellRef(r, c);
  _apply(next);
}