getConnection method

Connection? getConnection(
  1. String connectionId
)

Gets a connection by its ID.

Returns null if the connection doesn't exist.

Example:

final connection = controller.getConnection('conn1');
if (connection != null) {
  print('Source: ${connection.sourceNodeId}');
}

Implementation

Connection? getConnection(String connectionId) {
  try {
    return _connections.firstWhere((c) => c.id == connectionId);
  } catch (_) {
    return null;
  }
}