getConnection method

Connection<C>? 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<C>? getConnection(String connectionId) {
  return _connections
      .where((c) => c.id == connectionId)
      .firstOrNull;
}