RouteLeg.fromJson constructor
RouteLeg.fromJson(
- Map<String, dynamic> json
)
Implementation
RouteLeg.fromJson(Map<String, dynamic> json) {
var sourceJson = {};
var destinationJson = {};
if (json['source'] != null) {
sourceJson = json['source'];
}
if (json['destination'] != null) {
destinationJson = json['destination'];
}
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
: LatLng(sourceJson['latitude'], sourceJson['longitude']);
destination = json['destination'] == null
? null
: LatLng(destinationJson['latitude'], destinationJson['longitude']);
steps = (json['steps'] as List?)
?.map((e) =>
e == null ? null : RouteStep.fromJson(e as Map<String, dynamic>))
.cast<RouteStep>()
.toList();
}