createWaypointsWithEnds method
Helper method to create waypoints including start and end points.
This ensures the waypoints list always starts at params.start and
ends at params.end, with control points in between.
Implementation
List<Offset> createWaypointsWithEnds(
List<Offset> controlPoints,
ConnectionPathParameters params,
) {
if (controlPoints.isEmpty) {
return [params.start, params.end];
}
// Ensure start and end are included
final waypoints = <Offset>[params.start];
waypoints.addAll(controlPoints);
waypoints.add(params.end);
return waypoints;
}