Bookings.fromJson constructor

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

Implementation

factory Bookings.fromJson(Map<String, dynamic> json) {
  print(json['agent']);
  return Bookings(
    id: json['id'],
    subscriberId: json['subscriberId'],
    status: json['status'],
    paymentHash: json['paymentHash'],
    tripType: json['tripType'],
    paymentMethod: json['paymentMethod'],
    paymentReference: json['paymentReference'],
    departureDate: json['departureDate'] != null
        ? DateTime.parse(json['departureDate'])
        : null,
    departureTime: json['departureTime'],
    returnDate: json['returnDate'] != null
        ? DateTime.parse(json['returnDate'])
        : null,
    returnTime: json['returnTime'],
    passengerCount: json['passengerCount'],
    flixableDate: json['flixableDate'],
    milesEarned: json['milesEarned'],
    flightClass: json['flightClass'],
    ticketDownloadURL: json['ticketDownloadURL'],
    originalCost: json['originalCost'],
    discountedCost: json['discountedCost'],
    currency: json['currency'],
    bookingURL: json['bookingURL'],
    // agentId: json['agentId'],
    confirmedOptionId: json['confirmedOptionId'],
    fromAirport: json['fromAirport'] != null
        ? Airport.fromJson(json['fromAirport'])
        : null,
    toAirport: json['toAirport'] != null
        ? Airport.fromJson(json['toAirport'])
        : null,
    subscriber: json['Subscriber'] != null
        ? Subscriber.fromJson(json['Subscriber'])
        : null,
    createdAt: json['createdAt'] != null
        ? DateTime.parse(json['createdAt'])
        : null,
    updatedAt: json['updatedAt'] != null
        ? DateTime.parse(json['updatedAt'])
        : null,
    duePaymentDetails: json['duePaymentDetails'],
    onlinePrice: json['OnlinePrice'],
    agent: json['agent'],
  );
}