ConnectionCompleteContext<T> class

Context provided when attempting to complete a connection.

This context is passed to validation callbacks when a user attempts to complete a connection by dropping on a target port. It provides complete information about both the source and target to enable comprehensive validation logic.

Usage Example

ConnectionValidationResult validateComplete<T>(
  ConnectionCompleteContext<T> context,
) {
  // Prevent self-connections
  if (context.isSelfConnection) {
    return ConnectionValidationResult.deny(
      reason: 'Cannot connect node to itself',
      showMessage: true,
    );
  }

  // Only allow output-to-input connections
  if (!context.isOutputToInput) {
    return ConnectionValidationResult.deny(
      reason: 'Must connect output to input',
      showMessage: true,
    );
  }

  return ConnectionValidationResult.allow();
}

Constructors

ConnectionCompleteContext({required Node<T> sourceNode, required Port sourcePort, required Node<T> targetNode, required Port targetPort, required List<String> existingSourceConnections, required List<String> existingTargetConnections})
Creates a connection complete context.
const

Properties

existingSourceConnections List<String>
Existing connection IDs from the source port.
final
existingTargetConnections List<String>
Existing connection IDs to the target port.
final
hashCode int
The hash code for this object.
no setterinherited
isInputToOutput bool
Whether this connection goes from an input port to an output port.
no setter
isOutputToInput bool
Whether this connection goes from an output port to an input port.
no setter
isSamePort bool
Whether this is connecting a port to itself.
no setter
isSelfConnection bool
Whether this is a self-connection (connecting a node to itself).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceNode Node<T>
The source node of the connection.
final
sourcePort Port
The source port of the connection.
final
targetNode Node<T>
The target node of the connection.
final
targetPort Port
The target port of the connection.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited