You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.2 KiB
58 lines
1.2 KiB
4 months ago
|
class ContactDetail {
|
||
|
final int id;
|
||
|
final dynamic name;
|
||
|
final dynamic email;
|
||
|
final dynamic phone;
|
||
|
final dynamic image1920;
|
||
|
final dynamic street;
|
||
|
final dynamic street2;
|
||
|
final dynamic city;
|
||
|
final dynamic country;
|
||
|
|
||
|
ContactDetail({
|
||
|
required this.id,
|
||
|
required this.name,
|
||
|
required this.email,
|
||
|
required this.phone,
|
||
|
required this.image1920,
|
||
|
required this.street,
|
||
|
required this.street2,
|
||
|
required this.city,
|
||
|
required this.country,
|
||
|
});
|
||
|
|
||
|
factory ContactDetail.fromJson(Map<dynamic, dynamic> json) {
|
||
|
getCountry(){
|
||
|
if (json['country_id'] != null){
|
||
|
return json['country_id']['name'];
|
||
|
}
|
||
|
else{
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
return ContactDetail(
|
||
|
id: json['id'],
|
||
|
name: json['name'],
|
||
|
email: json['email'],
|
||
|
phone: json['phone'],
|
||
|
image1920: json['image_1920'],
|
||
|
street: json['street'],
|
||
|
street2: json['street2'],
|
||
|
city: json['city'],
|
||
|
country: getCountry(),
|
||
|
);
|
||
|
}
|
||
|
Map<dynamic, dynamic> toJson() {
|
||
|
return {
|
||
|
'id': id,
|
||
|
'name': name,
|
||
|
'email': email,
|
||
|
'phone': phone,
|
||
|
'image1920': image1920,
|
||
|
'street': street,
|
||
|
'street2': street2,
|
||
|
'city': city,
|
||
|
'country': country,
|
||
|
};
|
||
|
}
|
||
|
}
|