onWidgetClassRemoved method
Update the graph when a widget class is removed.
Implementation
void onWidgetClassRemoved(String widgetClassKey) {
final nodeId = NodeIds.widgetClass(widgetClassKey);
final node = graph.getNode(nodeId);
if (node == null) return;
// Track app state var nodes that might become orphans
final appStateVarImports =
node.imports.where(NodeIds.isAppStateVarNodeId).toList();
// Remove the node (this also removes all edges)
graph.removeNode(nodeId);
// Clean up orphan app state variable nodes
for (final varNodeId in appStateVarImports) {
graph.removeIfOrphan(varNodeId);
}
}