planning static method

void planning({
  1. required List<LatLng> wayPoints,
  2. int? strategy,
  3. PlanningCallBack? planningBack,
})

Implementation

static void planning({required List<LatLng> wayPoints, int? strategy, PlanningCallBack? planningBack}) {
  if (wayPoints.length < 2) return;
  routeSearchPage(
    wayPoints: wayPoints,
    strategy: strategy ?? DrivingStrategy.DEFAULT,
    showFields: ShowFields.POLINE,
    back: (code, data) {
      if (code != 1000) {
        ToLatLng southwest, northeast;
        if (wayPoints[0].latitude < wayPoints[0].latitude) {
          southwest = ToLatLng.from(wayPoints[0]);
          northeast = ToLatLng.from(wayPoints[1]);
        } else {
          southwest = ToLatLng.from(wayPoints[1]);
          northeast = ToLatLng.from(wayPoints[0]);
        }
        if (planningBack != null) planningBack((code), [], LatLngBounds(southwest: southwest, northeast: northeast));
        return;
      }
      if(data.paths==null|| data.paths!.isEmpty) return;
      if (planningBack != null) {
        List<LatLng> points = PointUtil.listCover(data.paths![0].polyline);
        planningBack(1000, points, PointUtil.lineBounds(points));
      }
    },
  );
}