elektronika/lib/app/data/models/address.dart

47 lines
1.1 KiB
Dart

import 'state.dart';
class AddressModel {
late int id;
String? firstName;
String? lastName;
late List<String> address1;
String? country;
String? countryName;
late String stateCode;
String? city;
String? postcode;
String? phone;
late bool isDefault;
late List<StateTranslations> stateTranslations;
AddressModel({
required this.id,
this.firstName,
this.lastName,
required this.address1,
this.country,
this.countryName,
required this.stateCode,
this.city,
this.postcode,
this.phone,
required this.isDefault,
required this.stateTranslations,
});
AddressModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
firstName = json['first_name'];
lastName = json['last_name'];
address1 = json['address1'].cast<String>();
country = json['country'];
countryName = json['country_name'];
stateCode = json['state'];
city = json['city'];
postcode = json['postcode'];
phone = json['phone'];
isDefault = json['is_default'] ?? false;
stateTranslations = [];
}
}