parseTrip function
parseTrip
this method used to parse json get from trip service,
the data
is ParserTripComputeArg
that contain information need it to be parsed to Road
such as json map and language that will be instruction
return Road
object that contain list of waypoint and other information
this road represent trip that will pass by all geopoint entered as args
and this road will not be the shortes route
Implementation
Future<OSRMRoad> parseTrip(ParserTripComputeArg data) async {
Map<String, dynamic> jsonResponse = data.json;
var road = const OSRMRoad.empty();
final List<Map<String, dynamic>> routes =
List.castFrom(jsonResponse["trips"]);
final route = routes.first;
road = OSRMRoad.fromOSRMJson(
route: route,
);
return road;
}