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'];
  offerId = json['offerId'];
  totalDuration = json['totalDuration'];
  stops = json['stops'];
  totalTaxes = json['tripTaxUsd'];
  currency = json['currency'];
  onlinePrice = json['onlinePrice'];
  discountedPrice = json['discountedPrice'];
  totalOnlinePrice = json['totalOnlinePrice'];
  totalDiscountedPrice = json['totalDiscountedPrice'];
  discountedPercentage = json['discountedPercentage'];
  totalDiscountedPriceBTC = json['totalDiscountedPriceBTC'];
  isDiscounted = json['isDiscounted'] ?? false;
  totalMilesEarned = json['milesToGain'];
  program = json['program'];
  tripType = json['tripType'];
  flightClass = json['flightClass'];
  flightSubClass = json['flightSubClass'];
  if (json['pricingOptions'] != null) {
    pricingOptions = <PricingOption>[];
    json['pricingOptions'].forEach((v) {
      pricingOptions!.add(PricingOption.fromJson(v));
    });
  }
}