toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final map = <String, dynamic>{};
  map['id'] = id;
  map['user_id'] = userId;
  map['name'] = name;
  map['hide_location'] = hideLocation;
  map['address'] = address;
  map['city'] = city;
  map['state'] = state;
  map['country'] = country;
  map['latitude'] = latitude;
  map['longitude'] = longitude;
  map['postal_code'] = postalCode;
  map['description'] = description;
  map['business_image'] = businessImage;
  map['price_range'] = priceRange;
  map['features'] = features;

  if (businessType != null) {
    map['business_type'] = businessType?.map((v) => v.toJson()).toList();
  }
  map['is_favourite'] = isFavourite;
  if (featuresId != null) {
    map['features_id'] = featuresId?.map((v) => v.toJson()).toList();
  }
  map["features"] = features;
  map['contact_number'] = contactNumber;
  map['email'] = email;
  map['webpage_url'] = webpageUrl;
  if (socialMediaUrl != null) {
    map['social_media_url'] = socialMediaUrl?.toJson();
  }
  map['user_type'] = userType;
  map['tags'] = tags;
  map['status'] = status;
  map['is_open'] = isOpen;
  map['distance'] = distance;
  map['is_featured'] = isFeatured;
  map['best_offer'] = bestOffer;
  map['discount'] = discount;
  map['total_rating'] = totalRating;
  map['avg_rating'] = avgRating;
  if (rating != null) {
    map['rating'] = rating?.map((v) => v.toMap()).toList();
  }
  map['music_type_display'] = musicTypeDisplay;
  if (musicTypeList != null) {
    map['music_type_list'] = musicTypeList?.map((v) => v.toJson()).toList();
  }
  map['working_hour'] = workingHour?.toMap();
  if (galleryAttachmentList != null) {
    map['gallery_attachment_array'] = galleryAttachmentList?.map((v) => v.toJson()).toList();
  }
  map['total_likes'] = totalLikes;
  map['can_claimed'] = canClaimed;
  return map;
}