commitEdit method

void commitEdit({
  1. String? valueOverride,
  2. int moveDr = 0,
  3. int moveDc = 0,
  4. bool grow = false,
})

Commit the draft (or valueOverride) to the active cell and optionally move the cursor. One undoable step.

Implementation

void commitEdit({String? valueOverride, int moveDr = 0, int moveDc = 0, bool grow = false}) {
  final col = columns[_sel.col];
  final raw = valueOverride ?? _draft;
  if (!col.isReadOnly) {
    final v = col.normalize?.call(raw) ?? raw;
    final next = List<T>.from(_rows);
    next[_sel.row] = col.setValue!(next[_sel.row], v);
    _apply(next);
  }
  _editing = false;
  if (moveDr != 0 || moveDc != 0) {
    moveSelection(moveDr, moveDc, grow: grow);
  } else {
    notifyListeners();
  }
}