commitEdit method

void commitEdit(
  1. TreeNodeId id,
  2. String label
)

Commit an inline rename. Empty / unchanged labels just close the editor.

Implementation

void commitEdit(TreeNodeId id, String label) {
  final trimmed = label.trim();
  final current = node(id);
  _editing = null;
  if (current == null || trimmed.isEmpty || trimmed == current.label) {
    notifyListeners();
    return;
  }
  _apply(TreeOps.mapNode<T>(_roots, id, (n) => n.copyWith(label: trimmed)));
}