data property

C? data
final

Optional typed data to attach to the connection.

This can be used to store custom metadata, validation state, or any other application-specific information about the connection. The type C allows for strongly-typed access to connection data.

Example

class EdgeMetadata {
  final String label;
  final double weight;
  EdgeMetadata({required this.label, required this.weight});
}

final connection = Connection<EdgeMetadata>(
  id: 'conn-1',
  // ... other params
  data: EdgeMetadata(label: 'data-flow', weight: 1.5),
);

// Access typed data
print(connection.data?.weight); // 1.5

Implementation

final C? data;