TreeUtilities class
Pure utility functions for tree operations NO Flutter dependencies - can be tested independently
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
countNodes(
ElectricalNode? root) → int - Count total nodes in tree
-
extractCableInfo(
ElectricalNode node) → CableInfo - Extract cable info safely from any node type
-
extractPanelNames(
ElectricalNode? root) → Map< String, String> - Extract panel names from tree
-
extractProperties(
ElectricalNode node) → Map< String, dynamic> - Extract ALL properties from ElectricalNode for presentation layer display Transforms domain data -> presentation data (clean architecture)
-
findNodeById(
ElectricalNode? root, String id) → ElectricalNode? - Find a node by ID in the tree
-
findParentNode(
ElectricalNode? root, String childId) → ElectricalNode? - Find parent of a node
-
flattenElectricalNodes(
ElectricalNode? root) → List< ElectricalNode> - Flatten tree to list of nodes (depth-first)
-
getChildren(
ElectricalNode node) → List< ElectricalNode> - Get immediate children of a node
-
getLeafNodes(
ElectricalNode? root) → List< ElectricalNode> - Get all leaf nodes (loads without children)
-
getNodeDepth(
ElectricalNode? root, String nodeId) → int - Get depth of a node in tree (root = 0)
-
removeNodeFromTree(
ElectricalNode root, String nodeIdToRemove) → ElectricalNode? - Remove a node from tree and return new tree root Returns null if root itself is removed