toJson method

Map<String, dynamic> toJson()

Converts the Prediction instance to JSON format.

Used for serialization when sending data to APIs or storing locally.

Implementation

Map<String, dynamic> toJson() => {
      "description": description,
      "id": id,
      "matched_substrings":
          List<dynamic>.from(matchedSubstrings!.map((x) => x.toJson())),
      "place_id": placeId,
      "reference": reference,
      "structured_formatting": structuredFormatting!.toJson(),
      "terms": List<dynamic>.from(terms!.map((x) => x.toJson())),
      "types": List<dynamic>.from(types!.map((x) => x)),
    };