Prediction.fromJson constructor

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

Implementation

factory Prediction.fromJson(Map<String, dynamic> json) {
  return Prediction(
    description: json["description"],
    matchedSubstrings: json["matched_substrings"] == null
        ? []
        : List<MatchedSubstring>.from(
            json["matched_substrings"]!.map(
              (x) => MatchedSubstring.fromJson(x),
            ),
          ),
    placeId: json["place_id"],
    reference: json["reference"],
    structuredFormatting: json["structured_formatting"] == null
        ? null
        : StructuredFormatting.fromJson(json["structured_formatting"]),
    terms: json["terms"] == null
        ? []
        : List<Term>.from(json["terms"]!.map((x) => Term.fromJson(x))),
    types: json["types"] == null
        ? []
        : List<String>.from(json["types"]!.map((x) => x)),
  );
}