updateContent method

void updateContent({
  1. Set<String>? affectedIds,
  2. String? targetNodeId,
})

Implementation

void updateContent({Set<String>? affectedIds, String? targetNodeId}) {
  _contentVersion++;
  invalidateNodeIndex();
  final saveResult = _undoRedoManager.commitSaveState(this);
  registry.dispatchCommitSaveState(this, result: saveResult);

  if (affectedIds != null) {
    _dirtyNodeIds = affectedIds;
  } else if (targetNodeId != null) {
    _dirtyNodeIds = {targetNodeId};
  } else {
    final focusId = cursor.focusId;
    if (focusId.isNotEmpty) {
      final cid = cachedCursorContainerId;
      if (cid != null) {
        _dirtyNodeIds = {cid};
      }
    }
  }
  notifyListeners();
  if (_dirtyNodeIds.isNotEmpty) {
    try {
      WidgetsBinding.instance.addPostFrameCallback((_) {
        _dirtyNodeIds.clear();
      });
    } catch (_) {
      _dirtyNodeIds.clear();
    }
  }
}