findNodeById static method
- ElectricalNode? root,
- String id
Find a node by ID in the tree
Implementation
static ElectricalNode? findNodeById(ElectricalNode? root, String id) {
if (root == null) return null;
if (root.id == id) return root;
return root.map(
source: (node) => _findInChildren(node.children, id),
protection: (node) => _findInChildren(node.children, id),
panel: (node) => _findInChildren(node.children, id),
load: (_) => null,
);
}