Untitled
unknown
dart
3 years ago
3.4 kB
2
Indexable
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'] == null ? null : double.parse(json['StartLocationLatitude'].toString()); startLocationLongitude = json['StartLocationLongitude'] == null ? null : double.parse(json['StartLocationLongitude'].toString()); endLocationLatitude = json['EndLocationLatitude'] == null ? null : double.parse(json['EndLocationLatitude'].toString()); endLocationLongitude = json['EndLocationLongitude'] == null ? null : double.parse(json['EndLocationLongitude'].toString()); } 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; } }
Editor is loading...