57 lines
1.4 KiB
Dart
57 lines
1.4 KiB
Dart
import '../api/types.dart';
|
|
|
|
class DeliveryAddress implements Serializable {
|
|
final int id;
|
|
final String? line1;
|
|
final String? line2;
|
|
final String? postalCode;
|
|
final String? city;
|
|
final String? subdivision;
|
|
final String? countryCode;
|
|
final double? latitude;
|
|
final double? longitude;
|
|
final String? formattedAddress;
|
|
|
|
const DeliveryAddress({
|
|
required this.id,
|
|
this.line1,
|
|
this.line2,
|
|
this.postalCode,
|
|
this.city,
|
|
this.subdivision,
|
|
this.countryCode,
|
|
this.latitude,
|
|
this.longitude,
|
|
this.formattedAddress,
|
|
});
|
|
|
|
factory DeliveryAddress.fromJson(Map<String, dynamic> json) {
|
|
return DeliveryAddress(
|
|
id: json['id'] as int,
|
|
line1: json['line1'] as String?,
|
|
line2: json['line2'] as String?,
|
|
postalCode: json['postalCode'] as String?,
|
|
city: json['city'] as String?,
|
|
subdivision: json['subdivision'] as String?,
|
|
countryCode: json['countryCode'] as String?,
|
|
latitude: json['latitude'] as double?,
|
|
longitude: json['longitude'] as double?,
|
|
formattedAddress: json['formattedAddress'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Object?> toJson() => {
|
|
'id': id,
|
|
'line1': line1,
|
|
'line2': line2,
|
|
'postalCode': postalCode,
|
|
'city': city,
|
|
'subdivision': subdivision,
|
|
'countryCode': countryCode,
|
|
'latitude': latitude,
|
|
'longitude': longitude,
|
|
'formattedAddress': formattedAddress,
|
|
};
|
|
}
|