57 lines
1.5 KiB
Dart
57 lines
1.5 KiB
Dart
|
|
class UserShippingAddress {
|
|
final String id;
|
|
final String name;
|
|
final String phoneNumber;
|
|
final String street;
|
|
final String district;
|
|
final String city;
|
|
final String state;
|
|
final String postalCode;
|
|
final String country;
|
|
final String tradeName;
|
|
final bool isDefault;
|
|
final String user;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
|
|
UserShippingAddress({
|
|
required this.id,
|
|
required this.name,
|
|
required this.phoneNumber,
|
|
required this.street,
|
|
required this.district,
|
|
required this.city,
|
|
required this.state,
|
|
required this.postalCode,
|
|
required this.country,
|
|
required this.tradeName,
|
|
required this.isDefault,
|
|
required this.user,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
});
|
|
|
|
factory UserShippingAddress.fromJson(Map<String, dynamic> json) {
|
|
return UserShippingAddress(
|
|
id: json['_id'] ?? '',
|
|
name: json['Name'] ?? '',
|
|
phoneNumber: json['phoneNumber'] ?? '',
|
|
street: json['street'] ?? '',
|
|
district: json['district'] ?? '',
|
|
city: json['city'] ?? '',
|
|
state: json['state'] ?? '',
|
|
postalCode: json['postalCode'] ?? '',
|
|
country: json['country'] ?? '',
|
|
tradeName: json['tradeName'] ?? '',
|
|
isDefault: json['isDefault'] ?? false,
|
|
user: json['user'] ?? '',
|
|
createdAt: DateTime.parse(json['createdAt']),
|
|
updatedAt: DateTime.parse(json['updatedAt']),
|
|
);
|
|
}
|
|
String toStringFullAddress() {
|
|
return "$street, $city, $state, $postalCode, $country";
|
|
}
|
|
}
|