SearchResult.fromJson constructor Null safety

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

Implementation

factory SearchResult.fromJson(Map<String, dynamic> json) {
  return SearchResult(
    geometry:
        json['geometry'] != null ? Geometry.fromJson(json['geometry']) : null,
    businessStatus: json['business_status'],
    openingHours: json['opening_hours'] != null
        ? OpeningHours.fromJson(json['opening_hours'])
        : null,
    photos: json['photos'] != null
        ? json['photos'].map<Photo>((json) => Photo.fromJson(json)).toList()
        : null,
    plusCode: json['plus_code'] != null
        ? PlusCode.fromJson(json['plus_code'])
        : null,
    formattedAddress: json['formatted_address'],
    name: json['name'],
    rating: json['rating'] != null ? json['rating'].toDouble() : null,
    icon: json['icon'],
    id: json['id'],
    placeId: json['place_id'],
    priceLevel: json['price_level'],
    reference: json['reference'],
    scope: json['scope'],
    types: json['types'] != null
        ? (json['types'] as List<dynamic>).cast<String>()
        : null,
    userRatingsTotal: json['user_ratings_total'],
    vicinity: json['vicinity'],
    permanentlyClosed: json['permanently_closed'],
  );
}