getPort method

Port? getPort(
  1. String nodeId,
  2. String portId
)

Gets a specific port from a node.

Searches both input and output ports. Returns null if the node or port doesn't exist.

Example:

final port = controller.getPort('node1', 'output1');
if (port != null) {
  print('Port type: ${port.type}');
}

Implementation

Port? getPort(String nodeId, String portId) {
  final node = _nodes[nodeId];
  if (node == null) return null;

  // Search input ports
  for (final port in node.inputPorts) {
    if (port.id == portId) return port;
  }

  // Search output ports
  for (final port in node.outputPorts) {
    if (port.id == portId) return port;
  }

  return null;
}