apply<T extends DataGridRow> method
Apply this event's transformation to the state. Returns the new state, or null if no state change should occur. Can return a Future for async operations.
Implementation
@override
DataGridState<T>? apply<T extends DataGridRow>(EventContext<T> context) {
final cellId = '${rowId}_$columnId';
final current = List<String>.from(context.state.selection.focusedCells);
if (current.contains(cellId)) {
current.remove(cellId);
} else {
current.add(cellId);
}
return context.state.copyWith(
selection: context.state.selection.copyWith(focusedCells: current),
);
}