addConnection method
Adds a connection between two ports.
Triggers the onConnectionCreated callback after successful addition.
Parameters:
connection: The connection to add
Example:
final connection = Connection(
id: 'conn1',
sourceNodeId: 'node1',
sourcePortId: 'out1',
targetNodeId: 'node2',
targetPortId: 'in1',
);
controller.addConnection(connection);
Implementation
void addConnection(Connection connection) {
runInAction(() {
_connections.add(connection);
});
// Fire callback after successful addition
callbacks.onConnectionCreated?.call(connection);
}