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) {
if (!context.state.edit.isEditing) {
return null;
}
final cellId = context.state.edit.editingCellId!;
final parts = cellId.split('_');
final rowId = double.parse(parts[0]);
final columnId = int.parse(parts[1]);
final newValue = context.state.edit.editingValue;
context.dispatchEvent(
UpdateCellEvent(rowId: rowId, columnId: columnId, value: newValue),
);
return context.state.copyWith(edit: EditState.initial());
}