Data.fromJson constructor

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

Implementation

Data.fromJson(Map<String, dynamic> json) {
  parameters = json['parameters'] != null
      ? Parameters.fromJson(json['parameters'])
      : null;
  sId = json['_id'];
  if (json['results'] != null) {
    results = <TripModel>[];
    json['results'].forEach((v) {
      results!.add(TripModel.fromJson(v));
    });
  }
  searchCredit = json['searchCredit'];
  discounted = json['discounted'];
  average = json['average'];
  count = json['count'];
  highestDicountPercentage = json['highestDicountPercentage'];
  highestDiscountedPrice = double.tryParse(json['highestDiscountedPrice']?.toString() ?? '0')?.roundToDouble();
  highestOnlinePrice = double.tryParse(json['highestOnlinePrice']?.toString() ?? '0')?.roundToDouble();
  highestOnlinePriceProviderCode = json['highestOnlinePriceProviderCode'];
  highestOnlinePriceProviderLogoUrl = json['highestOnlinePriceProviderLogoUrl'];
  highestOnlinePriceProviderName = json['highestOnlinePriceProviderName'];
  searchCreditUsed = json['searchCreditUsed'];
  userId = json['userId'];
  createdAt = json['createdAt'];
  updatedAt = json['updatedAt'];
  iV = json['__v'];
}