Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
3.0 kB
1
Indexable
Never
class DeliveryDriver {
  String? id,
      fullName,
      nationalID,
      dateBirth,
      emailAddress,
      nationalExpireDate,
      phoneNumber,
      manufacturingYear,
      vehiclePlateNumber,
      neighborhood;
  int? carType, carModel, carClass, district, city, status, reviews, gender;
  List<String>? docsLinks;
  bool? isAvailable;
  String? activeTrip;
  double? balance, rate;
  DateTime? date;

  DeliveryDriver({
    this.id,
    this.fullName,
    this.nationalID,
    this.dateBirth,
    this.emailAddress,
    this.nationalExpireDate,
    this.phoneNumber,
    this.carType,
    this.carModel,
    this.carClass,
    this.manufacturingYear,
    this.vehiclePlateNumber,
    this.district,
    this.city,
    this.neighborhood,
    this.status,
    this.docsLinks,
    this.date,
    this.isAvailable,
    this.activeTrip,
    this.balance,
    this.rate,
    this.reviews,
    this.gender,
  });

  DeliveryDriver.fromMap(Map<String, dynamic> map) {
    id = map['id'];
    fullName = map['fullName'];
    nationalID = map['nationalID'];
    dateBirth = map['dateBirth'];
    emailAddress = map['emailAddress'];
    nationalExpireDate = map['nationalExpireDate'];
    phoneNumber = map['phoneNumber'];
    carType = map['carType'];
    carModel = map['carModel'];
    carClass = map['carClass'];
    manufacturingYear = map['manufacturingYear'];
    vehiclePlateNumber = map['vehiclePlateNumber'];
    district = map['district'];
    city = map['city'];
    neighborhood = map['neighborhood'];
    status = map['status'];
    activeTrip = map['activeTrip'];
    docsLinks = map['docsLinks'].cast<String>();
    ;
    isAvailable = map['isAvailable'];
    balance = map['balance'];
    rate = map['rate'] == null ? null : map['rate'].toDouble();
    reviews = map['reviews'];
    gender = map['gender'];
    date = map['date'].toString().contains(':')
        ? map['date']
        : map['date'].toDate();
  }

  Map<String, dynamic> toMap() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['fullName'] = this.fullName;
    data['nationalID'] = this.nationalID;
    data['dateBirth'] = this.dateBirth;
    data['emailAddress'] = this.emailAddress;
    data['nationalExpireDate'] = this.nationalExpireDate;
    data['phoneNumber'] = this.phoneNumber;
    data['carType'] = this.carType;
    data['carModel'] = this.carModel;
    data['carClass'] = this.carClass;
    data['manufacturingYear'] = this.manufacturingYear;
    data['vehiclePlateNumber'] = this.vehiclePlateNumber;
    data['district'] = this.district;
    data['city'] = this.city;
    data['neighborhood'] = this.neighborhood;
    data['status'] = this.status;
    data['activeTrip'] = this.activeTrip;
    data['isAvailable'] = this.isAvailable;
    data['docsLinks'] = this.docsLinks;
    data['date'] = this.date;
    data['balance'] = this.balance;
    data['rate'] = this.rate;
    data['reviews'] = this.reviews;
    data['gender'] = this.gender;
    return data;
  }
}