apply<T extends DataGridRow> method

  1. @override
DataGridState<T>? apply<T extends DataGridRow>(
  1. EventContext<T> context
)
override

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 cancelledCellId = context.state.edit.editingCellId;
  return context.state.copyWith(
    edit: EditState.initial(),
    selection: cancelledCellId != null
        ? context.state.selection.copyWith(focusedCells: [cancelledCellId])
        : context.state.selection,
  );
}