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<Road> parseTrip(ParserTripComputeArg data) async {
Map<String, dynamic> jsonResponse = data.jsonRoad;
var road = Road.empty();
final List<Map<String, dynamic>> routes =
List.castFrom(jsonResponse["trips"]);
final route = routes.first;
road = Road.fromOSRMJson(
route: route,
);
return road;
}