ConnectionStartContext<T> class
Context provided when starting a connection from a port.
This context is passed to validation callbacks when a user begins dragging a connection from a port. It provides information about the source node, port, and existing connections to help determine if the drag operation should be allowed.
Usage Example
ConnectionValidationResult validateStart<T>(
ConnectionStartContext<T> context,
) {
// Don't allow starting from a port that already has max connections
if (!context.sourcePort.allowMultiple &&
context.existingConnections.isNotEmpty) {
return ConnectionValidationResult.deny(
reason: 'Port already has a connection',
showMessage: true,
);
}
return ConnectionValidationResult.allow();
}
Constructors
-
ConnectionStartContext({required Node<
T> sourceNode, required Port sourcePort, required List<String> existingConnections}) -
Creates a connection start context.
const
Properties
-
existingConnections
→ List<
String> -
Existing connection IDs from this port.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInputPort → bool
-
Whether this is an input port.
no setter
- isOutputPort → bool
-
Whether this is an output port.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sourceNode
→ Node<
T> -
The node where the connection is starting.
final
- sourcePort → Port
-
The port where the connection is starting.
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