Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
3.2 kB
1
Indexable
Never
class PriceInfoModel {
  bool result;
  String message;
  TripInfo tripInfo;
  int payMethod;

  PriceInfoModel({this.result, this.message, this.tripInfo, this.payMethod});

  PriceInfoModel.fromJson(Map<String, dynamic> json) {
    result = json['Result'];
    message = json['Message'];
    tripInfo =
        json['TripInfo'] != null ? TripInfo.fromJson(json['TripInfo']) : null;
    payMethod = json['PayMethod'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['Result'] = result;
    data['Message'] = message;
    if (tripInfo != null) {
      data['TripInfo'] = tripInfo.toJson();
    }
    data['PayMethod'] = payMethod;
    return data;
  }
}

class TripInfo {
  String sId;
  bool isUserExist;
  String username;
  String deviceID;
  int saveTime;
  String tripID;
  int rentedTripFare;
  int rentedTripDistance;
  int rentedTripTariff;
  int rentedTripExtras;
  int startOfRentedTrip;
  int endOfRentedTrip;
  double startLocationLatitude;
  double startLocationLongitude;
  double endLocationLatitude;
  double endLocationLongitude;

  TripInfo(
      {this.sId,
      this.isUserExist,
      this.username,
      this.deviceID,
      this.saveTime,
      this.tripID,
      this.rentedTripFare,
      this.rentedTripDistance,
      this.rentedTripTariff,
      this.rentedTripExtras,
      this.startOfRentedTrip,
      this.endOfRentedTrip,
      this.startLocationLatitude,
      this.startLocationLongitude,
      this.endLocationLatitude,
      this.endLocationLongitude});

  TripInfo.fromJson(Map<String, dynamic> json) {
    sId = json['_id'];
    isUserExist = json['IsUserExist'];
    username = json['Username'];
    deviceID = json['DeviceID'];
    saveTime = json['SaveTime'];
    tripID = json['TripID'];
    rentedTripFare = json['RentedTripFare'];
    rentedTripDistance = json['RentedTripDistance'];
    rentedTripTariff = json['RentedTripTariff'];
    rentedTripExtras = json['RentedTripExtras'];
    startOfRentedTrip = json['StartOfRentedTrip'];
    endOfRentedTrip = json['EndOfRentedTrip'];
    startLocationLatitude = json['StartLocationLatitude'];
    startLocationLongitude = json['StartLocationLongitude'];
    endLocationLatitude = json['EndLocationLatitude'];
    endLocationLongitude = json['EndLocationLongitude'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['_id'] = sId;
    data['IsUserExist'] = isUserExist;
    data['Username'] = username;
    data['DeviceID'] = deviceID;
    data['SaveTime'] = saveTime;
    data['TripID'] = tripID;
    data['RentedTripFare'] = rentedTripFare;
    data['RentedTripDistance'] = rentedTripDistance;
    data['RentedTripTariff'] = rentedTripTariff;
    data['RentedTripExtras'] = rentedTripExtras;
    data['StartOfRentedTrip'] = startOfRentedTrip;
    data['EndOfRentedTrip'] = endOfRentedTrip;
    data['StartLocationLatitude'] = startLocationLatitude;
    data['StartLocationLongitude'] = startLocationLongitude;
    data['EndLocationLatitude'] = endLocationLatitude;
    data['EndLocationLongitude'] = endLocationLongitude;
    return data;
  }
}