ListingData.fromJson constructor
ListingData.fromJson(- dynamic json
)
Implementation
ListingData.fromJson(dynamic json) {
id = json['id'];
businessChatId = json["business_chat_id"];
userId = json['user_id'];
name = json['name'];
hideLocation = json['hide_location'];
address = json['address'];
city = json['city'];
state = json['state'];
country = json['country'];
latitude = json['latitude'];
longitude = json['longitude'];
postalCode = json['postal_code'];
description = json['description'];
businessImage = json['business_image'];
priceRange = json['price_range'];
if (json['business_type'] != null) {
businessType = [];
json['business_type'].forEach((v) {
businessType?.add(BusinessType.fromJson(v));
});
}
isFavourite = json['is_favourite'];
if (json['features_id'] != null) {
featuresId = [];
json['features_id'].forEach((v) {
featuresId?.add(FeaturesId.fromJson(v));
});
}
features = List<Features>.from(
(json["features"] ?? []).map(
(x) => Features.fromJson(x),
),
);
contactNumber = json['contact_number'];
email = json['email'];
webpageUrl = json['webpage_url'];
socialMediaUrl = json['social_media_url'] != null ? SocialMediaUrl.fromJson(json['social_media_url']) : null;
userType = json['user_type'];
tags = json['tags'] != null ? json['tags'].cast<String>() : [];
status = json['status'];
isOpen = json['is_open'];
distance = json['distance'];
isFeatured = json['is_featured'];
bestOffer = json['best_offer'];
discount = json['discount'];
totalRating = json['total_rating'];
avgRating = json['avg_rating'];
if (json['rating'] != null) {
rating = [];
json['rating'].forEach((v) {
rating?.add(ReviewData.fromMap(v));
});
}
musicTypeDisplay = json['music_type_display'];
if (json['music_type_list'] != null) {
musicTypeList = [];
json['music_type_list'].forEach((v) {
musicTypeList?.add(MusicTypeList.fromJson(v));
});
}
if (json["working_hour"] != null) {
workingHour = WorkingHourModel.fromMap(json['working_hour']);
}
if (json['gallery_attachment_array'] != null) {
galleryAttachmentList = [];
json['gallery_attachment_array'].forEach((v) {
galleryAttachmentList?.add(GalleryAttachmentList.fromJson(v));
});
}
totalLikes = json['total_likes'];
canClaimed = json['can_claimed'];
}