Sample application.
This commit is contained in:
50
lib/model/contactCreation.dart
Normal file
50
lib/model/contactCreation.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
class ContactCreation {
|
||||
final dynamic name;
|
||||
final dynamic email;
|
||||
final dynamic phone;
|
||||
final dynamic street;
|
||||
final dynamic street2;
|
||||
final dynamic city;
|
||||
final dynamic image1920;
|
||||
|
||||
ContactCreation({
|
||||
required this.name,
|
||||
required this.email,
|
||||
required this.phone,
|
||||
required this.street,
|
||||
required this.street2,
|
||||
required this.city,
|
||||
required this.image1920,
|
||||
});
|
||||
|
||||
factory ContactCreation.fromJson(Map<dynamic, dynamic> json) {
|
||||
getCountry(){
|
||||
if (json['country_id'] != null){
|
||||
return json['country_id']['name'];
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return ContactCreation(
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
phone: json['phone'],
|
||||
street: json['street'],
|
||||
street2: json['street2'],
|
||||
city: json['city'],
|
||||
image1920: json['image_1920'],
|
||||
);
|
||||
}
|
||||
Map<dynamic, dynamic> toJson() {
|
||||
return {
|
||||
'name': name,
|
||||
'email': email,
|
||||
'phone': phone,
|
||||
'street': street,
|
||||
'street2': street2,
|
||||
'city': city,
|
||||
'image_1920': image1920,
|
||||
};
|
||||
}
|
||||
}
|
||||
58
lib/model/contactDetail.dart
Normal file
58
lib/model/contactDetail.dart
Normal file
@@ -0,0 +1,58 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
27
lib/model/contactList.dart
Normal file
27
lib/model/contactList.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
class ContactList {
|
||||
final int id;
|
||||
final String name;
|
||||
final dynamic email;
|
||||
final dynamic image1920;
|
||||
|
||||
|
||||
ContactList({required this.id, required this.name, required this.email, required this.image1920});
|
||||
|
||||
factory ContactList.fromJson(Map<String, dynamic> json) {
|
||||
return ContactList(
|
||||
id: json['id'],
|
||||
name: json['name'],
|
||||
email: json['email'],
|
||||
image1920: json['image_1920'],
|
||||
);
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'email': email,
|
||||
'image1920': image1920,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user