fetchRouteETA method

Future<List<MFRouteETAResult>> fetchRouteETA(
  1. List<MFLocationComponent> origins,
  2. MFLocationComponent destination, {
  3. MFTravelMode mode = MFTravelMode.car,
  4. MFRouteWeighting weighting = MFRouteWeighting.fastest,
  5. MFLanguageResult language = MFLanguageResult.vi,
  6. MFRouteRestriction? restriction,
})

Estimated time of arrival.

Implementation

Future<List<MFRouteETAResult>> fetchRouteETA(
  List<MFLocationComponent> origins,
  MFLocationComponent destination, {
  MFTravelMode mode = MFTravelMode.car,
  MFRouteWeighting weighting = MFRouteWeighting.fastest,
  MFLanguageResult language = MFLanguageResult.vi,
  MFRouteRestriction? restriction,
}) async {
  final Map<String, Object> data = <String, Object>{
    'origins': locationsToJson(origins),
    'destination': destination.toJson(),
    'mode': mode.index,
    'weighting': weighting.index,
    'language': language.index,
  };

  if (restriction != null) {
    data['restriction'] = restriction.toJson();
  }

  final response = await _ServicesChannel.invokeService('route#eta', data);
  validateResponse(response);

  return toListRouteETA(response!['result']);
}