removeIfOrphan method

void removeIfOrphan(
  1. String nodeId
)

Remove a node if it has no dependents (nothing imports it).

Useful for cleaning up orphan app state variable nodes.

Implementation

void removeIfOrphan(String nodeId) {
  final node = _nodes[nodeId];
  if (node != null && node.importedBy.isEmpty) {
    _nodes.remove(nodeId);
  }
}