EasyRoute.fromJson constructor

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

Implementation

factory EasyRoute.fromJson(Map<String, dynamic> json) {
  List<Leg> legs =
      (json['legs'] as List).map((legJson) => Leg.fromJson(legJson)).toList();

  return EasyRoute(
    geometry: json['geometry'],
    legs: legs,
    weightName: json['weight_name'],
    weight: json['weight'].toDouble(),
    duration: json['duration'].toDouble(),
    distance: json['distance'].toDouble(),
  );
}