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. bool visible = true,
  9. C? data,
  10. ConnectionStyle? style,
  11. ConnectionLabel? startLabel,
  12. ConnectionLabel? label,
  13. ConnectionLabel? endLabel,
  14. ConnectionEndPoint? startPoint,
  15. ConnectionEndPoint? endPoint,
  16. double? startGap,
  17. double? endGap,
  18. ConnectionEffect? animationEffect,
  19. bool locked = false,
  20. Color? color,
  21. Color? selectedColor,
  22. double? strokeWidth,
  23. 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)
  • visible: Whether this connection is visible (default: true)

Implementation

Connection({
  required this.id,
  required this.sourceNodeId,
  required this.sourcePortId,
  required this.targetNodeId,
  required this.targetPortId,
  bool animated = false,
  bool selected = false,
  bool visible = true,
  this.data,
  this.style,
  ConnectionLabel? startLabel,
  ConnectionLabel? label,
  ConnectionLabel? endLabel,
  ConnectionEndPoint? startPoint,
  ConnectionEndPoint? endPoint,
  this.startGap,
  this.endGap,
  ConnectionEffect? animationEffect,
  this.locked = false,
  Color? color,
  Color? selectedColor,
  double? strokeWidth,
  double? selectedStrokeWidth,
}) : _animated = Observable(animated),
     _selected = Observable(selected),
     _visible = Observable(visible),
     _startLabel = Observable(startLabel),
     _label = Observable(label),
     _endLabel = Observable(endLabel),
     _animationEffect = Observable(animationEffect),
     _startPoint = Observable(startPoint),
     _endPoint = Observable(endPoint),
     _color = Observable(color),
     _selectedColor = Observable(selectedColor),
     _strokeWidth = Observable(strokeWidth),
     _selectedStrokeWidth = Observable(selectedStrokeWidth);