parseRoad function Null safety

Future<Road> parseRoad(
  1. ParserRoadComputeArg data

parseRoad this method used to parse json get it from route service to Road object we use this method in another thread like compute the data is ParserRoadComputeArg that will to be parsed to Road fix parsing problem #1 return Road object that contain list of waypoint and distance and duration of the road


Future<Road> parseRoad(ParserRoadComputeArg data) async {
  Map<String, dynamic> jsonResponse = data.jsonRoad;
  String languageCode = data.langCode;
  bool alternative = data.alternative;
  var road = Road.empty();
  final List<Map<String, dynamic>> routes =

  final route = routes.first;
  road = Road.fromOSRMJson(route, languageCode);

  if (routes.length > 1 && alternative) {
    for (var route in routes) {
      final alternative = Road.fromOSRMJson(route, languageCode);

  return road;