getRouteBetweenCoordinates method
Future<PolylineResult>
getRouteBetweenCoordinates({
- required PolylineRequest request,
- String? mapboxApiKey,
Get the list of coordinates between two geographical positions which can be used to draw polyline between this two positions
Implementation
Future<PolylineResult> getRouteBetweenCoordinates(
{required PolylineRequest request, String? mapboxApiKey}) async {
assert(
(request.proxy == null &&
mapboxApiKey != null &&
mapboxApiKey.isNotEmpty) ||
(request.proxy != null && mapboxApiKey == null),
"Google API Key cannot be empty if proxy isn't provided");
try {
var result = await NetworkUtil().getRouteBetweenCoordinates(
request: request, mapboxApiKey: mapboxApiKey);
return result.isNotEmpty
? result[0]
: PolylineResult(errorMessage: "No result found");
} catch (e) {
rethrow;
}
}