RouteLeg.fromJson constructor
RouteLeg.fromJson(
- Map<String, dynamic> json
)
Implementation
RouteLeg.fromJson(Map<String, dynamic> json) {
profileIdentifier = json["profileIdentifier"];
name = json["name"];
distance = isNullOrZero(json["distance"]) ? 0.0 : json["distance"] + .0;
expectedTravelTime = isNullOrZero(json["expectedTravelTime"])
? 0.0
: json["expectedTravelTime"] + .0;
source = json['source'] == null
? null
: WayPoint.fromJson(json['source'] as Map<String, dynamic>);
destination = json['destination'] == null
? null
: WayPoint.fromJson(json['destination'] as Map<String, dynamic>);
steps = (json['steps'] as List?)
?.map((e) =>
e == null ? null : RouteStep.fromJson(e as Map<String, dynamic>))
.cast<RouteStep>()
.toList();
}