getRouteWithAlternatives method
Future<List<PolylineResult> >
getRouteWithAlternatives({
- required PolylineRequest request,
- String? mapboxApiKey,
Get the list of coordinates between two geographical positions with alternative routes which can be used to draw polyline between this two positions
Implementation
Future<List<PolylineResult>> getRouteWithAlternatives(
{required PolylineRequest request, String? mapboxApiKey}) async {
assert(
(request.proxy == null &&
mapboxApiKey != null &&
mapboxApiKey.isNotEmpty) ||
(request.proxy != null && mapboxApiKey == null),
"Mapbox API Key cannot be empty if proxy isn't provided");
assert(request.arrivalTime == null || request.departureTime == null,
"You can only specify either arrival time or departure time");
try {
return await NetworkUtil().getRouteBetweenCoordinates(request: request, mapboxApiKey: mapboxApiKey);
} catch (e) {
rethrow;
}
}