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 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 toJson() { return { 'name': name, 'email': email, 'phone': phone, 'street': street, 'street2': street2, 'city': city, 'image_1920': image1920, }; } }