truckRouteSearch static method

Future<void> truckRouteSearch({
  1. required List<LatLng> wayPoints,
  2. int? drivingMode,
  3. TruckInfo? truckInfo,
  4. int? showFields = ShowFields.POLINE + ShowFields.COST,
  5. bool onlyOne = true,
  6. bool simplify = true,
  7. RouteResultBack? back,
})

线路规划 truck 默认返回线路+费用(过路费+时间+距离..)

Implementation

static Future<void> truckRouteSearch({
  required List<LatLng> wayPoints,
  int? drivingMode,
  TruckInfo? truckInfo,
  int? showFields = ShowFields.POLINE + ShowFields.COST,//ShowFields.
  bool onlyOne = true,//只返回第一条线路
  bool simplify = true,//简化数据
  RouteResultBack? back,
}) async {
  final String? jsonStr = await _channel.invokeMethod('truckRouteSearch', {
    "wayPointsJson": json.encode(wayPoints),
    "drivingMode": drivingMode,
    "truckInfoJson": json.encode(truckInfo),
    "showFields": showFields,
    "onlyOne": onlyOne,
    "simplify":simplify,
  });
  if (jsonStr != null) {
    if(jsonStr.endsWith("FORCED_END")) return;
    Map? map = json.decode(jsonStr);
    if (map != null && back != null) {
      back(map['code'] as int, RouteResult.fromJson(map["data"]));
    }
  }
}