removePort method
Removes a port from a node and all connections involving that port.
This method will:
- Remove all connections where this port is the source or target
- Remove the port from the node
Does nothing if the node with nodeId doesn't exist.
Parameters:
nodeId: The ID of the node containing the portportId: The ID of the port to remove
Implementation
void removePort(String nodeId, String portId) {
final node = _nodes[nodeId];
if (node == null) return;
runInAction(() {
// Remove any connections involving this port
_connections.removeWhere(
(c) =>
(c.sourceNodeId == nodeId && c.sourcePortId == portId) ||
(c.targetNodeId == nodeId && c.targetPortId == portId),
);
// Remove the port using the node's dynamic method
node.removePort(portId);
});
}