Connection<C> constructor

Connection<C>({
  1. required String id,
  2. required String sourceNodeId,
  3. required String sourcePortId,
  4. required String targetNodeId,
  5. required String targetPortId,
  6. bool animated = false,
  7. bool selected = false,
  8. C? data,
  9. ConnectionStyle? style,
  10. ConnectionLabel? startLabel,
  11. ConnectionLabel? label,
  12. ConnectionLabel? endLabel,
  13. ConnectionEndPoint? startPoint,
  14. ConnectionEndPoint? endPoint,
  15. double? startGap,
  16. double? endGap,
  17. ConnectionEffect? animationEffect,
  18. bool locked = false,
  19. Color? color,
  20. Color? selectedColor,
  21. double? strokeWidth,
  22. double? selectedStrokeWidth,
})

Creates a connection between two ports.

Parameters:

  • id: Unique identifier for this connection
  • sourceNodeId: ID of the node containing the source port
  • sourcePortId: ID of the source port on the source node
  • targetNodeId: ID of the node containing the target port
  • targetPortId: ID of the target port on the target node
  • animated: Whether to show flowing animation on the connection (default: false)
  • selected: Whether the connection is initially selected (default: false)
  • data: Optional arbitrary data to attach to the connection
  • style: Optional custom style override (defaults to theme style if null)
  • startLabel: Optional label at the start of the connection (anchor 0.0)
  • label: Optional label at the center of the connection (anchor 0.5)
  • endLabel: Optional label at the end of the connection (anchor 1.0)
  • startPoint: Optional custom start endpoint marker (defaults to theme if null)
  • endPoint: Optional custom end endpoint marker (defaults to theme if null)
  • startGap: Optional gap between source port and start endpoint (defaults to theme if null)
  • endGap: Optional gap between target port and end endpoint (defaults to theme if null)
  • animationEffect: Optional animation effect to apply (overrides animated flag)
  • locked: Whether this connection is locked from deletion (default: false)
  • color: Optional custom color for the connection line (overrides theme)
  • selectedColor: Optional custom color when the connection is selected (overrides theme)
  • strokeWidth: Optional custom stroke width for the connection line (overrides theme)
  • selectedStrokeWidth: Optional custom stroke width when selected (overrides theme)

Implementation

Connection({
  required this.id,
  required this.sourceNodeId,
  required this.sourcePortId,
  required this.targetNodeId,
  required this.targetPortId,
  bool animated = false,
  bool selected = false,
  this.data,
  this.style,
  ConnectionLabel? startLabel,
  ConnectionLabel? label,
  ConnectionLabel? endLabel,
  this.startPoint,
  this.endPoint,
  this.startGap,
  this.endGap,
  ConnectionEffect? animationEffect,
  this.locked = false,
  this.color,
  this.selectedColor,
  this.strokeWidth,
  this.selectedStrokeWidth,
}) : _animated = Observable(animated),
     _selected = Observable(selected),
     _startLabel = Observable(startLabel),
     _label = Observable(label),
     _endLabel = Observable(endLabel),
     _animationEffect = Observable(animationEffect);