Leg.fromJson constructor

Leg.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Leg.fromJson(Map<String, dynamic> json) {
  return Leg(
    distanceMeters: json["distanceMeters"],
    duration: json["duration"],
    staticDuration: json["staticDuration"],
    polyline: json["polyline"] == null
        ? null
        : Polyline.fromJson(json["polyline"]),
    startLocation: json["startLocation"] == null
        ? null
        : Location.fromJson(json["startLocation"]),
    endLocation: json["endLocation"] == null
        ? null
        : Location.fromJson(json["endLocation"]),
    steps: json["steps"] == null
        ? []
        : List<Step>.from(json["steps"]!.map((x) => Step.fromJson(x))),
    localizedValues: json["localizedValues"] == null
        ? null
        : LegLocalizedValues.fromJson(json["localizedValues"]),
  );
}