diff --git a/lib/models/suggestion_response.dart b/lib/models/suggestion_response.dart index 1c03b96..2e54f3f 100644 --- a/lib/models/suggestion_response.dart +++ b/lib/models/suggestion_response.dart @@ -63,6 +63,7 @@ class Suggestion { Map toJson() => _$SuggestionToJson(this); } +@JsonSerializable() class ExternalIds { ExternalIds({ this.foursquare, @@ -72,13 +73,8 @@ class ExternalIds { final String? foursquare; final String? safegraph; - factory ExternalIds.fromJson(Map json) => ExternalIds( - foursquare: json["foursquare"], - safegraph: json["safegraph"], - ); + factory ExternalIds.fromJson(Map json) => + _$ExternalIdsFromJson(json); - Map toJson() => { - "foursquare": foursquare, - "safegraph": safegraph, - }; + Map toJson() => _$ExternalIdsToJson(this); } diff --git a/lib/models/suggestion_response.g.dart b/lib/models/suggestion_response.g.dart index c8374b0..fd4f985 100644 --- a/lib/models/suggestion_response.g.dart +++ b/lib/models/suggestion_response.g.dart @@ -68,3 +68,14 @@ Map _$SuggestionToJson(Suggestion instance) => 'brand': instance.brand, 'brand_id': instance.brandId, }; + +ExternalIds _$ExternalIdsFromJson(Map json) => ExternalIds( + foursquare: json['foursquare'] as String?, + safegraph: json['safegraph'] as String?, + ); + +Map _$ExternalIdsToJson(ExternalIds instance) => + { + 'foursquare': instance.foursquare, + 'safegraph': instance.safegraph, + };