Files
uWine.Portal/lib/entities/address.dart
T
2025-07-18 22:24:01 +02:00

59 lines
1.5 KiB
Dart

class Address {
final int id;
final String country;
final String postalCode;
final String county;
final String province;
final String city;
final String street;
final String houseNumber;
final double latitude;
final double longitude;
final bool active;
Address({
required this.id,
required this.country,
required this.postalCode,
required this.county,
required this.province,
required this.city,
required this.street,
required this.houseNumber,
required this.latitude,
required this.longitude,
required this.active,
});
Map<String, dynamic> toJson() {
return {
'id': id,
'country': country,
'postalCode': postalCode,
'county': county,
'province': province,
'city': city,
'street': street,
'houseNumber': houseNumber,
'latitude': latitude,
'longitude': longitude,
'active': active,
};
}
factory Address.fromJson(Map<String, dynamic> json) {
return Address(
id: json['id'] as int,
country: json['country'] as String,
postalCode: json['postalCode'] as String,
county: json['county'] as String,
province: json['province'] as String,
city: json['city'] as String,
street: json['street'] as String,
houseNumber: json['houseNumber'] as String,
latitude: (json['latitude'] as num).toDouble(),
longitude: (json['longitude'] as num).toDouble(),
active: json['active'] as bool,
);
}
}