createPath method

  1. @override
Path createPath(
  1. ConnectionPathParameters params
)
override

Creates a path for this connection, using control points if available.

This method is the main entry point called by the rendering system. It delegates to either:

Implementation

@override
Path createPath(ConnectionPathParameters params) {
  if (params.controlPoints.isNotEmpty) {
    // Manual mode: use control points as waypoints
    // IMPORTANT: Include start and end points in the waypoints list
    final waypoints = createWaypointsWithEnds(params.controlPoints, params);
    return createPathThroughWaypoints(waypoints, params);
  } else if (!requiresControlPoints) {
    // Algorithmic mode: use default path creation
    return createDefaultPath(params);
  } else {
    // Style requires control points but none provided
    // Fall back to simple straight line
    final path = Path();
    path.moveTo(params.start.dx, params.start.dy);
    path.lineTo(params.end.dx, params.end.dy);
    return path;
  }
}