setNodePorts method

void setNodePorts(
  1. String nodeId,
  2. List<Port> ports
)

Sets the ports of a node.

This replaces all existing ports with the provided list. Each port's Port.type determines its behavior (input/output/both).

Example:

controller.setNodePorts('node1', [
  Port(id: 'in1', name: 'Input', type: PortType.input),
  Port(id: 'out1', name: 'Output', type: PortType.output),
]);

Implementation

void setNodePorts(String nodeId, List<Port> ports) {
  final node = _nodes[nodeId];
  if (node == null) return;

  runInAction(() {
    node.ports.clear();
    node.ports.addAll(ports);
  });
}