TripModel.fromJson constructor

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

Implementation

TripModel.fromJson(Map<String, dynamic> json) {
  if (json['flights'] != null) {
    flights = <FlightModel>[];
    json['flights'].forEach((v) {
      flights!.add(FlightModel.fromJson(v));
    });
  }
  id = json['tripID'];
  totalDuration = json['totalDuration'];
  stops = json['stops'];
  mileageCost = json['mileageCost'];
  totalTaxes = json['totalTaxes'];
  currency = json['currency'];
  onlinePrice = json['onlinePrice'];
  discountedPrice = json['discountedPrice'];
  discountedPercentage = json['discountedPercentage'];
}