Itinerary.fromMap constructor

Itinerary.fromMap(
  1. dynamic itineraryMap
)

Implementation

factory Itinerary.fromMap(dynamic itineraryMap) {
  var list = itineraryMap['legs'] as List<dynamic>;
  var legsList = list.map((e) => Leg.fromMap(e)).toList();
  return Itinerary(
    from: Coordinate.fromMap(itineraryMap["from"]),
    to: Coordinate.fromMap(itineraryMap["to"]),
    duration: itineraryMap["duration"] as double,
    distance: itineraryMap["distance"] as double,
    legs: legsList,
  );
}