notifyDocumentChanged method

void notifyDocumentChanged({
  1. Set<String>? affectedIds,
})

Notifies document listeners that the content changed. Use this after undo/redo where updateContent must NOT be called (it would create a new undo record).

If affectedIds is provided, only widgets for those node IDs will rebuild. If null, all widgets rebuild (backward-compatible).

Implementation

void notifyDocumentChanged({Set<String>? affectedIds}) {
  _dirtyNodeIds = affectedIds ?? {};
  notifyListeners();
  WidgetsBinding.instance.addPostFrameCallback((_) {
    _dirtyNodeIds.clear();
  });
}