getRoute method
this method make http call to get road from specific server this method return Road that contain road information like distance and duration and instruction or return Road with empty values.
return Road object that contain information of road that will help to draw road in the map or show important information to the user you should take a specific case when road object will contain empty values like 0.0 or empty string in case of any problem
if request
is not a instance of OSRMRequest and OSRMRequest.profile is trip
then this method used to get route from trip service api
used if you have more that 10 waypoint to generate route will more accurate
than getRoute.
Please note that if one sets roundTrip
to false, then
source
and destination
must be provided.
Implementation
Future<Route> getRoute({
required BaseRequest request,
}) =>
switch (request) {
OSRMRequest _ => _osrmService.getOSRMRoad(request),
ValhallaRequest _ => _valhallaRoutingService.getValhallaRoad(request),
_ => Future.value(const Route.empty()),
};