SeachPlaceResultDetailModel.fromJson constructor

SeachPlaceResultDetailModel.fromJson(
  1. Map<String, dynamic> json
)

Implementation

SeachPlaceResultDetailModel.fromJson(Map<String, dynamic> json) {
  if (json["address_components"] is List) {
    addressComponents = json["address_components"] == null
        ? null
        : (json["address_components"] as List)
            .map((e) => AddressComponents.fromJson(e))
            .toList();
  }
  if (json["adr_address"] is String) adrAddress = json["adr_address"];
  if (json["business_status"] is String) {
    businessStatus = json["business_status"];
  }
  if (json["formatted_address"] is String) {
    formattedAddress = json["formatted_address"];
  }
  if (json["formatted_phone_number"] is String) {
    formattedPhoneNumber = json["formatted_phone_number"];
  }
  if (json["geometry"] is Map) {
    geometry = json["geometry"] == null
        ? null
        : DetailGeometry.fromJson(json["geometry"]);
  }
  if (json["icon"] is String) icon = json["icon"];
  if (json["icon_background_color"] is String) {
    iconBackgroundColor = json["icon_background_color"];
  }
  if (json["icon_mask_base_uri"] is String) {
    iconMaskBaseUri = json["icon_mask_base_uri"];
  }
  if (json["international_phone_number"] is String) {
    internationalPhoneNumber = json["international_phone_number"];
  }
  if (json["name"] is String) name = json["name"];
  if (json["opening_hours"] is Map) {
    openingHours = json["opening_hours"] == null
        ? null
        : DetailOpeningHours.fromJson(json["opening_hours"]);
  }
  if (json["photos"] is List) {
    photos = json["photos"] == null
        ? null
        : (json["photos"] as List)
            .map((e) => DetailPhotos.fromJson(e))
            .toList();
  }
  if (json["place_id"] is String) placeId = json["place_id"];
  if (json["plus_code"] is Map) {
    plusCode = json["plus_code"] == null
        ? null
        : PlusCodeModel.fromJson(json["plus_code"]);
  }
  if (json["price_level"] is int) priceLevel = json["price_level"];
  if (json["rating"] is double) rating = json["rating"];
  if (json["reference"] is String) reference = json["reference"];
  if (json["reviews"] is List) {
    reviews = json["reviews"] == null
        ? null
        : (json["reviews"] as List).map((e) => Reviews.fromJson(e)).toList();
  }
  if (json["types"] is List) {
    types = json["types"] == null ? null : List<String>.from(json["types"]);
  }
  if (json["url"] is String) url = json["url"];
  if (json["user_ratings_total"] is int) {
    userRatingsTotal = json["user_ratings_total"];
  }
  if (json["utc_offset"] is int) utcOffset = json["utc_offset"];
  if (json["vicinity"] is String) vicinity = json["vicinity"];
  if (json["website"] is String) website = json["website"];
}