distanceWithLocation method

Future<DistanceResponse> distanceWithLocation(
  1. List<Location> origin,
  2. List<Location> destination, {
  3. TravelMode? travelMode,
  4. String? languageCode,
  5. bool alternative = false,
  6. String? region,
  7. @Deprecated("[avoid] is deprecated, use [avoids] instead.") RouteType? avoid,
  8. List<RouteType> avoids = const <RouteType>[],
  9. Unit? unit,
  10. Object? arrivalTime,
  11. Object? departureTime,
  12. List<TransitMode> transitMode = const [],
  13. TrafficModel? trafficModel,
  14. TransitRoutingPreferences? transitRoutingPreference,
})

Implementation

Future<DistanceResponse> distanceWithLocation(
  List<Location> origin,
  List<Location> destination, {
  TravelMode? travelMode,
  String? languageCode,
  bool alternative = false,
  String? region,
  @Deprecated("[avoid] is deprecated, use [avoids] instead.")
      RouteType? avoid,
  List<RouteType> avoids = const <RouteType>[],
  Unit? unit,
  Object? /*DateTime|num*/ arrivalTime,
  Object? /*DateTime|num|String('now')*/ departureTime,
  List<TransitMode> transitMode = const [],
  TrafficModel? trafficModel,
  TransitRoutingPreferences? transitRoutingPreference,
}) {
  if (avoid != null) {
    avoids = [
      ...avoids,
      avoid,
    ];
  }

  return _distance(
    origin,
    destination,
    travelMode: travelMode,
    languageCode: languageCode,
    alternative: alternative,
    region: region,
    avoids: avoids,
    unit: unit,
    arrivalTime: arrivalTime,
    departureTime: departureTime,
    transitMode: transitMode,
    trafficModel: trafficModel,
    transitRoutingPreference: transitRoutingPreference,
  );
}