Test case
1 generated file · +121 −0test/inputs/json/misc/00c36.json
Adartdefault / TopLevel.dart+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<dynamic> topLevelFromJson(String str) => List<dynamic>.from(json.decode(str).map((x) => x)); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<dynamic> data) => json.encode(List<dynamic>.from(data.map((x) => x))); | |
| 10 | + | |
| 11 | +class TopLevelElement { | |
| 12 | + final Country country; | |
| 13 | + final String date; | |
| 14 | + final String decimal; | |
| 15 | + final Country indicator; | |
| 16 | + final String value; | |
| 17 | + | |
| 18 | + TopLevelElement({ | |
| 19 | + required this.country, | |
| 20 | + required this.date, | |
| 21 | + required this.decimal, | |
| 22 | + required this.indicator, | |
| 23 | + required this.value, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevelElement.fromJson(Map<String, dynamic> json) => TopLevelElement( | |
| 27 | + country: Country.fromJson(json["country"]), | |
| 28 | + date: json["date"], | |
| 29 | + decimal: json["decimal"], | |
| 30 | + indicator: Country.fromJson(json["indicator"]), | |
| 31 | + value: json["value"], | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "country": country.toJson(), | |
| 36 | + "date": date, | |
| 37 | + "decimal": decimal, | |
| 38 | + "indicator": indicator.toJson(), | |
| 39 | + "value": value, | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class Country { | |
| 44 | + final Id id; | |
| 45 | + final Value value; | |
| 46 | + | |
| 47 | + Country({ | |
| 48 | + required this.id, | |
| 49 | + required this.value, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory Country.fromJson(Map<String, dynamic> json) => Country( | |
| 53 | + id: idValues.map[json["id"]]!, | |
| 54 | + value: valueValues.map[json["value"]]!, | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + "id": idValues.reverse[id], | |
| 59 | + "value": valueValues.reverse[value], | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +enum Id { | |
| 64 | + US, | |
| 65 | + NY_GDP_MKTP_CD | |
| 66 | +} | |
| 67 | + | |
| 68 | +final idValues = EnumValues({ | |
| 69 | + "US": Id.US, | |
| 70 | + "NY.GDP.MKTP.CD": Id.NY_GDP_MKTP_CD | |
| 71 | +}); | |
| 72 | + | |
| 73 | +enum Value { | |
| 74 | + UNITED_STATES, | |
| 75 | + GDP_CURRENT_US | |
| 76 | +} | |
| 77 | + | |
| 78 | +final valueValues = EnumValues({ | |
| 79 | + "United States": Value.UNITED_STATES, | |
| 80 | + "GDP (current US\u0024)": Value.GDP_CURRENT_US | |
| 81 | +}); | |
| 82 | + | |
| 83 | +class PurpleTopLevel { | |
| 84 | + final int page; | |
| 85 | + final int pages; | |
| 86 | + final String perPage; | |
| 87 | + final int total; | |
| 88 | + | |
| 89 | + PurpleTopLevel({ | |
| 90 | + required this.page, | |
| 91 | + required this.pages, | |
| 92 | + required this.perPage, | |
| 93 | + required this.total, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory PurpleTopLevel.fromJson(Map<String, dynamic> json) => PurpleTopLevel( | |
| 97 | + page: json["page"], | |
| 98 | + pages: json["pages"], | |
| 99 | + perPage: json["per_page"], | |
| 100 | + total: json["total"], | |
| 101 | + ); | |
| 102 | + | |
| 103 | + Map<String, dynamic> toJson() => { | |
| 104 | + "page": page, | |
| 105 | + "pages": pages, | |
| 106 | + "per_page": perPage, | |
| 107 | + "total": total, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class EnumValues<T> { | |
| 112 | + Map<String, T> map; | |
| 113 | + late Map<T, String> reverseMap; | |
| 114 | + | |
| 115 | + EnumValues(this.map); | |
| 116 | + | |
| 117 | + Map<T, String> get reverse { | |
| 118 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 119 | + return reverseMap; | |
| 120 | + } | |
| 121 | +} |
Test case
1 generated file · +301 −0test/inputs/json/misc/00ec5.json
Adartdefault / TopLevel.dart+301 −0
| @@ -0,0 +1,301 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String basePath; | |
| 13 | + final Definitions definitions; | |
| 14 | + final String host; | |
| 15 | + final Info info; | |
| 16 | + final Paths paths; | |
| 17 | + final List<String> produces; | |
| 18 | + final List<String> schemes; | |
| 19 | + final String swagger; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.basePath, | |
| 23 | + required this.definitions, | |
| 24 | + required this.host, | |
| 25 | + required this.info, | |
| 26 | + required this.paths, | |
| 27 | + required this.produces, | |
| 28 | + required this.schemes, | |
| 29 | + required this.swagger, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + basePath: json["basePath"], | |
| 34 | + definitions: Definitions.fromJson(json["definitions"]), | |
| 35 | + host: json["host"], | |
| 36 | + info: Info.fromJson(json["info"]), | |
| 37 | + paths: Paths.fromJson(json["paths"]), | |
| 38 | + produces: List<String>.from(json["produces"].map((x) => x)), | |
| 39 | + schemes: List<String>.from(json["schemes"].map((x) => x)), | |
| 40 | + swagger: json["swagger"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "basePath": basePath, | |
| 45 | + "definitions": definitions.toJson(), | |
| 46 | + "host": host, | |
| 47 | + "info": info.toJson(), | |
| 48 | + "paths": paths.toJson(), | |
| 49 | + "produces": List<dynamic>.from(produces.map((x) => x)), | |
| 50 | + "schemes": List<dynamic>.from(schemes.map((x) => x)), | |
| 51 | + "swagger": swagger, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Definitions { | |
| 56 | + final Provider provider; | |
| 57 | + | |
| 58 | + Definitions({ | |
| 59 | + required this.provider, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Definitions.fromJson(Map<String, dynamic> json) => Definitions( | |
| 63 | + provider: Provider.fromJson(json["Provider"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "Provider": provider.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Provider { | |
| 72 | + final Map<String, Property> properties; | |
| 73 | + | |
| 74 | + Provider({ | |
| 75 | + required this.properties, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Provider.fromJson(Map<String, dynamic> json) => Provider( | |
| 79 | + properties: Map.from(json["properties"]).map((k, v) => MapEntry<String, Property>(k, Property.fromJson(v))), | |
| 80 | + ); | |
| 81 | + | |
| 82 | + Map<String, dynamic> toJson() => { | |
| 83 | + "properties": Map.from(properties).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class Property { | |
| 88 | + final String description; | |
| 89 | + final Type type; | |
| 90 | + | |
| 91 | + Property({ | |
| 92 | + required this.description, | |
| 93 | + required this.type, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory Property.fromJson(Map<String, dynamic> json) => Property( | |
| 97 | + description: json["description"], | |
| 98 | + type: typeValues.map[json["type"]]!, | |
| 99 | + ); | |
| 100 | + | |
| 101 | + Map<String, dynamic> toJson() => { | |
| 102 | + "description": description, | |
| 103 | + "type": typeValues.reverse[type], | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +enum Type { | |
| 108 | + STRING | |
| 109 | +} | |
| 110 | + | |
| 111 | +final typeValues = EnumValues({ | |
| 112 | + "string": Type.STRING | |
| 113 | +}); | |
| 114 | + | |
| 115 | +class Info { | |
| 116 | + final String description; | |
| 117 | + final String title; | |
| 118 | + final String version; | |
| 119 | + | |
| 120 | + Info({ | |
| 121 | + required this.description, | |
| 122 | + required this.title, | |
| 123 | + required this.version, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory Info.fromJson(Map<String, dynamic> json) => Info( | |
| 127 | + description: json["description"], | |
| 128 | + title: json["title"], | |
| 129 | + version: json["version"], | |
| 130 | + ); | |
| 131 | + | |
| 132 | + Map<String, dynamic> toJson() => { | |
| 133 | + "description": description, | |
| 134 | + "title": title, | |
| 135 | + "version": version, | |
| 136 | + }; | |
| 137 | +} | |
| 138 | + | |
| 139 | +class Paths { | |
| 140 | + final BusinessServiceProvidersSearch businessServiceProvidersSearch; | |
| 141 | + | |
| 142 | + Paths({ | |
| 143 | + required this.businessServiceProvidersSearch, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Paths.fromJson(Map<String, dynamic> json) => Paths( | |
| 147 | + businessServiceProvidersSearch: BusinessServiceProvidersSearch.fromJson(json["/business_service_providers/search"]), | |
| 148 | + ); | |
| 149 | + | |
| 150 | + Map<String, dynamic> toJson() => { | |
| 151 | + "/business_service_providers/search": businessServiceProvidersSearch.toJson(), | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class BusinessServiceProvidersSearch { | |
| 156 | + final Get businessServiceProvidersSearchGet; | |
| 157 | + | |
| 158 | + BusinessServiceProvidersSearch({ | |
| 159 | + required this.businessServiceProvidersSearchGet, | |
| 160 | + }); | |
| 161 | + | |
| 162 | + factory BusinessServiceProvidersSearch.fromJson(Map<String, dynamic> json) => BusinessServiceProvidersSearch( | |
| 163 | + businessServiceProvidersSearchGet: Get.fromJson(json["get"]), | |
| 164 | + ); | |
| 165 | + | |
| 166 | + Map<String, dynamic> toJson() => { | |
| 167 | + "get": businessServiceProvidersSearchGet.toJson(), | |
| 168 | + }; | |
| 169 | +} | |
| 170 | + | |
| 171 | +class Get { | |
| 172 | + final String description; | |
| 173 | + final List<Parameter> parameters; | |
| 174 | + final Responses responses; | |
| 175 | + final String summary; | |
| 176 | + final List<String> tags; | |
| 177 | + | |
| 178 | + Get({ | |
| 179 | + required this.description, | |
| 180 | + required this.parameters, | |
| 181 | + required this.responses, | |
| 182 | + required this.summary, | |
| 183 | + required this.tags, | |
| 184 | + }); | |
| 185 | + | |
| 186 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 187 | + description: json["description"], | |
| 188 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 189 | + responses: Responses.fromJson(json["responses"]), | |
| 190 | + summary: json["summary"], | |
| 191 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 192 | + ); | |
| 193 | + | |
| 194 | + Map<String, dynamic> toJson() => { | |
| 195 | + "description": description, | |
| 196 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 197 | + "responses": responses.toJson(), | |
| 198 | + "summary": summary, | |
| 199 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 200 | + }; | |
| 201 | +} | |
| 202 | + | |
| 203 | +class Parameter { | |
| 204 | + final String description; | |
| 205 | + final Type format; | |
| 206 | + final String name; | |
| 207 | + final String parameterIn; | |
| 208 | + final bool required; | |
| 209 | + final Type type; | |
| 210 | + | |
| 211 | + Parameter({ | |
| 212 | + required this.description, | |
| 213 | + required this.format, | |
| 214 | + required this.name, | |
| 215 | + required this.parameterIn, | |
| 216 | + required this.required, | |
| 217 | + required this.type, | |
| 218 | + }); | |
| 219 | + | |
| 220 | + factory Parameter.fromJson(Map<String, dynamic> json) => Parameter( | |
| 221 | + description: json["description"], | |
| 222 | + format: typeValues.map[json["format"]]!, | |
| 223 | + name: json["name"], | |
| 224 | + parameterIn: json["in"], | |
| 225 | + required: json["required"], | |
| 226 | + type: typeValues.map[json["type"]]!, | |
| 227 | + ); | |
| 228 | + | |
| 229 | + Map<String, dynamic> toJson() => { | |
| 230 | + "description": description, | |
| 231 | + "format": typeValues.reverse[format], | |
| 232 | + "name": name, | |
| 233 | + "in": parameterIn, | |
| 234 | + "required": required, | |
| 235 | + "type": typeValues.reverse[type], | |
| 236 | + }; | |
| 237 | +} | |
| 238 | + | |
| 239 | +class Responses { | |
| 240 | + final The200 the200; | |
| 241 | + | |
| 242 | + Responses({ | |
| 243 | + required this.the200, | |
| 244 | + }); | |
| 245 | + | |
| 246 | + factory Responses.fromJson(Map<String, dynamic> json) => Responses( | |
| 247 | + the200: The200.fromJson(json["200"]), | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "200": the200.toJson(), | |
| 252 | + }; | |
| 253 | +} | |
| 254 | + | |
| 255 | +class The200 { | |
| 256 | + final String description; | |
| 257 | + final Schema schema; | |
| 258 | + | |
| 259 | + The200({ | |
| 260 | + required this.description, | |
| 261 | + required this.schema, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory The200.fromJson(Map<String, dynamic> json) => The200( | |
| 265 | + description: json["description"], | |
| 266 | + schema: Schema.fromJson(json["schema"]), | |
| 267 | + ); | |
| 268 | + | |
| 269 | + Map<String, dynamic> toJson() => { | |
| 270 | + "description": description, | |
| 271 | + "schema": schema.toJson(), | |
| 272 | + }; | |
| 273 | +} | |
| 274 | + | |
| 275 | +class Schema { | |
| 276 | + final String ref; | |
| 277 | + | |
| 278 | + Schema({ | |
| 279 | + required this.ref, | |
| 280 | + }); | |
| 281 | + | |
| 282 | + factory Schema.fromJson(Map<String, dynamic> json) => Schema( | |
| 283 | + ref: json["\u0024ref"], | |
| 284 | + ); | |
| 285 | + | |
| 286 | + Map<String, dynamic> toJson() => { | |
| 287 | + "\u0024ref": ref, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class EnumValues<T> { | |
| 292 | + Map<String, T> map; | |
| 293 | + late Map<T, String> reverseMap; | |
| 294 | + | |
| 295 | + EnumValues(this.map); | |
| 296 | + | |
| 297 | + Map<T, String> get reverse { | |
| 298 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 299 | + return reverseMap; | |
| 300 | + } | |
| 301 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/010b1.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/016af.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/033b1.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +211 −0test/inputs/json/misc/050b0.json
Adartdefault / TopLevel.dart+211 −0
| @@ -0,0 +1,211 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<OtherName> otherNames; | |
| 18 | + final String? supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<OtherName>.from(json["other_names"].map((x) => OtherName.fromJson(x))), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x.toJson())), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + DEP5, | |
| 77 | + SPDX, | |
| 78 | + TROVE | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "DEP5": Scheme.DEP5, | |
| 83 | + "SPDX": Scheme.SPDX, | |
| 84 | + "Trove": Scheme.TROVE | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + OSI_APPROVED, | |
| 89 | + POPULAR, | |
| 90 | + PERMISSIVE, | |
| 91 | + COPYLEFT | |
| 92 | +} | |
| 93 | + | |
| 94 | +final keywordValues = EnumValues({ | |
| 95 | + "osi-approved": Keyword.OSI_APPROVED, | |
| 96 | + "popular": Keyword.POPULAR, | |
| 97 | + "permissive": Keyword.PERMISSIVE, | |
| 98 | + "copyleft": Keyword.COPYLEFT | |
| 99 | +}); | |
| 100 | + | |
| 101 | +class Link { | |
| 102 | + final Note note; | |
| 103 | + final String url; | |
| 104 | + | |
| 105 | + Link({ | |
| 106 | + required this.note, | |
| 107 | + required this.url, | |
| 108 | + }); | |
| 109 | + | |
| 110 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 111 | + note: noteValues.map[json["note"]]!, | |
| 112 | + url: json["url"], | |
| 113 | + ); | |
| 114 | + | |
| 115 | + Map<String, dynamic> toJson() => { | |
| 116 | + "note": noteValues.reverse[note], | |
| 117 | + "url": url, | |
| 118 | + }; | |
| 119 | +} | |
| 120 | + | |
| 121 | +enum Note { | |
| 122 | + TL_DR_LEGAL, | |
| 123 | + WIKIPEDIA_PAGE, | |
| 124 | + OSI_PAGE, | |
| 125 | + NOTE_WIKIPEDIA_PAGE, | |
| 126 | + MOZILLA_PAGE | |
| 127 | +} | |
| 128 | + | |
| 129 | +final noteValues = EnumValues({ | |
| 130 | + "tl;dr legal": Note.TL_DR_LEGAL, | |
| 131 | + "Wikipedia page": Note.WIKIPEDIA_PAGE, | |
| 132 | + "OSI Page": Note.OSI_PAGE, | |
| 133 | + "Wikipedia Page": Note.NOTE_WIKIPEDIA_PAGE, | |
| 134 | + "Mozilla Page": Note.MOZILLA_PAGE | |
| 135 | +}); | |
| 136 | + | |
| 137 | +class OtherName { | |
| 138 | + final String name; | |
| 139 | + final String? note; | |
| 140 | + | |
| 141 | + OtherName({ | |
| 142 | + required this.name, | |
| 143 | + required this.note, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory OtherName.fromJson(Map<String, dynamic> json) => OtherName( | |
| 147 | + name: json["name"], | |
| 148 | + note: json["note"], | |
| 149 | + ); | |
| 150 | + | |
| 151 | + Map<String, dynamic> toJson() => { | |
| 152 | + "name": name, | |
| 153 | + "note": note, | |
| 154 | + }; | |
| 155 | +} | |
| 156 | + | |
| 157 | +class Text { | |
| 158 | + final MediaType mediaType; | |
| 159 | + final Title title; | |
| 160 | + final String url; | |
| 161 | + | |
| 162 | + Text({ | |
| 163 | + required this.mediaType, | |
| 164 | + required this.title, | |
| 165 | + required this.url, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 169 | + mediaType: mediaTypeValues.map[json["media_type"]]!, | |
| 170 | + title: titleValues.map[json["title"]]!, | |
| 171 | + url: json["url"], | |
| 172 | + ); | |
| 173 | + | |
| 174 | + Map<String, dynamic> toJson() => { | |
| 175 | + "media_type": mediaTypeValues.reverse[mediaType], | |
| 176 | + "title": titleValues.reverse[title], | |
| 177 | + "url": url, | |
| 178 | + }; | |
| 179 | +} | |
| 180 | + | |
| 181 | +enum MediaType { | |
| 182 | + TEXT_HTML, | |
| 183 | + TEXT_PLAIN | |
| 184 | +} | |
| 185 | + | |
| 186 | +final mediaTypeValues = EnumValues({ | |
| 187 | + "text/html": MediaType.TEXT_HTML, | |
| 188 | + "text/plain": MediaType.TEXT_PLAIN | |
| 189 | +}); | |
| 190 | + | |
| 191 | +enum Title { | |
| 192 | + HTML, | |
| 193 | + PLAIN_TEXT | |
| 194 | +} | |
| 195 | + | |
| 196 | +final titleValues = EnumValues({ | |
| 197 | + "HTML": Title.HTML, | |
| 198 | + "Plain Text": Title.PLAIN_TEXT | |
| 199 | +}); | |
| 200 | + | |
| 201 | +class EnumValues<T> { | |
| 202 | + Map<String, T> map; | |
| 203 | + late Map<T, String> reverseMap; | |
| 204 | + | |
| 205 | + EnumValues(this.map); | |
| 206 | + | |
| 207 | + Map<T, String> get reverse { | |
| 208 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 209 | + return reverseMap; | |
| 210 | + } | |
| 211 | +} |
Test case
1 generated file · +177 −0test/inputs/json/misc/06bee.json
Adartdefault / TopLevel.dart+177 −0
| @@ -0,0 +1,177 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final dynamic supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + SPDX, | |
| 77 | + TROVE, | |
| 78 | + DEP5 | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "SPDX": Scheme.SPDX, | |
| 83 | + "Trove": Scheme.TROVE, | |
| 84 | + "DEP5": Scheme.DEP5 | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + DISCOURAGED, | |
| 89 | + NON_REUSABLE, | |
| 90 | + OSI_APPROVED | |
| 91 | +} | |
| 92 | + | |
| 93 | +final keywordValues = EnumValues({ | |
| 94 | + "discouraged": Keyword.DISCOURAGED, | |
| 95 | + "non-reusable": Keyword.NON_REUSABLE, | |
| 96 | + "osi-approved": Keyword.OSI_APPROVED | |
| 97 | +}); | |
| 98 | + | |
| 99 | +class Link { | |
| 100 | + final Note note; | |
| 101 | + final String url; | |
| 102 | + | |
| 103 | + Link({ | |
| 104 | + required this.note, | |
| 105 | + required this.url, | |
| 106 | + }); | |
| 107 | + | |
| 108 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 109 | + note: noteValues.map[json["note"]]!, | |
| 110 | + url: json["url"], | |
| 111 | + ); | |
| 112 | + | |
| 113 | + Map<String, dynamic> toJson() => { | |
| 114 | + "note": noteValues.reverse[note], | |
| 115 | + "url": url, | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +enum Note { | |
| 120 | + OSI_PAGE | |
| 121 | +} | |
| 122 | + | |
| 123 | +final noteValues = EnumValues({ | |
| 124 | + "OSI Page": Note.OSI_PAGE | |
| 125 | +}); | |
| 126 | + | |
| 127 | +class Text { | |
| 128 | + final MediaType mediaType; | |
| 129 | + final Title title; | |
| 130 | + final String url; | |
| 131 | + | |
| 132 | + Text({ | |
| 133 | + required this.mediaType, | |
| 134 | + required this.title, | |
| 135 | + required this.url, | |
| 136 | + }); | |
| 137 | + | |
| 138 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 139 | + mediaType: mediaTypeValues.map[json["media_type"]]!, | |
| 140 | + title: titleValues.map[json["title"]]!, | |
| 141 | + url: json["url"], | |
| 142 | + ); | |
| 143 | + | |
| 144 | + Map<String, dynamic> toJson() => { | |
| 145 | + "media_type": mediaTypeValues.reverse[mediaType], | |
| 146 | + "title": titleValues.reverse[title], | |
| 147 | + "url": url, | |
| 148 | + }; | |
| 149 | +} | |
| 150 | + | |
| 151 | +enum MediaType { | |
| 152 | + TEXT_HTML | |
| 153 | +} | |
| 154 | + | |
| 155 | +final mediaTypeValues = EnumValues({ | |
| 156 | + "text/html": MediaType.TEXT_HTML | |
| 157 | +}); | |
| 158 | + | |
| 159 | +enum Title { | |
| 160 | + HTML | |
| 161 | +} | |
| 162 | + | |
| 163 | +final titleValues = EnumValues({ | |
| 164 | + "HTML": Title.HTML | |
| 165 | +}); | |
| 166 | + | |
| 167 | +class EnumValues<T> { | |
| 168 | + Map<String, T> map; | |
| 169 | + late Map<T, String> reverseMap; | |
| 170 | + | |
| 171 | + EnumValues(this.map); | |
| 172 | + | |
| 173 | + Map<T, String> get reverse { | |
| 174 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 175 | + return reverseMap; | |
| 176 | + } | |
| 177 | +} |
Test case
1 generated file · +35 −0test/inputs/json/misc/07540.json
Adartdefault / TopLevel.dart+35 −0
| @@ -0,0 +1,35 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Cookies cookies; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.cookies, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + cookies: Cookies.fromJson(json["cookies"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "cookies": cookies.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Cookies { | |
| 28 | + Cookies(); | |
| 29 | + | |
| 30 | + factory Cookies.fromJson(Map<String, dynamic> json) => Cookies( | |
| 31 | + ); | |
| 32 | + | |
| 33 | + Map<String, dynamic> toJson() => { | |
| 34 | + }; | |
| 35 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/0779f.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +117 −0test/inputs/json/misc/07c75.json
Adartdefault / TopLevel.dart+117 −0
| @@ -0,0 +1,117 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<String> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final dynamic supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<String>.from(json["keywords"].map((x) => x)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => x)), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final String scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: json["scheme"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": scheme, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Link { | |
| 76 | + final String note; | |
| 77 | + final String url; | |
| 78 | + | |
| 79 | + Link({ | |
| 80 | + required this.note, | |
| 81 | + required this.url, | |
| 82 | + }); | |
| 83 | + | |
| 84 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 85 | + note: json["note"], | |
| 86 | + url: json["url"], | |
| 87 | + ); | |
| 88 | + | |
| 89 | + Map<String, dynamic> toJson() => { | |
| 90 | + "note": note, | |
| 91 | + "url": url, | |
| 92 | + }; | |
| 93 | +} | |
| 94 | + | |
| 95 | +class Text { | |
| 96 | + final String mediaType; | |
| 97 | + final String title; | |
| 98 | + final String url; | |
| 99 | + | |
| 100 | + Text({ | |
| 101 | + required this.mediaType, | |
| 102 | + required this.title, | |
| 103 | + required this.url, | |
| 104 | + }); | |
| 105 | + | |
| 106 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 107 | + mediaType: json["media_type"], | |
| 108 | + title: json["title"], | |
| 109 | + url: json["url"], | |
| 110 | + ); | |
| 111 | + | |
| 112 | + Map<String, dynamic> toJson() => { | |
| 113 | + "media_type": mediaType, | |
| 114 | + "title": title, | |
| 115 | + "url": url, | |
| 116 | + }; | |
| 117 | +} |
Test case
1 generated file · +77 −0test/inputs/json/misc/09f54.json
Adartdefault / TopLevel.dart+77 −0
| @@ -0,0 +1,77 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Map<String, Datum> data; | |
| 13 | + final Description description; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.description, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: Map.from(json["data"]).map((k, v) => MapEntry<String, Datum>(k, Datum.fromJson(v))), | |
| 22 | + description: Description.fromJson(json["description"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 27 | + "description": description.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Datum { | |
| 32 | + final String anomaly; | |
| 33 | + final String value; | |
| 34 | + | |
| 35 | + Datum({ | |
| 36 | + required this.anomaly, | |
| 37 | + required this.value, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 41 | + anomaly: json["anomaly"], | |
| 42 | + value: json["value"], | |
| 43 | + ); | |
| 44 | + | |
| 45 | + Map<String, dynamic> toJson() => { | |
| 46 | + "anomaly": anomaly, | |
| 47 | + "value": value, | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Description { | |
| 52 | + final String basePeriod; | |
| 53 | + final int missing; | |
| 54 | + final String title; | |
| 55 | + final String units; | |
| 56 | + | |
| 57 | + Description({ | |
| 58 | + required this.basePeriod, | |
| 59 | + required this.missing, | |
| 60 | + required this.title, | |
| 61 | + required this.units, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Description.fromJson(Map<String, dynamic> json) => Description( | |
| 65 | + basePeriod: json["base_period"], | |
| 66 | + missing: json["missing"], | |
| 67 | + title: json["title"], | |
| 68 | + units: json["units"], | |
| 69 | + ); | |
| 70 | + | |
| 71 | + Map<String, dynamic> toJson() => { | |
| 72 | + "base_period": basePeriod, | |
| 73 | + "missing": missing, | |
| 74 | + "title": title, | |
| 75 | + "units": units, | |
| 76 | + }; | |
| 77 | +} |
Test case
1 generated file · +95 −0test/inputs/json/misc/0a358.json
Adartdefault / TopLevel.dart+95 −0
| @@ -0,0 +1,95 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final String next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final String code; | |
| 63 | + final DateTime createdAt; | |
| 64 | + final int id; | |
| 65 | + final String name; | |
| 66 | + final DateTime updatedAt; | |
| 67 | + final String uri; | |
| 68 | + | |
| 69 | + Result({ | |
| 70 | + required this.code, | |
| 71 | + required this.createdAt, | |
| 72 | + required this.id, | |
| 73 | + required this.name, | |
| 74 | + required this.updatedAt, | |
| 75 | + required this.uri, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 79 | + code: json["code"], | |
| 80 | + createdAt: DateTime.parse(json["created_at"]), | |
| 81 | + id: json["id"], | |
| 82 | + name: json["name"], | |
| 83 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 84 | + uri: json["uri"], | |
| 85 | + ); | |
| 86 | + | |
| 87 | + Map<String, dynamic> toJson() => { | |
| 88 | + "code": code, | |
| 89 | + "created_at": createdAt.toIso8601String(), | |
| 90 | + "id": id, | |
| 91 | + "name": name, | |
| 92 | + "updated_at": updatedAt.toIso8601String(), | |
| 93 | + "uri": uri, | |
| 94 | + }; | |
| 95 | +} |
Test case
1 generated file · +897 −0test/inputs/json/misc/0a91a.json
Adartdefault / TopLevel.dart+897 −0
| @@ -0,0 +1,897 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Actor actor; | |
| 13 | + final DateTime createdAt; | |
| 14 | + final String id; | |
| 15 | + final Actor? org; | |
| 16 | + final Payload payload; | |
| 17 | + final bool public; | |
| 18 | + final TopLevelRepo repo; | |
| 19 | + final Type type; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.actor, | |
| 23 | + required this.createdAt, | |
| 24 | + required this.id, | |
| 25 | + this.org, | |
| 26 | + required this.payload, | |
| 27 | + required this.public, | |
| 28 | + required this.repo, | |
| 29 | + required this.type, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + actor: Actor.fromJson(json["actor"]), | |
| 34 | + createdAt: DateTime.parse(json["created_at"]), | |
| 35 | + id: json["id"], | |
| 36 | + org: json["org"] == null ? null : Actor.fromJson(json["org"]), | |
| 37 | + payload: Payload.fromJson(json["payload"]), | |
| 38 | + public: json["public"], | |
| 39 | + repo: TopLevelRepo.fromJson(json["repo"]), | |
| 40 | + type: typeValues.map[json["type"]]!, | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "actor": actor.toJson(), | |
| 45 | + "created_at": createdAt.toIso8601String(), | |
| 46 | + "id": id, | |
| 47 | + "org": org?.toJson(), | |
| 48 | + "payload": payload.toJson(), | |
| 49 | + "public": public, | |
| 50 | + "repo": repo.toJson(), | |
| 51 | + "type": typeValues.reverse[type], | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Actor { | |
| 56 | + final String avatarUrl; | |
| 57 | + final String? displayLogin; | |
| 58 | + final String gravatarId; | |
| 59 | + final int id; | |
| 60 | + final String login; | |
| 61 | + final String url; | |
| 62 | + | |
| 63 | + Actor({ | |
| 64 | + required this.avatarUrl, | |
| 65 | + this.displayLogin, | |
| 66 | + required this.gravatarId, | |
| 67 | + required this.id, | |
| 68 | + required this.login, | |
| 69 | + required this.url, | |
| 70 | + }); | |
| 71 | + | |
| 72 | + factory Actor.fromJson(Map<String, dynamic> json) => Actor( | |
| 73 | + avatarUrl: json["avatar_url"], | |
| 74 | + displayLogin: json["display_login"], | |
| 75 | + gravatarId: json["gravatar_id"], | |
| 76 | + id: json["id"], | |
| 77 | + login: json["login"], | |
| 78 | + url: json["url"], | |
| 79 | + ); | |
| 80 | + | |
| 81 | + Map<String, dynamic> toJson() => { | |
| 82 | + "avatar_url": avatarUrl, | |
| 83 | + "display_login": displayLogin, | |
| 84 | + "gravatar_id": gravatarId, | |
| 85 | + "id": id, | |
| 86 | + "login": login, | |
| 87 | + "url": url, | |
| 88 | + }; | |
| 89 | +} | |
| 90 | + | |
| 91 | +class Payload { | |
| 92 | + final String? action; | |
| 93 | + final String? before; | |
| 94 | + final List<Commit>? commits; | |
| 95 | + final String? description; | |
| 96 | + final int? distinctSize; | |
| 97 | + final String? head; | |
| 98 | + final String? masterBranch; | |
| 99 | + final int? number; | |
| 100 | + final PullRequest? pullRequest; | |
| 101 | + final int? pushId; | |
| 102 | + final String? pusherType; | |
| 103 | + final String? ref; | |
| 104 | + final String? refType; | |
| 105 | + final int? size; | |
| 106 | + | |
| 107 | + Payload({ | |
| 108 | + this.action, | |
| 109 | + this.before, | |
| 110 | + this.commits, | |
| 111 | + this.description, | |
| 112 | + this.distinctSize, | |
| 113 | + this.head, | |
| 114 | + this.masterBranch, | |
| 115 | + this.number, | |
| 116 | + this.pullRequest, | |
| 117 | + this.pushId, | |
| 118 | + this.pusherType, | |
| 119 | + this.ref, | |
| 120 | + this.refType, | |
| 121 | + this.size, | |
| 122 | + }); | |
| 123 | + | |
| 124 | + factory Payload.fromJson(Map<String, dynamic> json) => Payload( | |
| 125 | + action: json["action"], | |
| 126 | + before: json["before"], | |
| 127 | + commits: json["commits"] == null ? null : List<Commit>.from(json["commits"]!.map((x) => Commit.fromJson(x))), | |
| 128 | + description: json["description"], | |
| 129 | + distinctSize: json["distinct_size"], | |
| 130 | + head: json["head"], | |
| 131 | + masterBranch: json["master_branch"], | |
| 132 | + number: json["number"], | |
| 133 | + pullRequest: json["pull_request"] == null ? null : PullRequest.fromJson(json["pull_request"]), | |
| 134 | + pushId: json["push_id"], | |
| 135 | + pusherType: json["pusher_type"], | |
| 136 | + ref: json["ref"], | |
| 137 | + refType: json["ref_type"], | |
| 138 | + size: json["size"], | |
| 139 | + ); | |
| 140 | + | |
| 141 | + Map<String, dynamic> toJson() => { | |
| 142 | + "action": action, | |
| 143 | + "before": before, | |
| 144 | + "commits": commits == null ? null : List<dynamic>.from(commits!.map((x) => x.toJson())), | |
| 145 | + "description": description, | |
| 146 | + "distinct_size": distinctSize, | |
| 147 | + "head": head, | |
| 148 | + "master_branch": masterBranch, | |
| 149 | + "number": number, | |
| 150 | + "pull_request": pullRequest?.toJson(), | |
| 151 | + "push_id": pushId, | |
| 152 | + "pusher_type": pusherType, | |
| 153 | + "ref": ref, | |
| 154 | + "ref_type": refType, | |
| 155 | + "size": size, | |
| 156 | + }; | |
| 157 | +} | |
| 158 | + | |
| 159 | +class Commit { | |
| 160 | + final Author author; | |
| 161 | + final bool distinct; | |
| 162 | + final String message; | |
| 163 | + final String sha; | |
| 164 | + final String url; | |
| 165 | + | |
| 166 | + Commit({ | |
| 167 | + required this.author, | |
| 168 | + required this.distinct, | |
| 169 | + required this.message, | |
| 170 | + required this.sha, | |
| 171 | + required this.url, | |
| 172 | + }); | |
| 173 | + | |
| 174 | + factory Commit.fromJson(Map<String, dynamic> json) => Commit( | |
| 175 | + author: Author.fromJson(json["author"]), | |
| 176 | + distinct: json["distinct"], | |
| 177 | + message: json["message"], | |
| 178 | + sha: json["sha"], | |
| 179 | + url: json["url"], | |
| 180 | + ); | |
| 181 | + | |
| 182 | + Map<String, dynamic> toJson() => { | |
| 183 | + "author": author.toJson(), | |
| 184 | + "distinct": distinct, | |
| 185 | + "message": message, | |
| 186 | + "sha": sha, | |
| 187 | + "url": url, | |
| 188 | + }; | |
| 189 | +} | |
| 190 | + | |
| 191 | +class Author { | |
| 192 | + final String email; | |
| 193 | + final String name; | |
| 194 | + | |
| 195 | + Author({ | |
| 196 | + required this.email, | |
| 197 | + required this.name, | |
| 198 | + }); | |
| 199 | + | |
| 200 | + factory Author.fromJson(Map<String, dynamic> json) => Author( | |
| 201 | + email: json["email"], | |
| 202 | + name: json["name"], | |
| 203 | + ); | |
| 204 | + | |
| 205 | + Map<String, dynamic> toJson() => { | |
| 206 | + "email": email, | |
| 207 | + "name": name, | |
| 208 | + }; | |
| 209 | +} | |
| 210 | + | |
| 211 | +class PullRequest { | |
| 212 | + final int additions; | |
| 213 | + final dynamic assignee; | |
| 214 | + final List<dynamic> assignees; | |
| 215 | + final Base base; | |
| 216 | + final String body; | |
| 217 | + final int changedFiles; | |
| 218 | + final DateTime closedAt; | |
| 219 | + final int comments; | |
| 220 | + final String commentsUrl; | |
| 221 | + final int commits; | |
| 222 | + final String commitsUrl; | |
| 223 | + final DateTime createdAt; | |
| 224 | + final int deletions; | |
| 225 | + final String diffUrl; | |
| 226 | + final Base head; | |
| 227 | + final String htmlUrl; | |
| 228 | + final int id; | |
| 229 | + final String issueUrl; | |
| 230 | + final Links links; | |
| 231 | + final bool locked; | |
| 232 | + final bool maintainerCanModify; | |
| 233 | + final String mergeCommitSha; | |
| 234 | + final dynamic mergeable; | |
| 235 | + final String mergeableState; | |
| 236 | + final bool merged; | |
| 237 | + final DateTime mergedAt; | |
| 238 | + final MergedBy mergedBy; | |
| 239 | + final dynamic milestone; | |
| 240 | + final int number; | |
| 241 | + final String patchUrl; | |
| 242 | + final dynamic rebaseable; | |
| 243 | + final List<dynamic> requestedReviewers; | |
| 244 | + final String reviewCommentUrl; | |
| 245 | + final int reviewComments; | |
| 246 | + final String reviewCommentsUrl; | |
| 247 | + final String state; | |
| 248 | + final String statusesUrl; | |
| 249 | + final String title; | |
| 250 | + final DateTime updatedAt; | |
| 251 | + final String url; | |
| 252 | + final MergedBy user; | |
| 253 | + | |
| 254 | + PullRequest({ | |
| 255 | + required this.additions, | |
| 256 | + required this.assignee, | |
| 257 | + required this.assignees, | |
| 258 | + required this.base, | |
| 259 | + required this.body, | |
| 260 | + required this.changedFiles, | |
| 261 | + required this.closedAt, | |
| 262 | + required this.comments, | |
| 263 | + required this.commentsUrl, | |
| 264 | + required this.commits, | |
| 265 | + required this.commitsUrl, | |
| 266 | + required this.createdAt, | |
| 267 | + required this.deletions, | |
| 268 | + required this.diffUrl, | |
| 269 | + required this.head, | |
| 270 | + required this.htmlUrl, | |
| 271 | + required this.id, | |
| 272 | + required this.issueUrl, | |
| 273 | + required this.links, | |
| 274 | + required this.locked, | |
| 275 | + required this.maintainerCanModify, | |
| 276 | + required this.mergeCommitSha, | |
| 277 | + required this.mergeable, | |
| 278 | + required this.mergeableState, | |
| 279 | + required this.merged, | |
| 280 | + required this.mergedAt, | |
| 281 | + required this.mergedBy, | |
| 282 | + required this.milestone, | |
| 283 | + required this.number, | |
| 284 | + required this.patchUrl, | |
| 285 | + required this.rebaseable, | |
| 286 | + required this.requestedReviewers, | |
| 287 | + required this.reviewCommentUrl, | |
| 288 | + required this.reviewComments, | |
| 289 | + required this.reviewCommentsUrl, | |
| 290 | + required this.state, | |
| 291 | + required this.statusesUrl, | |
| 292 | + required this.title, | |
| 293 | + required this.updatedAt, | |
| 294 | + required this.url, | |
| 295 | + required this.user, | |
| 296 | + }); | |
| 297 | + | |
| 298 | + factory PullRequest.fromJson(Map<String, dynamic> json) => PullRequest( | |
| 299 | + additions: json["additions"], | |
| 300 | + assignee: json["assignee"], | |
| 301 | + assignees: List<dynamic>.from(json["assignees"].map((x) => x)), | |
| 302 | + base: Base.fromJson(json["base"]), | |
| 303 | + body: json["body"], | |
| 304 | + changedFiles: json["changed_files"], | |
| 305 | + closedAt: DateTime.parse(json["closed_at"]), | |
| 306 | + comments: json["comments"], | |
| 307 | + commentsUrl: json["comments_url"], | |
| 308 | + commits: json["commits"], | |
| 309 | + commitsUrl: json["commits_url"], | |
| 310 | + createdAt: DateTime.parse(json["created_at"]), | |
| 311 | + deletions: json["deletions"], | |
| 312 | + diffUrl: json["diff_url"], | |
| 313 | + head: Base.fromJson(json["head"]), | |
| 314 | + htmlUrl: json["html_url"], | |
| 315 | + id: json["id"], | |
| 316 | + issueUrl: json["issue_url"], | |
| 317 | + links: Links.fromJson(json["_links"]), | |
| 318 | + locked: json["locked"], | |
| 319 | + maintainerCanModify: json["maintainer_can_modify"], | |
| 320 | + mergeCommitSha: json["merge_commit_sha"], | |
| 321 | + mergeable: json["mergeable"], | |
| 322 | + mergeableState: json["mergeable_state"], | |
| 323 | + merged: json["merged"], | |
| 324 | + mergedAt: DateTime.parse(json["merged_at"]), | |
| 325 | + mergedBy: MergedBy.fromJson(json["merged_by"]), | |
| 326 | + milestone: json["milestone"], | |
| 327 | + number: json["number"], | |
| 328 | + patchUrl: json["patch_url"], | |
| 329 | + rebaseable: json["rebaseable"], | |
| 330 | + requestedReviewers: List<dynamic>.from(json["requested_reviewers"].map((x) => x)), | |
| 331 | + reviewCommentUrl: json["review_comment_url"], | |
| 332 | + reviewComments: json["review_comments"], | |
| 333 | + reviewCommentsUrl: json["review_comments_url"], | |
| 334 | + state: json["state"], | |
| 335 | + statusesUrl: json["statuses_url"], | |
| 336 | + title: json["title"], | |
| 337 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 338 | + url: json["url"], | |
| 339 | + user: MergedBy.fromJson(json["user"]), | |
| 340 | + ); | |
| 341 | + | |
| 342 | + Map<String, dynamic> toJson() => { | |
| 343 | + "additions": additions, | |
| 344 | + "assignee": assignee, | |
| 345 | + "assignees": List<dynamic>.from(assignees.map((x) => x)), | |
| 346 | + "base": base.toJson(), | |
| 347 | + "body": body, | |
| 348 | + "changed_files": changedFiles, | |
| 349 | + "closed_at": closedAt.toIso8601String(), | |
| 350 | + "comments": comments, | |
| 351 | + "comments_url": commentsUrl, | |
| 352 | + "commits": commits, | |
| 353 | + "commits_url": commitsUrl, | |
| 354 | + "created_at": createdAt.toIso8601String(), | |
| 355 | + "deletions": deletions, | |
| 356 | + "diff_url": diffUrl, | |
| 357 | + "head": head.toJson(), | |
| 358 | + "html_url": htmlUrl, | |
| 359 | + "id": id, | |
| 360 | + "issue_url": issueUrl, | |
| 361 | + "_links": links.toJson(), | |
| 362 | + "locked": locked, | |
| 363 | + "maintainer_can_modify": maintainerCanModify, | |
| 364 | + "merge_commit_sha": mergeCommitSha, | |
| 365 | + "mergeable": mergeable, | |
| 366 | + "mergeable_state": mergeableState, | |
| 367 | + "merged": merged, | |
| 368 | + "merged_at": mergedAt.toIso8601String(), | |
| 369 | + "merged_by": mergedBy.toJson(), | |
| 370 | + "milestone": milestone, | |
| 371 | + "number": number, | |
| 372 | + "patch_url": patchUrl, | |
| 373 | + "rebaseable": rebaseable, | |
| 374 | + "requested_reviewers": List<dynamic>.from(requestedReviewers.map((x) => x)), | |
| 375 | + "review_comment_url": reviewCommentUrl, | |
| 376 | + "review_comments": reviewComments, | |
| 377 | + "review_comments_url": reviewCommentsUrl, | |
| 378 | + "state": state, | |
| 379 | + "statuses_url": statusesUrl, | |
| 380 | + "title": title, | |
| 381 | + "updated_at": updatedAt.toIso8601String(), | |
| 382 | + "url": url, | |
| 383 | + "user": user.toJson(), | |
| 384 | + }; | |
| 385 | +} | |
| 386 | + | |
| 387 | +class Base { | |
| 388 | + final String label; | |
| 389 | + final String ref; | |
| 390 | + final BaseRepo repo; | |
| 391 | + final String sha; | |
| 392 | + final MergedBy user; | |
| 393 | + | |
| 394 | + Base({ | |
| 395 | + required this.label, | |
| 396 | + required this.ref, | |
| 397 | + required this.repo, | |
| 398 | + required this.sha, | |
| 399 | + required this.user, | |
| 400 | + }); | |
| 401 | + | |
| 402 | + factory Base.fromJson(Map<String, dynamic> json) => Base( | |
| 403 | + label: json["label"], | |
| 404 | + ref: json["ref"], | |
| 405 | + repo: BaseRepo.fromJson(json["repo"]), | |
| 406 | + sha: json["sha"], | |
| 407 | + user: MergedBy.fromJson(json["user"]), | |
| 408 | + ); | |
| 409 | + | |
| 410 | + Map<String, dynamic> toJson() => { | |
| 411 | + "label": label, | |
| 412 | + "ref": ref, | |
| 413 | + "repo": repo.toJson(), | |
| 414 | + "sha": sha, | |
| 415 | + "user": user.toJson(), | |
| 416 | + }; | |
| 417 | +} | |
| 418 | + | |
| 419 | +class BaseRepo { | |
| 420 | + final String archiveUrl; | |
| 421 | + final String assigneesUrl; | |
| 422 | + final String blobsUrl; | |
| 423 | + final String branchesUrl; | |
| 424 | + final String cloneUrl; | |
| 425 | + final String collaboratorsUrl; | |
| 426 | + final String commentsUrl; | |
| 427 | + final String commitsUrl; | |
| 428 | + final String compareUrl; | |
| 429 | + final String contentsUrl; | |
| 430 | + final String contributorsUrl; | |
| 431 | + final DateTime createdAt; | |
| 432 | + final String defaultBranch; | |
| 433 | + final String deploymentsUrl; | |
| 434 | + final dynamic description; | |
| 435 | + final String downloadsUrl; | |
| 436 | + final String eventsUrl; | |
| 437 | + final bool fork; | |
| 438 | + final int forks; | |
| 439 | + final int forksCount; | |
| 440 | + final String forksUrl; | |
| 441 | + final String fullName; | |
| 442 | + final String gitCommitsUrl; | |
| 443 | + final String gitRefsUrl; | |
| 444 | + final String gitTagsUrl; | |
| 445 | + final String gitUrl; | |
| 446 | + final bool hasDownloads; | |
| 447 | + final bool hasIssues; | |
| 448 | + final bool hasPages; | |
| 449 | + final bool hasProjects; | |
| 450 | + final bool hasWiki; | |
| 451 | + final dynamic homepage; | |
| 452 | + final String hooksUrl; | |
| 453 | + final String htmlUrl; | |
| 454 | + final int id; | |
| 455 | + final String issueCommentUrl; | |
| 456 | + final String issueEventsUrl; | |
| 457 | + final String issuesUrl; | |
| 458 | + final String keysUrl; | |
| 459 | + final String labelsUrl; | |
| 460 | + final String language; | |
| 461 | + final String languagesUrl; | |
| 462 | + final String mergesUrl; | |
| 463 | + final String milestonesUrl; | |
| 464 | + final dynamic mirrorUrl; | |
| 465 | + final String name; | |
| 466 | + final String notificationsUrl; | |
| 467 | + final int openIssues; | |
| 468 | + final int openIssuesCount; | |
| 469 | + final MergedBy owner; | |
| 470 | + final bool private; | |
| 471 | + final String pullsUrl; | |
| 472 | + final DateTime pushedAt; | |
| 473 | + final String releasesUrl; | |
| 474 | + final int size; | |
| 475 | + final String sshUrl; | |
| 476 | + final int stargazersCount; | |
| 477 | + final String stargazersUrl; | |
| 478 | + final String statusesUrl; | |
| 479 | + final String subscribersUrl; | |
| 480 | + final String subscriptionUrl; | |
| 481 | + final String svnUrl; | |
| 482 | + final String tagsUrl; | |
| 483 | + final String teamsUrl; | |
| 484 | + final String treesUrl; | |
| 485 | + final DateTime updatedAt; | |
| 486 | + final String url; | |
| 487 | + final int watchers; | |
| 488 | + final int watchersCount; | |
| 489 | + | |
| 490 | + BaseRepo({ | |
| 491 | + required this.archiveUrl, | |
| 492 | + required this.assigneesUrl, | |
| 493 | + required this.blobsUrl, | |
| 494 | + required this.branchesUrl, | |
| 495 | + required this.cloneUrl, | |
| 496 | + required this.collaboratorsUrl, | |
| 497 | + required this.commentsUrl, | |
| 498 | + required this.commitsUrl, | |
| 499 | + required this.compareUrl, | |
| 500 | + required this.contentsUrl, | |
| 501 | + required this.contributorsUrl, | |
| 502 | + required this.createdAt, | |
| 503 | + required this.defaultBranch, | |
| 504 | + required this.deploymentsUrl, | |
| 505 | + required this.description, | |
| 506 | + required this.downloadsUrl, | |
| 507 | + required this.eventsUrl, | |
| 508 | + required this.fork, | |
| 509 | + required this.forks, | |
| 510 | + required this.forksCount, | |
| 511 | + required this.forksUrl, | |
| 512 | + required this.fullName, | |
| 513 | + required this.gitCommitsUrl, | |
| 514 | + required this.gitRefsUrl, | |
| 515 | + required this.gitTagsUrl, | |
| 516 | + required this.gitUrl, | |
| 517 | + required this.hasDownloads, | |
| 518 | + required this.hasIssues, | |
| 519 | + required this.hasPages, | |
| 520 | + required this.hasProjects, | |
| 521 | + required this.hasWiki, | |
| 522 | + required this.homepage, | |
| 523 | + required this.hooksUrl, | |
| 524 | + required this.htmlUrl, | |
| 525 | + required this.id, | |
| 526 | + required this.issueCommentUrl, | |
| 527 | + required this.issueEventsUrl, | |
| 528 | + required this.issuesUrl, | |
| 529 | + required this.keysUrl, | |
| 530 | + required this.labelsUrl, | |
| 531 | + required this.language, | |
| 532 | + required this.languagesUrl, | |
| 533 | + required this.mergesUrl, | |
| 534 | + required this.milestonesUrl, | |
| 535 | + required this.mirrorUrl, | |
| 536 | + required this.name, | |
| 537 | + required this.notificationsUrl, | |
| 538 | + required this.openIssues, | |
| 539 | + required this.openIssuesCount, | |
| 540 | + required this.owner, | |
| 541 | + required this.private, | |
| 542 | + required this.pullsUrl, | |
| 543 | + required this.pushedAt, | |
| 544 | + required this.releasesUrl, | |
| 545 | + required this.size, | |
| 546 | + required this.sshUrl, | |
| 547 | + required this.stargazersCount, | |
| 548 | + required this.stargazersUrl, | |
| 549 | + required this.statusesUrl, | |
| 550 | + required this.subscribersUrl, | |
| 551 | + required this.subscriptionUrl, | |
| 552 | + required this.svnUrl, | |
| 553 | + required this.tagsUrl, | |
| 554 | + required this.teamsUrl, | |
| 555 | + required this.treesUrl, | |
| 556 | + required this.updatedAt, | |
| 557 | + required this.url, | |
| 558 | + required this.watchers, | |
| 559 | + required this.watchersCount, | |
| 560 | + }); | |
| 561 | + | |
| 562 | + factory BaseRepo.fromJson(Map<String, dynamic> json) => BaseRepo( | |
| 563 | + archiveUrl: json["archive_url"], | |
| 564 | + assigneesUrl: json["assignees_url"], | |
| 565 | + blobsUrl: json["blobs_url"], | |
| 566 | + branchesUrl: json["branches_url"], | |
| 567 | + cloneUrl: json["clone_url"], | |
| 568 | + collaboratorsUrl: json["collaborators_url"], | |
| 569 | + commentsUrl: json["comments_url"], | |
| 570 | + commitsUrl: json["commits_url"], | |
| 571 | + compareUrl: json["compare_url"], | |
| 572 | + contentsUrl: json["contents_url"], | |
| 573 | + contributorsUrl: json["contributors_url"], | |
| 574 | + createdAt: DateTime.parse(json["created_at"]), | |
| 575 | + defaultBranch: json["default_branch"], | |
| 576 | + deploymentsUrl: json["deployments_url"], | |
| 577 | + description: json["description"], | |
| 578 | + downloadsUrl: json["downloads_url"], | |
| 579 | + eventsUrl: json["events_url"], | |
| 580 | + fork: json["fork"], | |
| 581 | + forks: json["forks"], | |
| 582 | + forksCount: json["forks_count"], | |
| 583 | + forksUrl: json["forks_url"], | |
| 584 | + fullName: json["full_name"], | |
| 585 | + gitCommitsUrl: json["git_commits_url"], | |
| 586 | + gitRefsUrl: json["git_refs_url"], | |
| 587 | + gitTagsUrl: json["git_tags_url"], | |
| 588 | + gitUrl: json["git_url"], | |
| 589 | + hasDownloads: json["has_downloads"], | |
| 590 | + hasIssues: json["has_issues"], | |
| 591 | + hasPages: json["has_pages"], | |
| 592 | + hasProjects: json["has_projects"], | |
| 593 | + hasWiki: json["has_wiki"], | |
| 594 | + homepage: json["homepage"], | |
| 595 | + hooksUrl: json["hooks_url"], | |
| 596 | + htmlUrl: json["html_url"], | |
| 597 | + id: json["id"], | |
| 598 | + issueCommentUrl: json["issue_comment_url"], | |
| 599 | + issueEventsUrl: json["issue_events_url"], | |
| 600 | + issuesUrl: json["issues_url"], | |
| 601 | + keysUrl: json["keys_url"], | |
| 602 | + labelsUrl: json["labels_url"], | |
| 603 | + language: json["language"], | |
| 604 | + languagesUrl: json["languages_url"], | |
| 605 | + mergesUrl: json["merges_url"], | |
| 606 | + milestonesUrl: json["milestones_url"], | |
| 607 | + mirrorUrl: json["mirror_url"], | |
| 608 | + name: json["name"], | |
| 609 | + notificationsUrl: json["notifications_url"], | |
| 610 | + openIssues: json["open_issues"], | |
| 611 | + openIssuesCount: json["open_issues_count"], | |
| 612 | + owner: MergedBy.fromJson(json["owner"]), | |
| 613 | + private: json["private"], | |
| 614 | + pullsUrl: json["pulls_url"], | |
| 615 | + pushedAt: DateTime.parse(json["pushed_at"]), | |
| 616 | + releasesUrl: json["releases_url"], | |
| 617 | + size: json["size"], | |
| 618 | + sshUrl: json["ssh_url"], | |
| 619 | + stargazersCount: json["stargazers_count"], | |
| 620 | + stargazersUrl: json["stargazers_url"], | |
| 621 | + statusesUrl: json["statuses_url"], | |
| 622 | + subscribersUrl: json["subscribers_url"], | |
| 623 | + subscriptionUrl: json["subscription_url"], | |
| 624 | + svnUrl: json["svn_url"], | |
| 625 | + tagsUrl: json["tags_url"], | |
| 626 | + teamsUrl: json["teams_url"], | |
| 627 | + treesUrl: json["trees_url"], | |
| 628 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 629 | + url: json["url"], | |
| 630 | + watchers: json["watchers"], | |
| 631 | + watchersCount: json["watchers_count"], | |
| 632 | + ); | |
| 633 | + | |
| 634 | + Map<String, dynamic> toJson() => { | |
| 635 | + "archive_url": archiveUrl, | |
| 636 | + "assignees_url": assigneesUrl, | |
| 637 | + "blobs_url": blobsUrl, | |
| 638 | + "branches_url": branchesUrl, | |
| 639 | + "clone_url": cloneUrl, | |
| 640 | + "collaborators_url": collaboratorsUrl, | |
| 641 | + "comments_url": commentsUrl, | |
| 642 | + "commits_url": commitsUrl, | |
| 643 | + "compare_url": compareUrl, | |
| 644 | + "contents_url": contentsUrl, | |
| 645 | + "contributors_url": contributorsUrl, | |
| 646 | + "created_at": createdAt.toIso8601String(), | |
| 647 | + "default_branch": defaultBranch, | |
| 648 | + "deployments_url": deploymentsUrl, | |
| 649 | + "description": description, | |
| 650 | + "downloads_url": downloadsUrl, | |
| 651 | + "events_url": eventsUrl, | |
| 652 | + "fork": fork, | |
| 653 | + "forks": forks, | |
| 654 | + "forks_count": forksCount, | |
| 655 | + "forks_url": forksUrl, | |
| 656 | + "full_name": fullName, | |
| 657 | + "git_commits_url": gitCommitsUrl, | |
| 658 | + "git_refs_url": gitRefsUrl, | |
| 659 | + "git_tags_url": gitTagsUrl, | |
| 660 | + "git_url": gitUrl, | |
| 661 | + "has_downloads": hasDownloads, | |
| 662 | + "has_issues": hasIssues, | |
| 663 | + "has_pages": hasPages, | |
| 664 | + "has_projects": hasProjects, | |
| 665 | + "has_wiki": hasWiki, | |
| 666 | + "homepage": homepage, | |
| 667 | + "hooks_url": hooksUrl, | |
| 668 | + "html_url": htmlUrl, | |
| 669 | + "id": id, | |
| 670 | + "issue_comment_url": issueCommentUrl, | |
| 671 | + "issue_events_url": issueEventsUrl, | |
| 672 | + "issues_url": issuesUrl, | |
| 673 | + "keys_url": keysUrl, | |
| 674 | + "labels_url": labelsUrl, | |
| 675 | + "language": language, | |
| 676 | + "languages_url": languagesUrl, | |
| 677 | + "merges_url": mergesUrl, | |
| 678 | + "milestones_url": milestonesUrl, | |
| 679 | + "mirror_url": mirrorUrl, | |
| 680 | + "name": name, | |
| 681 | + "notifications_url": notificationsUrl, | |
| 682 | + "open_issues": openIssues, | |
| 683 | + "open_issues_count": openIssuesCount, | |
| 684 | + "owner": owner.toJson(), | |
| 685 | + "private": private, | |
| 686 | + "pulls_url": pullsUrl, | |
| 687 | + "pushed_at": pushedAt.toIso8601String(), | |
| 688 | + "releases_url": releasesUrl, | |
| 689 | + "size": size, | |
| 690 | + "ssh_url": sshUrl, | |
| 691 | + "stargazers_count": stargazersCount, | |
| 692 | + "stargazers_url": stargazersUrl, | |
| 693 | + "statuses_url": statusesUrl, | |
| 694 | + "subscribers_url": subscribersUrl, | |
| 695 | + "subscription_url": subscriptionUrl, | |
| 696 | + "svn_url": svnUrl, | |
| 697 | + "tags_url": tagsUrl, | |
| 698 | + "teams_url": teamsUrl, | |
| 699 | + "trees_url": treesUrl, | |
| 700 | + "updated_at": updatedAt.toIso8601String(), | |
| 701 | + "url": url, | |
| 702 | + "watchers": watchers, | |
| 703 | + "watchers_count": watchersCount, | |
| 704 | + }; | |
| 705 | +} | |
| 706 | + | |
| 707 | +class MergedBy { | |
| 708 | + final String avatarUrl; | |
| 709 | + final String eventsUrl; | |
| 710 | + final String followersUrl; | |
| 711 | + final String followingUrl; | |
| 712 | + final String gistsUrl; | |
| 713 | + final String gravatarId; | |
| 714 | + final String htmlUrl; | |
| 715 | + final int id; | |
| 716 | + final String login; | |
| 717 | + final String organizationsUrl; | |
| 718 | + final String receivedEventsUrl; | |
| 719 | + final String reposUrl; | |
| 720 | + final bool siteAdmin; | |
| 721 | + final String starredUrl; | |
| 722 | + final String subscriptionsUrl; | |
| 723 | + final String type; | |
| 724 | + final String url; | |
| 725 | + | |
| 726 | + MergedBy({ | |
| 727 | + required this.avatarUrl, | |
| 728 | + required this.eventsUrl, | |
| 729 | + required this.followersUrl, | |
| 730 | + required this.followingUrl, | |
| 731 | + required this.gistsUrl, | |
| 732 | + required this.gravatarId, | |
| 733 | + required this.htmlUrl, | |
| 734 | + required this.id, | |
| 735 | + required this.login, | |
| 736 | + required this.organizationsUrl, | |
| 737 | + required this.receivedEventsUrl, | |
| 738 | + required this.reposUrl, | |
| 739 | + required this.siteAdmin, | |
| 740 | + required this.starredUrl, | |
| 741 | + required this.subscriptionsUrl, | |
| 742 | + required this.type, | |
| 743 | + required this.url, | |
| 744 | + }); | |
| 745 | + | |
| 746 | + factory MergedBy.fromJson(Map<String, dynamic> json) => MergedBy( | |
| 747 | + avatarUrl: json["avatar_url"], | |
| 748 | + eventsUrl: json["events_url"], | |
| 749 | + followersUrl: json["followers_url"], | |
| 750 | + followingUrl: json["following_url"], | |
| 751 | + gistsUrl: json["gists_url"], | |
| 752 | + gravatarId: json["gravatar_id"], | |
| 753 | + htmlUrl: json["html_url"], | |
| 754 | + id: json["id"], | |
| 755 | + login: json["login"], | |
| 756 | + organizationsUrl: json["organizations_url"], | |
| 757 | + receivedEventsUrl: json["received_events_url"], | |
| 758 | + reposUrl: json["repos_url"], | |
| 759 | + siteAdmin: json["site_admin"], | |
| 760 | + starredUrl: json["starred_url"], | |
| 761 | + subscriptionsUrl: json["subscriptions_url"], | |
| 762 | + type: json["type"], | |
| 763 | + url: json["url"], | |
| 764 | + ); | |
| 765 | + | |
| 766 | + Map<String, dynamic> toJson() => { | |
| 767 | + "avatar_url": avatarUrl, | |
| 768 | + "events_url": eventsUrl, | |
| 769 | + "followers_url": followersUrl, | |
| 770 | + "following_url": followingUrl, | |
| 771 | + "gists_url": gistsUrl, | |
| 772 | + "gravatar_id": gravatarId, | |
| 773 | + "html_url": htmlUrl, | |
| 774 | + "id": id, | |
| 775 | + "login": login, | |
| 776 | + "organizations_url": organizationsUrl, | |
| 777 | + "received_events_url": receivedEventsUrl, | |
| 778 | + "repos_url": reposUrl, | |
| 779 | + "site_admin": siteAdmin, | |
| 780 | + "starred_url": starredUrl, | |
| 781 | + "subscriptions_url": subscriptionsUrl, | |
| 782 | + "type": type, | |
| 783 | + "url": url, | |
| 784 | + }; | |
| 785 | +} | |
| 786 | + | |
| 787 | +class Links { | |
| 788 | + final Comments comments; | |
| 789 | + final Comments commits; | |
| 790 | + final Comments html; | |
| 791 | + final Comments issue; | |
| 792 | + final Comments reviewComment; | |
| 793 | + final Comments reviewComments; | |
| 794 | + final Comments self; | |
| 795 | + final Comments statuses; | |
| 796 | + | |
| 797 | + Links({ | |
| 798 | + required this.comments, | |
| 799 | + required this.commits, | |
| 800 | + required this.html, | |
| 801 | + required this.issue, | |
| 802 | + required this.reviewComment, | |
| 803 | + required this.reviewComments, | |
| 804 | + required this.self, | |
| 805 | + required this.statuses, | |
| 806 | + }); | |
| 807 | + | |
| 808 | + factory Links.fromJson(Map<String, dynamic> json) => Links( | |
| 809 | + comments: Comments.fromJson(json["comments"]), | |
| 810 | + commits: Comments.fromJson(json["commits"]), | |
| 811 | + html: Comments.fromJson(json["html"]), | |
| 812 | + issue: Comments.fromJson(json["issue"]), | |
| 813 | + reviewComment: Comments.fromJson(json["review_comment"]), | |
| 814 | + reviewComments: Comments.fromJson(json["review_comments"]), | |
| 815 | + self: Comments.fromJson(json["self"]), | |
| 816 | + statuses: Comments.fromJson(json["statuses"]), | |
| 817 | + ); | |
| 818 | + | |
| 819 | + Map<String, dynamic> toJson() => { | |
| 820 | + "comments": comments.toJson(), | |
| 821 | + "commits": commits.toJson(), | |
| 822 | + "html": html.toJson(), | |
| 823 | + "issue": issue.toJson(), | |
| 824 | + "review_comment": reviewComment.toJson(), | |
| 825 | + "review_comments": reviewComments.toJson(), | |
| 826 | + "self": self.toJson(), | |
| 827 | + "statuses": statuses.toJson(), | |
| 828 | + }; | |
| 829 | +} | |
| 830 | + | |
| 831 | +class Comments { | |
| 832 | + final String href; | |
| 833 | + | |
| 834 | + Comments({ | |
| 835 | + required this.href, | |
| 836 | + }); | |
| 837 | + | |
| 838 | + factory Comments.fromJson(Map<String, dynamic> json) => Comments( | |
| 839 | + href: json["href"], | |
| 840 | + ); | |
| 841 | + | |
| 842 | + Map<String, dynamic> toJson() => { | |
| 843 | + "href": href, | |
| 844 | + }; | |
| 845 | +} | |
| 846 | + | |
| 847 | +class TopLevelRepo { | |
| 848 | + final int id; | |
| 849 | + final String name; | |
| 850 | + final String url; | |
| 851 | + | |
| 852 | + TopLevelRepo({ | |
| 853 | + required this.id, | |
| 854 | + required this.name, | |
| 855 | + required this.url, | |
| 856 | + }); | |
| 857 | + | |
| 858 | + factory TopLevelRepo.fromJson(Map<String, dynamic> json) => TopLevelRepo( | |
| 859 | + id: json["id"], | |
| 860 | + name: json["name"], | |
| 861 | + url: json["url"], | |
| 862 | + ); | |
| 863 | + | |
| 864 | + Map<String, dynamic> toJson() => { | |
| 865 | + "id": id, | |
| 866 | + "name": name, | |
| 867 | + "url": url, | |
| 868 | + }; | |
| 869 | +} | |
| 870 | + | |
| 871 | +enum Type { | |
| 872 | + PUSH_EVENT, | |
| 873 | + CREATE_EVENT, | |
| 874 | + WATCH_EVENT, | |
| 875 | + PULL_REQUEST_EVENT, | |
| 876 | + DELETE_EVENT | |
| 877 | +} | |
| 878 | + | |
| 879 | +final typeValues = EnumValues({ | |
| 880 | + "PushEvent": Type.PUSH_EVENT, | |
| 881 | + "CreateEvent": Type.CREATE_EVENT, | |
| 882 | + "WatchEvent": Type.WATCH_EVENT, | |
| 883 | + "PullRequestEvent": Type.PULL_REQUEST_EVENT, | |
| 884 | + "DeleteEvent": Type.DELETE_EVENT | |
| 885 | +}); | |
| 886 | + | |
| 887 | +class EnumValues<T> { | |
| 888 | + Map<String, T> map; | |
| 889 | + late Map<T, String> reverseMap; | |
| 890 | + | |
| 891 | + EnumValues(this.map); | |
| 892 | + | |
| 893 | + Map<T, String> get reverse { | |
| 894 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 895 | + return reverseMap; | |
| 896 | + } | |
| 897 | +} |
Test case
1 generated file · +185 −0test/inputs/json/misc/0b91a.json
Adartdefault / TopLevel.dart+185 −0
| @@ -0,0 +1,185 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Metadata metadata; | |
| 13 | + final List<Result> results; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.metadata, | |
| 17 | + required this.results, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 22 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "metadata": metadata.toJson(), | |
| 27 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Metadata { | |
| 32 | + final double executionTime; | |
| 33 | + final ResponseInfo responseInfo; | |
| 34 | + final Resultset resultset; | |
| 35 | + | |
| 36 | + Metadata({ | |
| 37 | + required this.executionTime, | |
| 38 | + required this.responseInfo, | |
| 39 | + required this.resultset, | |
| 40 | + }); | |
| 41 | + | |
| 42 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 43 | + executionTime: json["executionTime"]?.toDouble(), | |
| 44 | + responseInfo: ResponseInfo.fromJson(json["responseInfo"]), | |
| 45 | + resultset: Resultset.fromJson(json["resultset"]), | |
| 46 | + ); | |
| 47 | + | |
| 48 | + Map<String, dynamic> toJson() => { | |
| 49 | + "executionTime": executionTime, | |
| 50 | + "responseInfo": responseInfo.toJson(), | |
| 51 | + "resultset": resultset.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class ResponseInfo { | |
| 56 | + final String developerMessage; | |
| 57 | + final int status; | |
| 58 | + | |
| 59 | + ResponseInfo({ | |
| 60 | + required this.developerMessage, | |
| 61 | + required this.status, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory ResponseInfo.fromJson(Map<String, dynamic> json) => ResponseInfo( | |
| 65 | + developerMessage: json["developerMessage"], | |
| 66 | + status: json["status"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "developerMessage": developerMessage, | |
| 71 | + "status": status, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Resultset { | |
| 76 | + final int count; | |
| 77 | + final int page; | |
| 78 | + final int pagesize; | |
| 79 | + | |
| 80 | + Resultset({ | |
| 81 | + required this.count, | |
| 82 | + required this.page, | |
| 83 | + required this.pagesize, | |
| 84 | + }); | |
| 85 | + | |
| 86 | + factory Resultset.fromJson(Map<String, dynamic> json) => Resultset( | |
| 87 | + count: json["count"], | |
| 88 | + page: json["page"], | |
| 89 | + pagesize: json["pagesize"], | |
| 90 | + ); | |
| 91 | + | |
| 92 | + Map<String, dynamic> toJson() => { | |
| 93 | + "count": count, | |
| 94 | + "page": page, | |
| 95 | + "pagesize": pagesize, | |
| 96 | + }; | |
| 97 | +} | |
| 98 | + | |
| 99 | +class Result { | |
| 100 | + final List<dynamic> attachment; | |
| 101 | + final String body; | |
| 102 | + final String changed; | |
| 103 | + final List<Component> component; | |
| 104 | + final String created; | |
| 105 | + final String date; | |
| 106 | + final List<dynamic> image; | |
| 107 | + final dynamic number; | |
| 108 | + final dynamic teaser; | |
| 109 | + final String title; | |
| 110 | + final List<dynamic> topic; | |
| 111 | + final String url; | |
| 112 | + final String uuid; | |
| 113 | + final String vuuid; | |
| 114 | + | |
| 115 | + Result({ | |
| 116 | + required this.attachment, | |
| 117 | + required this.body, | |
| 118 | + required this.changed, | |
| 119 | + required this.component, | |
| 120 | + required this.created, | |
| 121 | + required this.date, | |
| 122 | + required this.image, | |
| 123 | + required this.number, | |
| 124 | + required this.teaser, | |
| 125 | + required this.title, | |
| 126 | + required this.topic, | |
| 127 | + required this.url, | |
| 128 | + required this.uuid, | |
| 129 | + required this.vuuid, | |
| 130 | + }); | |
| 131 | + | |
| 132 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 133 | + attachment: List<dynamic>.from(json["attachment"].map((x) => x)), | |
| 134 | + body: json["body"], | |
| 135 | + changed: json["changed"], | |
| 136 | + component: List<Component>.from(json["component"].map((x) => Component.fromJson(x))), | |
| 137 | + created: json["created"], | |
| 138 | + date: json["date"], | |
| 139 | + image: List<dynamic>.from(json["image"].map((x) => x)), | |
| 140 | + number: json["number"], | |
| 141 | + teaser: json["teaser"], | |
| 142 | + title: json["title"], | |
| 143 | + topic: List<dynamic>.from(json["topic"].map((x) => x)), | |
| 144 | + url: json["url"], | |
| 145 | + uuid: json["uuid"], | |
| 146 | + vuuid: json["vuuid"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "attachment": List<dynamic>.from(attachment.map((x) => x)), | |
| 151 | + "body": body, | |
| 152 | + "changed": changed, | |
| 153 | + "component": List<dynamic>.from(component.map((x) => x.toJson())), | |
| 154 | + "created": created, | |
| 155 | + "date": date, | |
| 156 | + "image": List<dynamic>.from(image.map((x) => x)), | |
| 157 | + "number": number, | |
| 158 | + "teaser": teaser, | |
| 159 | + "title": title, | |
| 160 | + "topic": List<dynamic>.from(topic.map((x) => x)), | |
| 161 | + "url": url, | |
| 162 | + "uuid": uuid, | |
| 163 | + "vuuid": vuuid, | |
| 164 | + }; | |
| 165 | +} | |
| 166 | + | |
| 167 | +class Component { | |
| 168 | + final String name; | |
| 169 | + final String uuid; | |
| 170 | + | |
| 171 | + Component({ | |
| 172 | + required this.name, | |
| 173 | + required this.uuid, | |
| 174 | + }); | |
| 175 | + | |
| 176 | + factory Component.fromJson(Map<String, dynamic> json) => Component( | |
| 177 | + name: json["name"], | |
| 178 | + uuid: json["uuid"], | |
| 179 | + ); | |
| 180 | + | |
| 181 | + Map<String, dynamic> toJson() => { | |
| 182 | + "name": name, | |
| 183 | + "uuid": uuid, | |
| 184 | + }; | |
| 185 | +} |
Test case
1 generated file · +477 −0test/inputs/json/misc/0cffa.json
Adartdefault / TopLevel.dart+477 −0
| @@ -0,0 +1,477 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final Username username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: usernameValues.map[json["username"]]!, | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": usernameValues.reverse[username], | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final Looping looping; | |
| 136 | + final FixedHeight original; | |
| 137 | + final DownsizedSmall originalMp4; | |
| 138 | + final Downsized originalStill; | |
| 139 | + final DownsizedSmall preview; | |
| 140 | + final Downsized previewGif; | |
| 141 | + final Downsized previewWebp; | |
| 142 | + final Downsized? the480WStill; | |
| 143 | + | |
| 144 | + Images({ | |
| 145 | + required this.downsized, | |
| 146 | + required this.downsizedLarge, | |
| 147 | + required this.downsizedMedium, | |
| 148 | + required this.downsizedSmall, | |
| 149 | + required this.downsizedStill, | |
| 150 | + required this.fixedHeight, | |
| 151 | + required this.fixedHeightDownsampled, | |
| 152 | + required this.fixedHeightSmall, | |
| 153 | + required this.fixedHeightSmallStill, | |
| 154 | + required this.fixedHeightStill, | |
| 155 | + required this.fixedWidth, | |
| 156 | + required this.fixedWidthDownsampled, | |
| 157 | + required this.fixedWidthSmall, | |
| 158 | + required this.fixedWidthSmallStill, | |
| 159 | + required this.fixedWidthStill, | |
| 160 | + required this.looping, | |
| 161 | + required this.original, | |
| 162 | + required this.originalMp4, | |
| 163 | + required this.originalStill, | |
| 164 | + required this.preview, | |
| 165 | + required this.previewGif, | |
| 166 | + required this.previewWebp, | |
| 167 | + this.the480WStill, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 171 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 172 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 173 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 174 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 175 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 176 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 177 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 178 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 179 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 180 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 181 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 182 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 183 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 184 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 185 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 186 | + looping: Looping.fromJson(json["looping"]), | |
| 187 | + original: FixedHeight.fromJson(json["original"]), | |
| 188 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 189 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 190 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 191 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 192 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 193 | + the480WStill: json["480w_still"] == null ? null : Downsized.fromJson(json["480w_still"]), | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "downsized": downsized.toJson(), | |
| 198 | + "downsized_large": downsizedLarge.toJson(), | |
| 199 | + "downsized_medium": downsizedMedium.toJson(), | |
| 200 | + "downsized_small": downsizedSmall.toJson(), | |
| 201 | + "downsized_still": downsizedStill.toJson(), | |
| 202 | + "fixed_height": fixedHeight.toJson(), | |
| 203 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 204 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 205 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 206 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 207 | + "fixed_width": fixedWidth.toJson(), | |
| 208 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 209 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 210 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 211 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 212 | + "looping": looping.toJson(), | |
| 213 | + "original": original.toJson(), | |
| 214 | + "original_mp4": originalMp4.toJson(), | |
| 215 | + "original_still": originalStill.toJson(), | |
| 216 | + "preview": preview.toJson(), | |
| 217 | + "preview_gif": previewGif.toJson(), | |
| 218 | + "preview_webp": previewWebp.toJson(), | |
| 219 | + "480w_still": the480WStill?.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Downsized { | |
| 224 | + final String height; | |
| 225 | + final String? size; | |
| 226 | + final String url; | |
| 227 | + final String width; | |
| 228 | + | |
| 229 | + Downsized({ | |
| 230 | + required this.height, | |
| 231 | + this.size, | |
| 232 | + required this.url, | |
| 233 | + required this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 237 | + height: json["height"], | |
| 238 | + size: json["size"], | |
| 239 | + url: json["url"], | |
| 240 | + width: json["width"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "height": height, | |
| 245 | + "size": size, | |
| 246 | + "url": url, | |
| 247 | + "width": width, | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +class DownsizedSmall { | |
| 252 | + final String height; | |
| 253 | + final String mp4; | |
| 254 | + final String mp4Size; | |
| 255 | + final String width; | |
| 256 | + | |
| 257 | + DownsizedSmall({ | |
| 258 | + required this.height, | |
| 259 | + required this.mp4, | |
| 260 | + required this.mp4Size, | |
| 261 | + required this.width, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 265 | + height: json["height"], | |
| 266 | + mp4: json["mp4"], | |
| 267 | + mp4Size: json["mp4_size"], | |
| 268 | + width: json["width"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "height": height, | |
| 273 | + "mp4": mp4, | |
| 274 | + "mp4_size": mp4Size, | |
| 275 | + "width": width, | |
| 276 | + }; | |
| 277 | +} | |
| 278 | + | |
| 279 | +class FixedHeight { | |
| 280 | + final String? frames; | |
| 281 | + final String? hash; | |
| 282 | + final String height; | |
| 283 | + final String? mp4; | |
| 284 | + final String? mp4Size; | |
| 285 | + final String size; | |
| 286 | + final String url; | |
| 287 | + final String webp; | |
| 288 | + final String webpSize; | |
| 289 | + final String width; | |
| 290 | + | |
| 291 | + FixedHeight({ | |
| 292 | + this.frames, | |
| 293 | + this.hash, | |
| 294 | + required this.height, | |
| 295 | + this.mp4, | |
| 296 | + this.mp4Size, | |
| 297 | + required this.size, | |
| 298 | + required this.url, | |
| 299 | + required this.webp, | |
| 300 | + required this.webpSize, | |
| 301 | + required this.width, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 305 | + frames: json["frames"], | |
| 306 | + hash: json["hash"], | |
| 307 | + height: json["height"], | |
| 308 | + mp4: json["mp4"], | |
| 309 | + mp4Size: json["mp4_size"], | |
| 310 | + size: json["size"], | |
| 311 | + url: json["url"], | |
| 312 | + webp: json["webp"], | |
| 313 | + webpSize: json["webp_size"], | |
| 314 | + width: json["width"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "frames": frames, | |
| 319 | + "hash": hash, | |
| 320 | + "height": height, | |
| 321 | + "mp4": mp4, | |
| 322 | + "mp4_size": mp4Size, | |
| 323 | + "size": size, | |
| 324 | + "url": url, | |
| 325 | + "webp": webp, | |
| 326 | + "webp_size": webpSize, | |
| 327 | + "width": width, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class Looping { | |
| 332 | + final String mp4; | |
| 333 | + final String mp4Size; | |
| 334 | + | |
| 335 | + Looping({ | |
| 336 | + required this.mp4, | |
| 337 | + required this.mp4Size, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 341 | + mp4: json["mp4"], | |
| 342 | + mp4Size: json["mp4_size"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "mp4": mp4, | |
| 347 | + "mp4_size": mp4Size, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +enum Rating { | |
| 352 | + G, | |
| 353 | + PG | |
| 354 | +} | |
| 355 | + | |
| 356 | +final ratingValues = EnumValues({ | |
| 357 | + "g": Rating.G, | |
| 358 | + "pg": Rating.PG | |
| 359 | +}); | |
| 360 | + | |
| 361 | +enum Type { | |
| 362 | + GIF | |
| 363 | +} | |
| 364 | + | |
| 365 | +final typeValues = EnumValues({ | |
| 366 | + "gif": Type.GIF | |
| 367 | +}); | |
| 368 | + | |
| 369 | +class User { | |
| 370 | + final String avatarUrl; | |
| 371 | + final String bannerUrl; | |
| 372 | + final String displayName; | |
| 373 | + final String profileUrl; | |
| 374 | + final String twitter; | |
| 375 | + final Username username; | |
| 376 | + | |
| 377 | + User({ | |
| 378 | + required this.avatarUrl, | |
| 379 | + required this.bannerUrl, | |
| 380 | + required this.displayName, | |
| 381 | + required this.profileUrl, | |
| 382 | + required this.twitter, | |
| 383 | + required this.username, | |
| 384 | + }); | |
| 385 | + | |
| 386 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 387 | + avatarUrl: json["avatar_url"], | |
| 388 | + bannerUrl: json["banner_url"], | |
| 389 | + displayName: json["display_name"], | |
| 390 | + profileUrl: json["profile_url"], | |
| 391 | + twitter: json["twitter"], | |
| 392 | + username: usernameValues.map[json["username"]]!, | |
| 393 | + ); | |
| 394 | + | |
| 395 | + Map<String, dynamic> toJson() => { | |
| 396 | + "avatar_url": avatarUrl, | |
| 397 | + "banner_url": bannerUrl, | |
| 398 | + "display_name": displayName, | |
| 399 | + "profile_url": profileUrl, | |
| 400 | + "twitter": twitter, | |
| 401 | + "username": usernameValues.reverse[username], | |
| 402 | + }; | |
| 403 | +} | |
| 404 | + | |
| 405 | +enum Username { | |
| 406 | + CHEEZBURGER, | |
| 407 | + EMPTY, | |
| 408 | + NATGEOWILD, | |
| 409 | + NOWTHIS | |
| 410 | +} | |
| 411 | + | |
| 412 | +final usernameValues = EnumValues({ | |
| 413 | + "cheezburger": Username.CHEEZBURGER, | |
| 414 | + "": Username.EMPTY, | |
| 415 | + "natgeowild": Username.NATGEOWILD, | |
| 416 | + "nowthis": Username.NOWTHIS | |
| 417 | +}); | |
| 418 | + | |
| 419 | +class Meta { | |
| 420 | + final String msg; | |
| 421 | + final String responseId; | |
| 422 | + final int status; | |
| 423 | + | |
| 424 | + Meta({ | |
| 425 | + required this.msg, | |
| 426 | + required this.responseId, | |
| 427 | + required this.status, | |
| 428 | + }); | |
| 429 | + | |
| 430 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 431 | + msg: json["msg"], | |
| 432 | + responseId: json["response_id"], | |
| 433 | + status: json["status"], | |
| 434 | + ); | |
| 435 | + | |
| 436 | + Map<String, dynamic> toJson() => { | |
| 437 | + "msg": msg, | |
| 438 | + "response_id": responseId, | |
| 439 | + "status": status, | |
| 440 | + }; | |
| 441 | +} | |
| 442 | + | |
| 443 | +class Pagination { | |
| 444 | + final int count; | |
| 445 | + final int offset; | |
| 446 | + final int totalCount; | |
| 447 | + | |
| 448 | + Pagination({ | |
| 449 | + required this.count, | |
| 450 | + required this.offset, | |
| 451 | + required this.totalCount, | |
| 452 | + }); | |
| 453 | + | |
| 454 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 455 | + count: json["count"], | |
| 456 | + offset: json["offset"], | |
| 457 | + totalCount: json["total_count"], | |
| 458 | + ); | |
| 459 | + | |
| 460 | + Map<String, dynamic> toJson() => { | |
| 461 | + "count": count, | |
| 462 | + "offset": offset, | |
| 463 | + "total_count": totalCount, | |
| 464 | + }; | |
| 465 | +} | |
| 466 | + | |
| 467 | +class EnumValues<T> { | |
| 468 | + Map<String, T> map; | |
| 469 | + late Map<T, String> reverseMap; | |
| 470 | + | |
| 471 | + EnumValues(this.map); | |
| 472 | + | |
| 473 | + Map<T, String> get reverse { | |
| 474 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 475 | + return reverseMap; | |
| 476 | + } | |
| 477 | +} |
Test case
1 generated file · +327 −0test/inputs/json/misc/0e0c2.json
Adartdefault / TopLevel.dart+327 −0
| @@ -0,0 +1,327 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final String next; | |
| 14 | + final dynamic previous; | |
| 15 | + final List<Result> results; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.count, | |
| 19 | + required this.next, | |
| 20 | + required this.previous, | |
| 21 | + required this.results, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + count: json["count"], | |
| 26 | + next: json["next"], | |
| 27 | + previous: json["previous"], | |
| 28 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "count": count, | |
| 33 | + "next": next, | |
| 34 | + "previous": previous, | |
| 35 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Result { | |
| 40 | + final int activeScreens; | |
| 41 | + final List<Collection> collections; | |
| 42 | + final List<Detail> details; | |
| 43 | + final int duration; | |
| 44 | + final FavMovie favMovie; | |
| 45 | + final int id; | |
| 46 | + final List<Image> images; | |
| 47 | + final ResultLanguage language; | |
| 48 | + final DateTime releaseDate; | |
| 49 | + final int stars; | |
| 50 | + final List<dynamic>? tags; | |
| 51 | + final String title; | |
| 52 | + final List<Video> videos; | |
| 53 | + final VoteScore voteScore; | |
| 54 | + final int watches; | |
| 55 | + | |
| 56 | + Result({ | |
| 57 | + required this.activeScreens, | |
| 58 | + required this.collections, | |
| 59 | + required this.details, | |
| 60 | + required this.duration, | |
| 61 | + required this.favMovie, | |
| 62 | + required this.id, | |
| 63 | + required this.images, | |
| 64 | + required this.language, | |
| 65 | + required this.releaseDate, | |
| 66 | + required this.stars, | |
| 67 | + required this.tags, | |
| 68 | + required this.title, | |
| 69 | + required this.videos, | |
| 70 | + required this.voteScore, | |
| 71 | + required this.watches, | |
| 72 | + }); | |
| 73 | + | |
| 74 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 75 | + activeScreens: json["active_screens"], | |
| 76 | + collections: List<Collection>.from(json["collections"].map((x) => Collection.fromJson(x))), | |
| 77 | + details: List<Detail>.from(json["details"].map((x) => Detail.fromJson(x))), | |
| 78 | + duration: json["duration"], | |
| 79 | + favMovie: FavMovie.fromJson(json["fav_movie"]), | |
| 80 | + id: json["id"], | |
| 81 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 82 | + language: resultLanguageValues.map[json["language"]]!, | |
| 83 | + releaseDate: DateTime.parse(json["release_date"]), | |
| 84 | + stars: json["stars"], | |
| 85 | + tags: json["tags"] == null ? null : List<dynamic>.from(json["tags"]!.map((x) => x)), | |
| 86 | + title: json["title"], | |
| 87 | + videos: List<Video>.from(json["videos"].map((x) => Video.fromJson(x))), | |
| 88 | + voteScore: VoteScore.fromJson(json["vote_score"]), | |
| 89 | + watches: json["watches"], | |
| 90 | + ); | |
| 91 | + | |
| 92 | + Map<String, dynamic> toJson() => { | |
| 93 | + "active_screens": activeScreens, | |
| 94 | + "collections": List<dynamic>.from(collections.map((x) => x.toJson())), | |
| 95 | + "details": List<dynamic>.from(details.map((x) => x.toJson())), | |
| 96 | + "duration": duration, | |
| 97 | + "fav_movie": favMovie.toJson(), | |
| 98 | + "id": id, | |
| 99 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 100 | + "language": resultLanguageValues.reverse[language], | |
| 101 | + "release_date": "${releaseDate.year.toString().padLeft(4, '0')}-${releaseDate.month.toString().padLeft(2, '0')}-${releaseDate.day.toString().padLeft(2, '0')}", | |
| 102 | + "stars": stars, | |
| 103 | + "tags": tags == null ? null : List<dynamic>.from(tags!.map((x) => x)), | |
| 104 | + "title": title, | |
| 105 | + "videos": List<dynamic>.from(videos.map((x) => x.toJson())), | |
| 106 | + "vote_score": voteScore.toJson(), | |
| 107 | + "watches": watches, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class Collection { | |
| 112 | + final int id; | |
| 113 | + final List<int> movies; | |
| 114 | + final String name; | |
| 115 | + final String slug; | |
| 116 | + | |
| 117 | + Collection({ | |
| 118 | + required this.id, | |
| 119 | + required this.movies, | |
| 120 | + required this.name, | |
| 121 | + required this.slug, | |
| 122 | + }); | |
| 123 | + | |
| 124 | + factory Collection.fromJson(Map<String, dynamic> json) => Collection( | |
| 125 | + id: json["id"], | |
| 126 | + movies: List<int>.from(json["movies"].map((x) => x)), | |
| 127 | + name: json["name"], | |
| 128 | + slug: json["slug"], | |
| 129 | + ); | |
| 130 | + | |
| 131 | + Map<String, dynamic> toJson() => { | |
| 132 | + "id": id, | |
| 133 | + "movies": List<dynamic>.from(movies.map((x) => x)), | |
| 134 | + "name": name, | |
| 135 | + "slug": slug, | |
| 136 | + }; | |
| 137 | +} | |
| 138 | + | |
| 139 | +class Detail { | |
| 140 | + final String cast; | |
| 141 | + final String director; | |
| 142 | + final int id; | |
| 143 | + final DetailLanguage language; | |
| 144 | + final String storyline; | |
| 145 | + final String tagline; | |
| 146 | + final String title; | |
| 147 | + | |
| 148 | + Detail({ | |
| 149 | + required this.cast, | |
| 150 | + required this.director, | |
| 151 | + required this.id, | |
| 152 | + required this.language, | |
| 153 | + required this.storyline, | |
| 154 | + required this.tagline, | |
| 155 | + required this.title, | |
| 156 | + }); | |
| 157 | + | |
| 158 | + factory Detail.fromJson(Map<String, dynamic> json) => Detail( | |
| 159 | + cast: json["cast"], | |
| 160 | + director: json["director"], | |
| 161 | + id: json["id"], | |
| 162 | + language: detailLanguageValues.map[json["language"]]!, | |
| 163 | + storyline: json["storyline"], | |
| 164 | + tagline: json["tagline"], | |
| 165 | + title: json["title"], | |
| 166 | + ); | |
| 167 | + | |
| 168 | + Map<String, dynamic> toJson() => { | |
| 169 | + "cast": cast, | |
| 170 | + "director": director, | |
| 171 | + "id": id, | |
| 172 | + "language": detailLanguageValues.reverse[language], | |
| 173 | + "storyline": storyline, | |
| 174 | + "tagline": tagline, | |
| 175 | + "title": title, | |
| 176 | + }; | |
| 177 | +} | |
| 178 | + | |
| 179 | +enum DetailLanguage { | |
| 180 | + EN, | |
| 181 | + TH | |
| 182 | +} | |
| 183 | + | |
| 184 | +final detailLanguageValues = EnumValues({ | |
| 185 | + "en": DetailLanguage.EN, | |
| 186 | + "th": DetailLanguage.TH | |
| 187 | +}); | |
| 188 | + | |
| 189 | +class FavMovie { | |
| 190 | + final bool follow; | |
| 191 | + final bool star; | |
| 192 | + final bool watched; | |
| 193 | + | |
| 194 | + FavMovie({ | |
| 195 | + required this.follow, | |
| 196 | + required this.star, | |
| 197 | + required this.watched, | |
| 198 | + }); | |
| 199 | + | |
| 200 | + factory FavMovie.fromJson(Map<String, dynamic> json) => FavMovie( | |
| 201 | + follow: json["follow"], | |
| 202 | + star: json["star"], | |
| 203 | + watched: json["watched"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "follow": follow, | |
| 208 | + "star": star, | |
| 209 | + "watched": watched, | |
| 210 | + }; | |
| 211 | +} | |
| 212 | + | |
| 213 | +class Image { | |
| 214 | + final int favs; | |
| 215 | + final int id; | |
| 216 | + final String thumbnail; | |
| 217 | + final Type type; | |
| 218 | + final String url; | |
| 219 | + | |
| 220 | + Image({ | |
| 221 | + required this.favs, | |
| 222 | + required this.id, | |
| 223 | + required this.thumbnail, | |
| 224 | + required this.type, | |
| 225 | + required this.url, | |
| 226 | + }); | |
| 227 | + | |
| 228 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 229 | + favs: json["favs"], | |
| 230 | + id: json["id"], | |
| 231 | + thumbnail: json["thumbnail"], | |
| 232 | + type: typeValues.map[json["type"]]!, | |
| 233 | + url: json["url"], | |
| 234 | + ); | |
| 235 | + | |
| 236 | + Map<String, dynamic> toJson() => { | |
| 237 | + "favs": favs, | |
| 238 | + "id": id, | |
| 239 | + "thumbnail": thumbnail, | |
| 240 | + "type": typeValues.reverse[type], | |
| 241 | + "url": url, | |
| 242 | + }; | |
| 243 | +} | |
| 244 | + | |
| 245 | +enum Type { | |
| 246 | + POSTER, | |
| 247 | + BACKDROP | |
| 248 | +} | |
| 249 | + | |
| 250 | +final typeValues = EnumValues({ | |
| 251 | + "Poster": Type.POSTER, | |
| 252 | + "Backdrop": Type.BACKDROP | |
| 253 | +}); | |
| 254 | + | |
| 255 | +enum ResultLanguage { | |
| 256 | + EN, | |
| 257 | + EMPTY | |
| 258 | +} | |
| 259 | + | |
| 260 | +final resultLanguageValues = EnumValues({ | |
| 261 | + "en": ResultLanguage.EN, | |
| 262 | + "-": ResultLanguage.EMPTY | |
| 263 | +}); | |
| 264 | + | |
| 265 | +class Video { | |
| 266 | + final String kind; | |
| 267 | + final ResultLanguage language; | |
| 268 | + final String source; | |
| 269 | + final String url; | |
| 270 | + | |
| 271 | + Video({ | |
| 272 | + required this.kind, | |
| 273 | + required this.language, | |
| 274 | + required this.source, | |
| 275 | + required this.url, | |
| 276 | + }); | |
| 277 | + | |
| 278 | + factory Video.fromJson(Map<String, dynamic> json) => Video( | |
| 279 | + kind: json["kind"], | |
| 280 | + language: resultLanguageValues.map[json["language"]]!, | |
| 281 | + source: json["source"], | |
| 282 | + url: json["url"], | |
| 283 | + ); | |
| 284 | + | |
| 285 | + Map<String, dynamic> toJson() => { | |
| 286 | + "kind": kind, | |
| 287 | + "language": resultLanguageValues.reverse[language], | |
| 288 | + "source": source, | |
| 289 | + "url": url, | |
| 290 | + }; | |
| 291 | +} | |
| 292 | + | |
| 293 | +class VoteScore { | |
| 294 | + final int avg; | |
| 295 | + final int score; | |
| 296 | + final int total; | |
| 297 | + | |
| 298 | + VoteScore({ | |
| 299 | + required this.avg, | |
| 300 | + required this.score, | |
| 301 | + required this.total, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory VoteScore.fromJson(Map<String, dynamic> json) => VoteScore( | |
| 305 | + avg: json["avg"], | |
| 306 | + score: json["score"], | |
| 307 | + total: json["total"], | |
| 308 | + ); | |
| 309 | + | |
| 310 | + Map<String, dynamic> toJson() => { | |
| 311 | + "avg": avg, | |
| 312 | + "score": score, | |
| 313 | + "total": total, | |
| 314 | + }; | |
| 315 | +} | |
| 316 | + | |
| 317 | +class EnumValues<T> { | |
| 318 | + Map<String, T> map; | |
| 319 | + late Map<T, String> reverseMap; | |
| 320 | + | |
| 321 | + EnumValues(this.map); | |
| 322 | + | |
| 323 | + Map<T, String> get reverse { | |
| 324 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 325 | + return reverseMap; | |
| 326 | + } | |
| 327 | +} |
Test case
1 generated file · +25 −0test/inputs/json/misc/0fecf.json
Adartdefault / TopLevel.dart+25 −0
| @@ -0,0 +1,25 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<String> countries; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.countries, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + countries: List<String>.from(json["countries"].map((x) => x)), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "countries": List<dynamic>.from(countries.map((x) => x)), | |
| 24 | + }; | |
| 25 | +} |
Test case
1 generated file · +233 −0test/inputs/json/misc/10be4.json
Adartdefault / TopLevel.dart+233 −0
| @@ -0,0 +1,233 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<OtherName> otherNames; | |
| 18 | + final String? supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<OtherName>.from(json["other_names"].map((x) => OtherName.fromJson(x))), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x.toJson())), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + SPDX, | |
| 77 | + TROVE, | |
| 78 | + DEP5 | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "SPDX": Scheme.SPDX, | |
| 83 | + "Trove": Scheme.TROVE, | |
| 84 | + "DEP5": Scheme.DEP5 | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + OSI_APPROVED, | |
| 89 | + DISCOURAGED, | |
| 90 | + REDUNDANT, | |
| 91 | + MISCELLANEOUS, | |
| 92 | + NON_REUSABLE, | |
| 93 | + OBSOLETE, | |
| 94 | + POPULAR, | |
| 95 | + PERMISSIVE, | |
| 96 | + RETIRED, | |
| 97 | + SPECIAL_PURPOSE, | |
| 98 | + COPYLEFT, | |
| 99 | + INTERNATIONAL | |
| 100 | +} | |
| 101 | + | |
| 102 | +final keywordValues = EnumValues({ | |
| 103 | + "osi-approved": Keyword.OSI_APPROVED, | |
| 104 | + "discouraged": Keyword.DISCOURAGED, | |
| 105 | + "redundant": Keyword.REDUNDANT, | |
| 106 | + "miscellaneous": Keyword.MISCELLANEOUS, | |
| 107 | + "non-reusable": Keyword.NON_REUSABLE, | |
| 108 | + "obsolete": Keyword.OBSOLETE, | |
| 109 | + "popular": Keyword.POPULAR, | |
| 110 | + "permissive": Keyword.PERMISSIVE, | |
| 111 | + "retired": Keyword.RETIRED, | |
| 112 | + "special-purpose": Keyword.SPECIAL_PURPOSE, | |
| 113 | + "copyleft": Keyword.COPYLEFT, | |
| 114 | + "international": Keyword.INTERNATIONAL | |
| 115 | +}); | |
| 116 | + | |
| 117 | +class Link { | |
| 118 | + final Note note; | |
| 119 | + final String url; | |
| 120 | + | |
| 121 | + Link({ | |
| 122 | + required this.note, | |
| 123 | + required this.url, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 127 | + note: noteValues.map[json["note"]]!, | |
| 128 | + url: json["url"], | |
| 129 | + ); | |
| 130 | + | |
| 131 | + Map<String, dynamic> toJson() => { | |
| 132 | + "note": noteValues.reverse[note], | |
| 133 | + "url": url, | |
| 134 | + }; | |
| 135 | +} | |
| 136 | + | |
| 137 | +enum Note { | |
| 138 | + OSI_PAGE, | |
| 139 | + TL_DR_LEGAL, | |
| 140 | + WIKIPEDIA_PAGE, | |
| 141 | + NOTE_WIKIPEDIA_PAGE, | |
| 142 | + MOZILLA_PAGE, | |
| 143 | + OSET_FOUNDATION_PAGE | |
| 144 | +} | |
| 145 | + | |
| 146 | +final noteValues = EnumValues({ | |
| 147 | + "OSI Page": Note.OSI_PAGE, | |
| 148 | + "tl;dr legal": Note.TL_DR_LEGAL, | |
| 149 | + "Wikipedia page": Note.WIKIPEDIA_PAGE, | |
| 150 | + "Wikipedia Page": Note.NOTE_WIKIPEDIA_PAGE, | |
| 151 | + "Mozilla Page": Note.MOZILLA_PAGE, | |
| 152 | + "OSET Foundation Page": Note.OSET_FOUNDATION_PAGE | |
| 153 | +}); | |
| 154 | + | |
| 155 | +class OtherName { | |
| 156 | + final String name; | |
| 157 | + final String? note; | |
| 158 | + | |
| 159 | + OtherName({ | |
| 160 | + required this.name, | |
| 161 | + required this.note, | |
| 162 | + }); | |
| 163 | + | |
| 164 | + factory OtherName.fromJson(Map<String, dynamic> json) => OtherName( | |
| 165 | + name: json["name"], | |
| 166 | + note: json["note"], | |
| 167 | + ); | |
| 168 | + | |
| 169 | + Map<String, dynamic> toJson() => { | |
| 170 | + "name": name, | |
| 171 | + "note": note, | |
| 172 | + }; | |
| 173 | +} | |
| 174 | + | |
| 175 | +class Text { | |
| 176 | + final MediaType mediaType; | |
| 177 | + final Title title; | |
| 178 | + final String url; | |
| 179 | + | |
| 180 | + Text({ | |
| 181 | + required this.mediaType, | |
| 182 | + required this.title, | |
| 183 | + required this.url, | |
| 184 | + }); | |
| 185 | + | |
| 186 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 187 | + mediaType: mediaTypeValues.map[json["media_type"]]!, | |
| 188 | + title: titleValues.map[json["title"]]!, | |
| 189 | + url: json["url"], | |
| 190 | + ); | |
| 191 | + | |
| 192 | + Map<String, dynamic> toJson() => { | |
| 193 | + "media_type": mediaTypeValues.reverse[mediaType], | |
| 194 | + "title": titleValues.reverse[title], | |
| 195 | + "url": url, | |
| 196 | + }; | |
| 197 | +} | |
| 198 | + | |
| 199 | +enum MediaType { | |
| 200 | + TEXT_HTML, | |
| 201 | + TEXT_PLAIN, | |
| 202 | + APPLICATION_PDF | |
| 203 | +} | |
| 204 | + | |
| 205 | +final mediaTypeValues = EnumValues({ | |
| 206 | + "text/html": MediaType.TEXT_HTML, | |
| 207 | + "text/plain": MediaType.TEXT_PLAIN, | |
| 208 | + "application/pdf": MediaType.APPLICATION_PDF | |
| 209 | +}); | |
| 210 | + | |
| 211 | +enum Title { | |
| 212 | + HTML, | |
| 213 | + PLAIN_TEXT, | |
| 214 | ||
| 215 | +} | |
| 216 | + | |
| 217 | +final titleValues = EnumValues({ | |
| 218 | + "HTML": Title.HTML, | |
| 219 | + "Plain Text": Title.PLAIN_TEXT, | |
| 220 | + "PDF": Title.PDF | |
| 221 | +}); | |
| 222 | + | |
| 223 | +class EnumValues<T> { | |
| 224 | + Map<String, T> map; | |
| 225 | + late Map<T, String> reverseMap; | |
| 226 | + | |
| 227 | + EnumValues(this.map); | |
| 228 | + | |
| 229 | + Map<T, String> get reverse { | |
| 230 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 231 | + return reverseMap; | |
| 232 | + } | |
| 233 | +} |
Test case
1 generated file · +75 −0test/inputs/json/misc/112b5.json
Adartdefault / TopLevel.dart+75 −0
| @@ -0,0 +1,75 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Args args; | |
| 13 | + final Headers headers; | |
| 14 | + final String origin; | |
| 15 | + final String url; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.args, | |
| 19 | + required this.headers, | |
| 20 | + required this.origin, | |
| 21 | + required this.url, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + args: Args.fromJson(json["args"]), | |
| 26 | + headers: Headers.fromJson(json["headers"]), | |
| 27 | + origin: json["origin"], | |
| 28 | + url: json["url"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "args": args.toJson(), | |
| 33 | + "headers": headers.toJson(), | |
| 34 | + "origin": origin, | |
| 35 | + "url": url, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Args { | |
| 40 | + Args(); | |
| 41 | + | |
| 42 | + factory Args.fromJson(Map<String, dynamic> json) => Args( | |
| 43 | + ); | |
| 44 | + | |
| 45 | + Map<String, dynamic> toJson() => { | |
| 46 | + }; | |
| 47 | +} | |
| 48 | + | |
| 49 | +class Headers { | |
| 50 | + final String acceptEncoding; | |
| 51 | + final String connection; | |
| 52 | + final String host; | |
| 53 | + final String userAgent; | |
| 54 | + | |
| 55 | + Headers({ | |
| 56 | + required this.acceptEncoding, | |
| 57 | + required this.connection, | |
| 58 | + required this.host, | |
| 59 | + required this.userAgent, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Headers.fromJson(Map<String, dynamic> json) => Headers( | |
| 63 | + acceptEncoding: json["Accept-Encoding"], | |
| 64 | + connection: json["Connection"], | |
| 65 | + host: json["Host"], | |
| 66 | + userAgent: json["User-Agent"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "Accept-Encoding": acceptEncoding, | |
| 71 | + "Connection": connection, | |
| 72 | + "Host": host, | |
| 73 | + "User-Agent": userAgent, | |
| 74 | + }; | |
| 75 | +} |
Test case
1 generated file · +475 −0test/inputs/json/misc/127a1.json
Adartdefault / TopLevel.dart+475 −0
| @@ -0,0 +1,475 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final Username username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: usernameValues.map[json["username"]]!, | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": usernameValues.reverse[username], | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final Looping looping; | |
| 136 | + final FixedHeight original; | |
| 137 | + final DownsizedSmall originalMp4; | |
| 138 | + final Downsized originalStill; | |
| 139 | + final DownsizedSmall preview; | |
| 140 | + final Downsized previewGif; | |
| 141 | + final Downsized previewWebp; | |
| 142 | + final Downsized? the480WStill; | |
| 143 | + | |
| 144 | + Images({ | |
| 145 | + required this.downsized, | |
| 146 | + required this.downsizedLarge, | |
| 147 | + required this.downsizedMedium, | |
| 148 | + required this.downsizedSmall, | |
| 149 | + required this.downsizedStill, | |
| 150 | + required this.fixedHeight, | |
| 151 | + required this.fixedHeightDownsampled, | |
| 152 | + required this.fixedHeightSmall, | |
| 153 | + required this.fixedHeightSmallStill, | |
| 154 | + required this.fixedHeightStill, | |
| 155 | + required this.fixedWidth, | |
| 156 | + required this.fixedWidthDownsampled, | |
| 157 | + required this.fixedWidthSmall, | |
| 158 | + required this.fixedWidthSmallStill, | |
| 159 | + required this.fixedWidthStill, | |
| 160 | + required this.looping, | |
| 161 | + required this.original, | |
| 162 | + required this.originalMp4, | |
| 163 | + required this.originalStill, | |
| 164 | + required this.preview, | |
| 165 | + required this.previewGif, | |
| 166 | + required this.previewWebp, | |
| 167 | + this.the480WStill, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 171 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 172 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 173 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 174 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 175 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 176 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 177 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 178 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 179 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 180 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 181 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 182 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 183 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 184 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 185 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 186 | + looping: Looping.fromJson(json["looping"]), | |
| 187 | + original: FixedHeight.fromJson(json["original"]), | |
| 188 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 189 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 190 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 191 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 192 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 193 | + the480WStill: json["480w_still"] == null ? null : Downsized.fromJson(json["480w_still"]), | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "downsized": downsized.toJson(), | |
| 198 | + "downsized_large": downsizedLarge.toJson(), | |
| 199 | + "downsized_medium": downsizedMedium.toJson(), | |
| 200 | + "downsized_small": downsizedSmall.toJson(), | |
| 201 | + "downsized_still": downsizedStill.toJson(), | |
| 202 | + "fixed_height": fixedHeight.toJson(), | |
| 203 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 204 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 205 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 206 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 207 | + "fixed_width": fixedWidth.toJson(), | |
| 208 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 209 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 210 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 211 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 212 | + "looping": looping.toJson(), | |
| 213 | + "original": original.toJson(), | |
| 214 | + "original_mp4": originalMp4.toJson(), | |
| 215 | + "original_still": originalStill.toJson(), | |
| 216 | + "preview": preview.toJson(), | |
| 217 | + "preview_gif": previewGif.toJson(), | |
| 218 | + "preview_webp": previewWebp.toJson(), | |
| 219 | + "480w_still": the480WStill?.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Downsized { | |
| 224 | + final String height; | |
| 225 | + final String? size; | |
| 226 | + final String url; | |
| 227 | + final String width; | |
| 228 | + | |
| 229 | + Downsized({ | |
| 230 | + required this.height, | |
| 231 | + this.size, | |
| 232 | + required this.url, | |
| 233 | + required this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 237 | + height: json["height"], | |
| 238 | + size: json["size"], | |
| 239 | + url: json["url"], | |
| 240 | + width: json["width"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "height": height, | |
| 245 | + "size": size, | |
| 246 | + "url": url, | |
| 247 | + "width": width, | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +class DownsizedSmall { | |
| 252 | + final String height; | |
| 253 | + final String mp4; | |
| 254 | + final String mp4Size; | |
| 255 | + final String width; | |
| 256 | + | |
| 257 | + DownsizedSmall({ | |
| 258 | + required this.height, | |
| 259 | + required this.mp4, | |
| 260 | + required this.mp4Size, | |
| 261 | + required this.width, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 265 | + height: json["height"], | |
| 266 | + mp4: json["mp4"], | |
| 267 | + mp4Size: json["mp4_size"], | |
| 268 | + width: json["width"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "height": height, | |
| 273 | + "mp4": mp4, | |
| 274 | + "mp4_size": mp4Size, | |
| 275 | + "width": width, | |
| 276 | + }; | |
| 277 | +} | |
| 278 | + | |
| 279 | +class FixedHeight { | |
| 280 | + final String? frames; | |
| 281 | + final String? hash; | |
| 282 | + final String height; | |
| 283 | + final String? mp4; | |
| 284 | + final String? mp4Size; | |
| 285 | + final String size; | |
| 286 | + final String url; | |
| 287 | + final String webp; | |
| 288 | + final String webpSize; | |
| 289 | + final String width; | |
| 290 | + | |
| 291 | + FixedHeight({ | |
| 292 | + this.frames, | |
| 293 | + this.hash, | |
| 294 | + required this.height, | |
| 295 | + this.mp4, | |
| 296 | + this.mp4Size, | |
| 297 | + required this.size, | |
| 298 | + required this.url, | |
| 299 | + required this.webp, | |
| 300 | + required this.webpSize, | |
| 301 | + required this.width, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 305 | + frames: json["frames"], | |
| 306 | + hash: json["hash"], | |
| 307 | + height: json["height"], | |
| 308 | + mp4: json["mp4"], | |
| 309 | + mp4Size: json["mp4_size"], | |
| 310 | + size: json["size"], | |
| 311 | + url: json["url"], | |
| 312 | + webp: json["webp"], | |
| 313 | + webpSize: json["webp_size"], | |
| 314 | + width: json["width"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "frames": frames, | |
| 319 | + "hash": hash, | |
| 320 | + "height": height, | |
| 321 | + "mp4": mp4, | |
| 322 | + "mp4_size": mp4Size, | |
| 323 | + "size": size, | |
| 324 | + "url": url, | |
| 325 | + "webp": webp, | |
| 326 | + "webp_size": webpSize, | |
| 327 | + "width": width, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class Looping { | |
| 332 | + final String mp4; | |
| 333 | + final String mp4Size; | |
| 334 | + | |
| 335 | + Looping({ | |
| 336 | + required this.mp4, | |
| 337 | + required this.mp4Size, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 341 | + mp4: json["mp4"], | |
| 342 | + mp4Size: json["mp4_size"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "mp4": mp4, | |
| 347 | + "mp4_size": mp4Size, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +enum Rating { | |
| 352 | + G | |
| 353 | +} | |
| 354 | + | |
| 355 | +final ratingValues = EnumValues({ | |
| 356 | + "g": Rating.G | |
| 357 | +}); | |
| 358 | + | |
| 359 | +enum Type { | |
| 360 | + GIF | |
| 361 | +} | |
| 362 | + | |
| 363 | +final typeValues = EnumValues({ | |
| 364 | + "gif": Type.GIF | |
| 365 | +}); | |
| 366 | + | |
| 367 | +class User { | |
| 368 | + final String avatarUrl; | |
| 369 | + final String bannerUrl; | |
| 370 | + final String displayName; | |
| 371 | + final String profileUrl; | |
| 372 | + final String? twitter; | |
| 373 | + final Username username; | |
| 374 | + | |
| 375 | + User({ | |
| 376 | + required this.avatarUrl, | |
| 377 | + required this.bannerUrl, | |
| 378 | + required this.displayName, | |
| 379 | + required this.profileUrl, | |
| 380 | + this.twitter, | |
| 381 | + required this.username, | |
| 382 | + }); | |
| 383 | + | |
| 384 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 385 | + avatarUrl: json["avatar_url"], | |
| 386 | + bannerUrl: json["banner_url"], | |
| 387 | + displayName: json["display_name"], | |
| 388 | + profileUrl: json["profile_url"], | |
| 389 | + twitter: json["twitter"], | |
| 390 | + username: usernameValues.map[json["username"]]!, | |
| 391 | + ); | |
| 392 | + | |
| 393 | + Map<String, dynamic> toJson() => { | |
| 394 | + "avatar_url": avatarUrl, | |
| 395 | + "banner_url": bannerUrl, | |
| 396 | + "display_name": displayName, | |
| 397 | + "profile_url": profileUrl, | |
| 398 | + "twitter": twitter, | |
| 399 | + "username": usernameValues.reverse[username], | |
| 400 | + }; | |
| 401 | +} | |
| 402 | + | |
| 403 | +enum Username { | |
| 404 | + EMPTY, | |
| 405 | + THEDAILYSHOW, | |
| 406 | + STUDIOSORIGINALS, | |
| 407 | + DISNEYZOOTOPIA | |
| 408 | +} | |
| 409 | + | |
| 410 | +final usernameValues = EnumValues({ | |
| 411 | + "": Username.EMPTY, | |
| 412 | + "thedailyshow": Username.THEDAILYSHOW, | |
| 413 | + "studiosoriginals": Username.STUDIOSORIGINALS, | |
| 414 | + "disneyzootopia": Username.DISNEYZOOTOPIA | |
| 415 | +}); | |
| 416 | + | |
| 417 | +class Meta { | |
| 418 | + final String msg; | |
| 419 | + final String responseId; | |
| 420 | + final int status; | |
| 421 | + | |
| 422 | + Meta({ | |
| 423 | + required this.msg, | |
| 424 | + required this.responseId, | |
| 425 | + required this.status, | |
| 426 | + }); | |
| 427 | + | |
| 428 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 429 | + msg: json["msg"], | |
| 430 | + responseId: json["response_id"], | |
| 431 | + status: json["status"], | |
| 432 | + ); | |
| 433 | + | |
| 434 | + Map<String, dynamic> toJson() => { | |
| 435 | + "msg": msg, | |
| 436 | + "response_id": responseId, | |
| 437 | + "status": status, | |
| 438 | + }; | |
| 439 | +} | |
| 440 | + | |
| 441 | +class Pagination { | |
| 442 | + final int count; | |
| 443 | + final int offset; | |
| 444 | + final int totalCount; | |
| 445 | + | |
| 446 | + Pagination({ | |
| 447 | + required this.count, | |
| 448 | + required this.offset, | |
| 449 | + required this.totalCount, | |
| 450 | + }); | |
| 451 | + | |
| 452 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 453 | + count: json["count"], | |
| 454 | + offset: json["offset"], | |
| 455 | + totalCount: json["total_count"], | |
| 456 | + ); | |
| 457 | + | |
| 458 | + Map<String, dynamic> toJson() => { | |
| 459 | + "count": count, | |
| 460 | + "offset": offset, | |
| 461 | + "total_count": totalCount, | |
| 462 | + }; | |
| 463 | +} | |
| 464 | + | |
| 465 | +class EnumValues<T> { | |
| 466 | + Map<String, T> map; | |
| 467 | + late Map<T, String> reverseMap; | |
| 468 | + | |
| 469 | + EnumValues(this.map); | |
| 470 | + | |
| 471 | + Map<T, String> get reverse { | |
| 472 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 473 | + return reverseMap; | |
| 474 | + } | |
| 475 | +} |
Test case
1 generated file · +121 −0test/inputs/json/misc/13d8d.json
Adartdefault / TopLevel.dart+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String category; | |
| 13 | + final String context; | |
| 14 | + final int id; | |
| 15 | + final Location location; | |
| 16 | + final String locationSubtype; | |
| 17 | + final String locationType; | |
| 18 | + final String month; | |
| 19 | + final OutcomeStatus outcomeStatus; | |
| 20 | + final String persistentId; | |
| 21 | + | |
| 22 | + TopLevel({ | |
| 23 | + required this.category, | |
| 24 | + required this.context, | |
| 25 | + required this.id, | |
| 26 | + required this.location, | |
| 27 | + required this.locationSubtype, | |
| 28 | + required this.locationType, | |
| 29 | + required this.month, | |
| 30 | + required this.outcomeStatus, | |
| 31 | + required this.persistentId, | |
| 32 | + }); | |
| 33 | + | |
| 34 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 35 | + category: json["category"], | |
| 36 | + context: json["context"], | |
| 37 | + id: json["id"], | |
| 38 | + location: Location.fromJson(json["location"]), | |
| 39 | + locationSubtype: json["location_subtype"], | |
| 40 | + locationType: json["location_type"], | |
| 41 | + month: json["month"], | |
| 42 | + outcomeStatus: OutcomeStatus.fromJson(json["outcome_status"]), | |
| 43 | + persistentId: json["persistent_id"], | |
| 44 | + ); | |
| 45 | + | |
| 46 | + Map<String, dynamic> toJson() => { | |
| 47 | + "category": category, | |
| 48 | + "context": context, | |
| 49 | + "id": id, | |
| 50 | + "location": location.toJson(), | |
| 51 | + "location_subtype": locationSubtype, | |
| 52 | + "location_type": locationType, | |
| 53 | + "month": month, | |
| 54 | + "outcome_status": outcomeStatus.toJson(), | |
| 55 | + "persistent_id": persistentId, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Location { | |
| 60 | + final String latitude; | |
| 61 | + final String longitude; | |
| 62 | + final Street street; | |
| 63 | + | |
| 64 | + Location({ | |
| 65 | + required this.latitude, | |
| 66 | + required this.longitude, | |
| 67 | + required this.street, | |
| 68 | + }); | |
| 69 | + | |
| 70 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 71 | + latitude: json["latitude"], | |
| 72 | + longitude: json["longitude"], | |
| 73 | + street: Street.fromJson(json["street"]), | |
| 74 | + ); | |
| 75 | + | |
| 76 | + Map<String, dynamic> toJson() => { | |
| 77 | + "latitude": latitude, | |
| 78 | + "longitude": longitude, | |
| 79 | + "street": street.toJson(), | |
| 80 | + }; | |
| 81 | +} | |
| 82 | + | |
| 83 | +class Street { | |
| 84 | + final int id; | |
| 85 | + final String name; | |
| 86 | + | |
| 87 | + Street({ | |
| 88 | + required this.id, | |
| 89 | + required this.name, | |
| 90 | + }); | |
| 91 | + | |
| 92 | + factory Street.fromJson(Map<String, dynamic> json) => Street( | |
| 93 | + id: json["id"], | |
| 94 | + name: json["name"], | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "id": id, | |
| 99 | + "name": name, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class OutcomeStatus { | |
| 104 | + final String category; | |
| 105 | + final String date; | |
| 106 | + | |
| 107 | + OutcomeStatus({ | |
| 108 | + required this.category, | |
| 109 | + required this.date, | |
| 110 | + }); | |
| 111 | + | |
| 112 | + factory OutcomeStatus.fromJson(Map<String, dynamic> json) => OutcomeStatus( | |
| 113 | + category: json["category"], | |
| 114 | + date: json["date"], | |
| 115 | + ); | |
| 116 | + | |
| 117 | + Map<String, dynamic> toJson() => { | |
| 118 | + "category": category, | |
| 119 | + "date": date, | |
| 120 | + }; | |
| 121 | +} |
Test case
1 generated file · +53 −0test/inputs/json/misc/14d38.json
Adartdefault / TopLevel.dart+53 −0
| @@ -0,0 +1,53 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Headers headers; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.headers, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + headers: Headers.fromJson(json["headers"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "headers": headers.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Headers { | |
| 28 | + final String acceptEncoding; | |
| 29 | + final String connection; | |
| 30 | + final String host; | |
| 31 | + final String userAgent; | |
| 32 | + | |
| 33 | + Headers({ | |
| 34 | + required this.acceptEncoding, | |
| 35 | + required this.connection, | |
| 36 | + required this.host, | |
| 37 | + required this.userAgent, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Headers.fromJson(Map<String, dynamic> json) => Headers( | |
| 41 | + acceptEncoding: json["Accept-Encoding"], | |
| 42 | + connection: json["Connection"], | |
| 43 | + host: json["Host"], | |
| 44 | + userAgent: json["User-Agent"], | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "Accept-Encoding": acceptEncoding, | |
| 49 | + "Connection": connection, | |
| 50 | + "Host": host, | |
| 51 | + "User-Agent": userAgent, | |
| 52 | + }; | |
| 53 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/167d6.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/16bc5.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +125 −0test/inputs/json/misc/176f1.json
Adartdefault / TopLevel.dart+125 −0
| @@ -0,0 +1,125 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<dynamic> message; | |
| 13 | + final int responseTime; | |
| 14 | + final Results results; | |
| 15 | + final String status; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.message, | |
| 19 | + required this.responseTime, | |
| 20 | + required this.results, | |
| 21 | + required this.status, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + message: List<dynamic>.from(json["message"].map((x) => x)), | |
| 26 | + responseTime: json["responseTime"], | |
| 27 | + results: Results.fromJson(json["Results"]), | |
| 28 | + status: json["status"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "message": List<dynamic>.from(message.map((x) => x)), | |
| 33 | + "responseTime": responseTime, | |
| 34 | + "Results": results.toJson(), | |
| 35 | + "status": status, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Results { | |
| 40 | + final List<Series> series; | |
| 41 | + | |
| 42 | + Results({ | |
| 43 | + required this.series, | |
| 44 | + }); | |
| 45 | + | |
| 46 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 47 | + series: List<Series>.from(json["series"].map((x) => Series.fromJson(x))), | |
| 48 | + ); | |
| 49 | + | |
| 50 | + Map<String, dynamic> toJson() => { | |
| 51 | + "series": List<dynamic>.from(series.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Series { | |
| 56 | + final List<Datum> data; | |
| 57 | + final String seriesId; | |
| 58 | + | |
| 59 | + Series({ | |
| 60 | + required this.data, | |
| 61 | + required this.seriesId, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Series.fromJson(Map<String, dynamic> json) => Series( | |
| 65 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 66 | + seriesId: json["seriesID"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 71 | + "seriesID": seriesId, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Datum { | |
| 76 | + final List<Footnote> footnotes; | |
| 77 | + final String period; | |
| 78 | + final String periodName; | |
| 79 | + final String value; | |
| 80 | + final String year; | |
| 81 | + | |
| 82 | + Datum({ | |
| 83 | + required this.footnotes, | |
| 84 | + required this.period, | |
| 85 | + required this.periodName, | |
| 86 | + required this.value, | |
| 87 | + required this.year, | |
| 88 | + }); | |
| 89 | + | |
| 90 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 91 | + footnotes: List<Footnote>.from(json["footnotes"].map((x) => Footnote.fromJson(x))), | |
| 92 | + period: json["period"], | |
| 93 | + periodName: json["periodName"], | |
| 94 | + value: json["value"], | |
| 95 | + year: json["year"], | |
| 96 | + ); | |
| 97 | + | |
| 98 | + Map<String, dynamic> toJson() => { | |
| 99 | + "footnotes": List<dynamic>.from(footnotes.map((x) => x.toJson())), | |
| 100 | + "period": period, | |
| 101 | + "periodName": periodName, | |
| 102 | + "value": value, | |
| 103 | + "year": year, | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Footnote { | |
| 108 | + final String? code; | |
| 109 | + final String? text; | |
| 110 | + | |
| 111 | + Footnote({ | |
| 112 | + this.code, | |
| 113 | + this.text, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory Footnote.fromJson(Map<String, dynamic> json) => Footnote( | |
| 117 | + code: json["code"], | |
| 118 | + text: json["text"], | |
| 119 | + ); | |
| 120 | + | |
| 121 | + Map<String, dynamic> toJson() => { | |
| 122 | + "code": code, | |
| 123 | + "text": text, | |
| 124 | + }; | |
| 125 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/1a7f5.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/1b28c.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +353 −0test/inputs/json/misc/1b409.json
Adartdefault / TopLevel.dart+353 −0
| @@ -0,0 +1,353 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Meta meta; | |
| 13 | + final List<Object> objects; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.meta, | |
| 17 | + required this.objects, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + meta: Meta.fromJson(json["meta"]), | |
| 22 | + objects: List<Object>.from(json["objects"].map((x) => Object.fromJson(x))), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "meta": meta.toJson(), | |
| 27 | + "objects": List<dynamic>.from(objects.map((x) => x.toJson())), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final int limit; | |
| 33 | + final int offset; | |
| 34 | + final int totalCount; | |
| 35 | + | |
| 36 | + Meta({ | |
| 37 | + required this.limit, | |
| 38 | + required this.offset, | |
| 39 | + required this.totalCount, | |
| 40 | + }); | |
| 41 | + | |
| 42 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 43 | + limit: json["limit"], | |
| 44 | + offset: json["offset"], | |
| 45 | + totalCount: json["total_count"], | |
| 46 | + ); | |
| 47 | + | |
| 48 | + Map<String, dynamic> toJson() => { | |
| 49 | + "limit": limit, | |
| 50 | + "offset": offset, | |
| 51 | + "total_count": totalCount, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Object { | |
| 56 | + final dynamic caucus; | |
| 57 | + final List<int> congressNumbers; | |
| 58 | + final bool current; | |
| 59 | + final String description; | |
| 60 | + final int district; | |
| 61 | + final DateTime enddate; | |
| 62 | + final Extra extra; | |
| 63 | + final int id; | |
| 64 | + final String? leadershipTitle; | |
| 65 | + final Party party; | |
| 66 | + final Person person; | |
| 67 | + final String phone; | |
| 68 | + final RoleType roleType; | |
| 69 | + final RoleTypeLabel roleTypeLabel; | |
| 70 | + final dynamic senatorClass; | |
| 71 | + final dynamic senatorRank; | |
| 72 | + final DateTime startdate; | |
| 73 | + final String state; | |
| 74 | + final Title title; | |
| 75 | + final RoleTypeLabel titleLong; | |
| 76 | + final String website; | |
| 77 | + | |
| 78 | + Object({ | |
| 79 | + required this.caucus, | |
| 80 | + required this.congressNumbers, | |
| 81 | + required this.current, | |
| 82 | + required this.description, | |
| 83 | + required this.district, | |
| 84 | + required this.enddate, | |
| 85 | + required this.extra, | |
| 86 | + required this.id, | |
| 87 | + required this.leadershipTitle, | |
| 88 | + required this.party, | |
| 89 | + required this.person, | |
| 90 | + required this.phone, | |
| 91 | + required this.roleType, | |
| 92 | + required this.roleTypeLabel, | |
| 93 | + required this.senatorClass, | |
| 94 | + required this.senatorRank, | |
| 95 | + required this.startdate, | |
| 96 | + required this.state, | |
| 97 | + required this.title, | |
| 98 | + required this.titleLong, | |
| 99 | + required this.website, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Object.fromJson(Map<String, dynamic> json) => Object( | |
| 103 | + caucus: json["caucus"], | |
| 104 | + congressNumbers: List<int>.from(json["congress_numbers"].map((x) => x)), | |
| 105 | + current: json["current"], | |
| 106 | + description: json["description"], | |
| 107 | + district: json["district"], | |
| 108 | + enddate: DateTime.parse(json["enddate"]), | |
| 109 | + extra: Extra.fromJson(json["extra"]), | |
| 110 | + id: json["id"], | |
| 111 | + leadershipTitle: json["leadership_title"], | |
| 112 | + party: partyValues.map[json["party"]]!, | |
| 113 | + person: Person.fromJson(json["person"]), | |
| 114 | + phone: json["phone"], | |
| 115 | + roleType: roleTypeValues.map[json["role_type"]]!, | |
| 116 | + roleTypeLabel: roleTypeLabelValues.map[json["role_type_label"]]!, | |
| 117 | + senatorClass: json["senator_class"], | |
| 118 | + senatorRank: json["senator_rank"], | |
| 119 | + startdate: DateTime.parse(json["startdate"]), | |
| 120 | + state: json["state"], | |
| 121 | + title: titleValues.map[json["title"]]!, | |
| 122 | + titleLong: roleTypeLabelValues.map[json["title_long"]]!, | |
| 123 | + website: json["website"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "caucus": caucus, | |
| 128 | + "congress_numbers": List<dynamic>.from(congressNumbers.map((x) => x)), | |
| 129 | + "current": current, | |
| 130 | + "description": description, | |
| 131 | + "district": district, | |
| 132 | + "enddate": "${enddate.year.toString().padLeft(4, '0')}-${enddate.month.toString().padLeft(2, '0')}-${enddate.day.toString().padLeft(2, '0')}", | |
| 133 | + "extra": extra.toJson(), | |
| 134 | + "id": id, | |
| 135 | + "leadership_title": leadershipTitle, | |
| 136 | + "party": partyValues.reverse[party], | |
| 137 | + "person": person.toJson(), | |
| 138 | + "phone": phone, | |
| 139 | + "role_type": roleTypeValues.reverse[roleType], | |
| 140 | + "role_type_label": roleTypeLabelValues.reverse[roleTypeLabel], | |
| 141 | + "senator_class": senatorClass, | |
| 142 | + "senator_rank": senatorRank, | |
| 143 | + "startdate": "${startdate.year.toString().padLeft(4, '0')}-${startdate.month.toString().padLeft(2, '0')}-${startdate.day.toString().padLeft(2, '0')}", | |
| 144 | + "state": state, | |
| 145 | + "title": titleValues.reverse[title], | |
| 146 | + "title_long": roleTypeLabelValues.reverse[titleLong], | |
| 147 | + "website": website, | |
| 148 | + }; | |
| 149 | +} | |
| 150 | + | |
| 151 | +class Extra { | |
| 152 | + final String address; | |
| 153 | + final String? contactForm; | |
| 154 | + final String? fax; | |
| 155 | + final String office; | |
| 156 | + final String? rssUrl; | |
| 157 | + | |
| 158 | + Extra({ | |
| 159 | + required this.address, | |
| 160 | + this.contactForm, | |
| 161 | + this.fax, | |
| 162 | + required this.office, | |
| 163 | + this.rssUrl, | |
| 164 | + }); | |
| 165 | + | |
| 166 | + factory Extra.fromJson(Map<String, dynamic> json) => Extra( | |
| 167 | + address: json["address"], | |
| 168 | + contactForm: json["contact_form"], | |
| 169 | + fax: json["fax"], | |
| 170 | + office: json["office"], | |
| 171 | + rssUrl: json["rss_url"], | |
| 172 | + ); | |
| 173 | + | |
| 174 | + Map<String, dynamic> toJson() => { | |
| 175 | + "address": address, | |
| 176 | + "contact_form": contactForm, | |
| 177 | + "fax": fax, | |
| 178 | + "office": office, | |
| 179 | + "rss_url": rssUrl, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +enum Party { | |
| 184 | + REPUBLICAN, | |
| 185 | + DEMOCRAT | |
| 186 | +} | |
| 187 | + | |
| 188 | +final partyValues = EnumValues({ | |
| 189 | + "Republican": Party.REPUBLICAN, | |
| 190 | + "Democrat": Party.DEMOCRAT | |
| 191 | +}); | |
| 192 | + | |
| 193 | +class Person { | |
| 194 | + final String bioguideid; | |
| 195 | + final DateTime birthday; | |
| 196 | + final int cspanid; | |
| 197 | + final String firstname; | |
| 198 | + final Gender gender; | |
| 199 | + final GenderLabel genderLabel; | |
| 200 | + final int id; | |
| 201 | + final String lastname; | |
| 202 | + final String link; | |
| 203 | + final String middlename; | |
| 204 | + final String name; | |
| 205 | + final Namemod namemod; | |
| 206 | + final String nickname; | |
| 207 | + final String osid; | |
| 208 | + final String? pvsid; | |
| 209 | + final String sortname; | |
| 210 | + final String? twitterid; | |
| 211 | + final String? youtubeid; | |
| 212 | + | |
| 213 | + Person({ | |
| 214 | + required this.bioguideid, | |
| 215 | + required this.birthday, | |
| 216 | + required this.cspanid, | |
| 217 | + required this.firstname, | |
| 218 | + required this.gender, | |
| 219 | + required this.genderLabel, | |
| 220 | + required this.id, | |
| 221 | + required this.lastname, | |
| 222 | + required this.link, | |
| 223 | + required this.middlename, | |
| 224 | + required this.name, | |
| 225 | + required this.namemod, | |
| 226 | + required this.nickname, | |
| 227 | + required this.osid, | |
| 228 | + required this.pvsid, | |
| 229 | + required this.sortname, | |
| 230 | + required this.twitterid, | |
| 231 | + required this.youtubeid, | |
| 232 | + }); | |
| 233 | + | |
| 234 | + factory Person.fromJson(Map<String, dynamic> json) => Person( | |
| 235 | + bioguideid: json["bioguideid"], | |
| 236 | + birthday: DateTime.parse(json["birthday"]), | |
| 237 | + cspanid: json["cspanid"], | |
| 238 | + firstname: json["firstname"], | |
| 239 | + gender: genderValues.map[json["gender"]]!, | |
| 240 | + genderLabel: genderLabelValues.map[json["gender_label"]]!, | |
| 241 | + id: json["id"], | |
| 242 | + lastname: json["lastname"], | |
| 243 | + link: json["link"], | |
| 244 | + middlename: json["middlename"], | |
| 245 | + name: json["name"], | |
| 246 | + namemod: namemodValues.map[json["namemod"]]!, | |
| 247 | + nickname: json["nickname"], | |
| 248 | + osid: json["osid"], | |
| 249 | + pvsid: json["pvsid"], | |
| 250 | + sortname: json["sortname"], | |
| 251 | + twitterid: json["twitterid"], | |
| 252 | + youtubeid: json["youtubeid"], | |
| 253 | + ); | |
| 254 | + | |
| 255 | + Map<String, dynamic> toJson() => { | |
| 256 | + "bioguideid": bioguideid, | |
| 257 | + "birthday": "${birthday.year.toString().padLeft(4, '0')}-${birthday.month.toString().padLeft(2, '0')}-${birthday.day.toString().padLeft(2, '0')}", | |
| 258 | + "cspanid": cspanid, | |
| 259 | + "firstname": firstname, | |
| 260 | + "gender": genderValues.reverse[gender], | |
| 261 | + "gender_label": genderLabelValues.reverse[genderLabel], | |
| 262 | + "id": id, | |
| 263 | + "lastname": lastname, | |
| 264 | + "link": link, | |
| 265 | + "middlename": middlename, | |
| 266 | + "name": name, | |
| 267 | + "namemod": namemodValues.reverse[namemod], | |
| 268 | + "nickname": nickname, | |
| 269 | + "osid": osid, | |
| 270 | + "pvsid": pvsid, | |
| 271 | + "sortname": sortname, | |
| 272 | + "twitterid": twitterid, | |
| 273 | + "youtubeid": youtubeid, | |
| 274 | + }; | |
| 275 | +} | |
| 276 | + | |
| 277 | +enum Gender { | |
| 278 | + MALE, | |
| 279 | + FEMALE | |
| 280 | +} | |
| 281 | + | |
| 282 | +final genderValues = EnumValues({ | |
| 283 | + "male": Gender.MALE, | |
| 284 | + "female": Gender.FEMALE | |
| 285 | +}); | |
| 286 | + | |
| 287 | +enum GenderLabel { | |
| 288 | + MALE, | |
| 289 | + FEMALE | |
| 290 | +} | |
| 291 | + | |
| 292 | +final genderLabelValues = EnumValues({ | |
| 293 | + "Male": GenderLabel.MALE, | |
| 294 | + "Female": GenderLabel.FEMALE | |
| 295 | +}); | |
| 296 | + | |
| 297 | +enum Namemod { | |
| 298 | + EMPTY, | |
| 299 | + JR, | |
| 300 | + II, | |
| 301 | + III, | |
| 302 | + IV | |
| 303 | +} | |
| 304 | + | |
| 305 | +final namemodValues = EnumValues({ | |
| 306 | + "": Namemod.EMPTY, | |
| 307 | + "Jr.": Namemod.JR, | |
| 308 | + "II": Namemod.II, | |
| 309 | + "III": Namemod.III, | |
| 310 | + "IV": Namemod.IV | |
| 311 | +}); | |
| 312 | + | |
| 313 | +enum RoleType { | |
| 314 | + REPRESENTATIVE | |
| 315 | +} | |
| 316 | + | |
| 317 | +final roleTypeValues = EnumValues({ | |
| 318 | + "representative": RoleType.REPRESENTATIVE | |
| 319 | +}); | |
| 320 | + | |
| 321 | +enum RoleTypeLabel { | |
| 322 | + REPRESENTATIVE, | |
| 323 | + DELEGATE, | |
| 324 | + RESIDENT_COMMISSIONER | |
| 325 | +} | |
| 326 | + | |
| 327 | +final roleTypeLabelValues = EnumValues({ | |
| 328 | + "Representative": RoleTypeLabel.REPRESENTATIVE, | |
| 329 | + "Delegate": RoleTypeLabel.DELEGATE, | |
| 330 | + "Resident Commissioner": RoleTypeLabel.RESIDENT_COMMISSIONER | |
| 331 | +}); | |
| 332 | + | |
| 333 | +enum Title { | |
| 334 | + REP, | |
| 335 | + COMMISH | |
| 336 | +} | |
| 337 | + | |
| 338 | +final titleValues = EnumValues({ | |
| 339 | + "Rep.": Title.REP, | |
| 340 | + "Commish.": Title.COMMISH | |
| 341 | +}); | |
| 342 | + | |
| 343 | +class EnumValues<T> { | |
| 344 | + Map<String, T> map; | |
| 345 | + late Map<T, String> reverseMap; | |
| 346 | + | |
| 347 | + EnumValues(this.map); | |
| 348 | + | |
| 349 | + Map<T, String> get reverse { | |
| 350 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 351 | + return reverseMap; | |
| 352 | + } | |
| 353 | +} |
Test case
1 generated file · +317 −0test/inputs/json/misc/2465e.json
Adartdefault / TopLevel.dart+317 −0
| @@ -0,0 +1,317 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String basePath; | |
| 13 | + final Definitions definitions; | |
| 14 | + final String host; | |
| 15 | + final Info info; | |
| 16 | + final Paths paths; | |
| 17 | + final List<String> produces; | |
| 18 | + final List<String> schemes; | |
| 19 | + final String swagger; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.basePath, | |
| 23 | + required this.definitions, | |
| 24 | + required this.host, | |
| 25 | + required this.info, | |
| 26 | + required this.paths, | |
| 27 | + required this.produces, | |
| 28 | + required this.schemes, | |
| 29 | + required this.swagger, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + basePath: json["basePath"], | |
| 34 | + definitions: Definitions.fromJson(json["definitions"]), | |
| 35 | + host: json["host"], | |
| 36 | + info: Info.fromJson(json["info"]), | |
| 37 | + paths: Paths.fromJson(json["paths"]), | |
| 38 | + produces: List<String>.from(json["produces"].map((x) => x)), | |
| 39 | + schemes: List<String>.from(json["schemes"].map((x) => x)), | |
| 40 | + swagger: json["swagger"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "basePath": basePath, | |
| 45 | + "definitions": definitions.toJson(), | |
| 46 | + "host": host, | |
| 47 | + "info": info.toJson(), | |
| 48 | + "paths": paths.toJson(), | |
| 49 | + "produces": List<dynamic>.from(produces.map((x) => x)), | |
| 50 | + "schemes": List<dynamic>.from(schemes.map((x) => x)), | |
| 51 | + "swagger": swagger, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Definitions { | |
| 56 | + final Taxonomy taxonomy; | |
| 57 | + | |
| 58 | + Definitions({ | |
| 59 | + required this.taxonomy, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Definitions.fromJson(Map<String, dynamic> json) => Definitions( | |
| 63 | + taxonomy: Taxonomy.fromJson(json["Taxonomy"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "Taxonomy": taxonomy.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Taxonomy { | |
| 72 | + final Properties properties; | |
| 73 | + | |
| 74 | + Taxonomy({ | |
| 75 | + required this.properties, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Taxonomy.fromJson(Map<String, dynamic> json) => Taxonomy( | |
| 79 | + properties: Properties.fromJson(json["properties"]), | |
| 80 | + ); | |
| 81 | + | |
| 82 | + Map<String, dynamic> toJson() => { | |
| 83 | + "properties": properties.toJson(), | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class Properties { | |
| 88 | + final Annotations annotations; | |
| 89 | + final Annotations datatypeProperties; | |
| 90 | + final Annotations id; | |
| 91 | + final Annotations label; | |
| 92 | + final Annotations subClassOf; | |
| 93 | + final Annotations type; | |
| 94 | + | |
| 95 | + Properties({ | |
| 96 | + required this.annotations, | |
| 97 | + required this.datatypeProperties, | |
| 98 | + required this.id, | |
| 99 | + required this.label, | |
| 100 | + required this.subClassOf, | |
| 101 | + required this.type, | |
| 102 | + }); | |
| 103 | + | |
| 104 | + factory Properties.fromJson(Map<String, dynamic> json) => Properties( | |
| 105 | + annotations: Annotations.fromJson(json["annotations"]), | |
| 106 | + datatypeProperties: Annotations.fromJson(json["datatype_properties"]), | |
| 107 | + id: Annotations.fromJson(json["id"]), | |
| 108 | + label: Annotations.fromJson(json["label"]), | |
| 109 | + subClassOf: Annotations.fromJson(json["sub_class_of"]), | |
| 110 | + type: Annotations.fromJson(json["type"]), | |
| 111 | + ); | |
| 112 | + | |
| 113 | + Map<String, dynamic> toJson() => { | |
| 114 | + "annotations": annotations.toJson(), | |
| 115 | + "datatype_properties": datatypeProperties.toJson(), | |
| 116 | + "id": id.toJson(), | |
| 117 | + "label": label.toJson(), | |
| 118 | + "sub_class_of": subClassOf.toJson(), | |
| 119 | + "type": type.toJson(), | |
| 120 | + }; | |
| 121 | +} | |
| 122 | + | |
| 123 | +class Annotations { | |
| 124 | + final String description; | |
| 125 | + final String type; | |
| 126 | + | |
| 127 | + Annotations({ | |
| 128 | + required this.description, | |
| 129 | + required this.type, | |
| 130 | + }); | |
| 131 | + | |
| 132 | + factory Annotations.fromJson(Map<String, dynamic> json) => Annotations( | |
| 133 | + description: json["description"], | |
| 134 | + type: json["type"], | |
| 135 | + ); | |
| 136 | + | |
| 137 | + Map<String, dynamic> toJson() => { | |
| 138 | + "description": description, | |
| 139 | + "type": type, | |
| 140 | + }; | |
| 141 | +} | |
| 142 | + | |
| 143 | +class Info { | |
| 144 | + final String description; | |
| 145 | + final String title; | |
| 146 | + final String version; | |
| 147 | + | |
| 148 | + Info({ | |
| 149 | + required this.description, | |
| 150 | + required this.title, | |
| 151 | + required this.version, | |
| 152 | + }); | |
| 153 | + | |
| 154 | + factory Info.fromJson(Map<String, dynamic> json) => Info( | |
| 155 | + description: json["description"], | |
| 156 | + title: json["title"], | |
| 157 | + version: json["version"], | |
| 158 | + ); | |
| 159 | + | |
| 160 | + Map<String, dynamic> toJson() => { | |
| 161 | + "description": description, | |
| 162 | + "title": title, | |
| 163 | + "version": version, | |
| 164 | + }; | |
| 165 | +} | |
| 166 | + | |
| 167 | +class Paths { | |
| 168 | + final ItaTaxonomiesSearch itaTaxonomiesSearch; | |
| 169 | + | |
| 170 | + Paths({ | |
| 171 | + required this.itaTaxonomiesSearch, | |
| 172 | + }); | |
| 173 | + | |
| 174 | + factory Paths.fromJson(Map<String, dynamic> json) => Paths( | |
| 175 | + itaTaxonomiesSearch: ItaTaxonomiesSearch.fromJson(json["/ita_taxonomies/search"]), | |
| 176 | + ); | |
| 177 | + | |
| 178 | + Map<String, dynamic> toJson() => { | |
| 179 | + "/ita_taxonomies/search": itaTaxonomiesSearch.toJson(), | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class ItaTaxonomiesSearch { | |
| 184 | + final Get itaTaxonomiesSearchGet; | |
| 185 | + | |
| 186 | + ItaTaxonomiesSearch({ | |
| 187 | + required this.itaTaxonomiesSearchGet, | |
| 188 | + }); | |
| 189 | + | |
| 190 | + factory ItaTaxonomiesSearch.fromJson(Map<String, dynamic> json) => ItaTaxonomiesSearch( | |
| 191 | + itaTaxonomiesSearchGet: Get.fromJson(json["get"]), | |
| 192 | + ); | |
| 193 | + | |
| 194 | + Map<String, dynamic> toJson() => { | |
| 195 | + "get": itaTaxonomiesSearchGet.toJson(), | |
| 196 | + }; | |
| 197 | +} | |
| 198 | + | |
| 199 | +class Get { | |
| 200 | + final String description; | |
| 201 | + final List<Parameter> parameters; | |
| 202 | + final Responses responses; | |
| 203 | + final String summary; | |
| 204 | + final List<String> tags; | |
| 205 | + | |
| 206 | + Get({ | |
| 207 | + required this.description, | |
| 208 | + required this.parameters, | |
| 209 | + required this.responses, | |
| 210 | + required this.summary, | |
| 211 | + required this.tags, | |
| 212 | + }); | |
| 213 | + | |
| 214 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 215 | + description: json["description"], | |
| 216 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 217 | + responses: Responses.fromJson(json["responses"]), | |
| 218 | + summary: json["summary"], | |
| 219 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 220 | + ); | |
| 221 | + | |
| 222 | + Map<String, dynamic> toJson() => { | |
| 223 | + "description": description, | |
| 224 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 225 | + "responses": responses.toJson(), | |
| 226 | + "summary": summary, | |
| 227 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 228 | + }; | |
| 229 | +} | |
| 230 | + | |
| 231 | +class Parameter { | |
| 232 | + final String description; | |
| 233 | + final String format; | |
| 234 | + final String name; | |
| 235 | + final String parameterIn; | |
| 236 | + final bool required; | |
| 237 | + final String type; | |
| 238 | + | |
| 239 | + Parameter({ | |
| 240 | + required this.description, | |
| 241 | + required this.format, | |
| 242 | + required this.name, | |
| 243 | + required this.parameterIn, | |
| 244 | + required this.required, | |
| 245 | + required this.type, | |
| 246 | + }); | |
| 247 | + | |
| 248 | + factory Parameter.fromJson(Map<String, dynamic> json) => Parameter( | |
| 249 | + description: json["description"], | |
| 250 | + format: json["format"], | |
| 251 | + name: json["name"], | |
| 252 | + parameterIn: json["in"], | |
| 253 | + required: json["required"], | |
| 254 | + type: json["type"], | |
| 255 | + ); | |
| 256 | + | |
| 257 | + Map<String, dynamic> toJson() => { | |
| 258 | + "description": description, | |
| 259 | + "format": format, | |
| 260 | + "name": name, | |
| 261 | + "in": parameterIn, | |
| 262 | + "required": required, | |
| 263 | + "type": type, | |
| 264 | + }; | |
| 265 | +} | |
| 266 | + | |
| 267 | +class Responses { | |
| 268 | + final The200 the200; | |
| 269 | + | |
| 270 | + Responses({ | |
| 271 | + required this.the200, | |
| 272 | + }); | |
| 273 | + | |
| 274 | + factory Responses.fromJson(Map<String, dynamic> json) => Responses( | |
| 275 | + the200: The200.fromJson(json["200"]), | |
| 276 | + ); | |
| 277 | + | |
| 278 | + Map<String, dynamic> toJson() => { | |
| 279 | + "200": the200.toJson(), | |
| 280 | + }; | |
| 281 | +} | |
| 282 | + | |
| 283 | +class The200 { | |
| 284 | + final String description; | |
| 285 | + final Schema schema; | |
| 286 | + | |
| 287 | + The200({ | |
| 288 | + required this.description, | |
| 289 | + required this.schema, | |
| 290 | + }); | |
| 291 | + | |
| 292 | + factory The200.fromJson(Map<String, dynamic> json) => The200( | |
| 293 | + description: json["description"], | |
| 294 | + schema: Schema.fromJson(json["schema"]), | |
| 295 | + ); | |
| 296 | + | |
| 297 | + Map<String, dynamic> toJson() => { | |
| 298 | + "description": description, | |
| 299 | + "schema": schema.toJson(), | |
| 300 | + }; | |
| 301 | +} | |
| 302 | + | |
| 303 | +class Schema { | |
| 304 | + final String ref; | |
| 305 | + | |
| 306 | + Schema({ | |
| 307 | + required this.ref, | |
| 308 | + }); | |
| 309 | + | |
| 310 | + factory Schema.fromJson(Map<String, dynamic> json) => Schema( | |
| 311 | + ref: json["\u0024ref"], | |
| 312 | + ); | |
| 313 | + | |
| 314 | + Map<String, dynamic> toJson() => { | |
| 315 | + "\u0024ref": ref, | |
| 316 | + }; | |
| 317 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/24f52.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +441 −0test/inputs/json/misc/262f0.json
Adartdefault / TopLevel.dart+441 −0
| @@ -0,0 +1,441 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final Text text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: textValues.map[json["text"]]!, | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": textValues.reverse[text], | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +enum Text { | |
| 292 | + MOSTLY_CLOUDY, | |
| 293 | + RAIN, | |
| 294 | + PARTLY_CLOUDY | |
| 295 | +} | |
| 296 | + | |
| 297 | +final textValues = EnumValues({ | |
| 298 | + "Mostly Cloudy": Text.MOSTLY_CLOUDY, | |
| 299 | + "Rain": Text.RAIN, | |
| 300 | + "Partly Cloudy": Text.PARTLY_CLOUDY | |
| 301 | +}); | |
| 302 | + | |
| 303 | +class Forecast { | |
| 304 | + final String code; | |
| 305 | + final String date; | |
| 306 | + final String day; | |
| 307 | + final String high; | |
| 308 | + final String low; | |
| 309 | + final Text text; | |
| 310 | + | |
| 311 | + Forecast({ | |
| 312 | + required this.code, | |
| 313 | + required this.date, | |
| 314 | + required this.day, | |
| 315 | + required this.high, | |
| 316 | + required this.low, | |
| 317 | + required this.text, | |
| 318 | + }); | |
| 319 | + | |
| 320 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 321 | + code: json["code"], | |
| 322 | + date: json["date"], | |
| 323 | + day: json["day"], | |
| 324 | + high: json["high"], | |
| 325 | + low: json["low"], | |
| 326 | + text: textValues.map[json["text"]]!, | |
| 327 | + ); | |
| 328 | + | |
| 329 | + Map<String, dynamic> toJson() => { | |
| 330 | + "code": code, | |
| 331 | + "date": date, | |
| 332 | + "day": day, | |
| 333 | + "high": high, | |
| 334 | + "low": low, | |
| 335 | + "text": textValues.reverse[text], | |
| 336 | + }; | |
| 337 | +} | |
| 338 | + | |
| 339 | +class Guid { | |
| 340 | + final String isPermaLink; | |
| 341 | + | |
| 342 | + Guid({ | |
| 343 | + required this.isPermaLink, | |
| 344 | + }); | |
| 345 | + | |
| 346 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 347 | + isPermaLink: json["isPermaLink"], | |
| 348 | + ); | |
| 349 | + | |
| 350 | + Map<String, dynamic> toJson() => { | |
| 351 | + "isPermaLink": isPermaLink, | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +class Location { | |
| 356 | + final String city; | |
| 357 | + final String country; | |
| 358 | + final String region; | |
| 359 | + | |
| 360 | + Location({ | |
| 361 | + required this.city, | |
| 362 | + required this.country, | |
| 363 | + required this.region, | |
| 364 | + }); | |
| 365 | + | |
| 366 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 367 | + city: json["city"], | |
| 368 | + country: json["country"], | |
| 369 | + region: json["region"], | |
| 370 | + ); | |
| 371 | + | |
| 372 | + Map<String, dynamic> toJson() => { | |
| 373 | + "city": city, | |
| 374 | + "country": country, | |
| 375 | + "region": region, | |
| 376 | + }; | |
| 377 | +} | |
| 378 | + | |
| 379 | +class Units { | |
| 380 | + final String distance; | |
| 381 | + final String pressure; | |
| 382 | + final String speed; | |
| 383 | + final String temperature; | |
| 384 | + | |
| 385 | + Units({ | |
| 386 | + required this.distance, | |
| 387 | + required this.pressure, | |
| 388 | + required this.speed, | |
| 389 | + required this.temperature, | |
| 390 | + }); | |
| 391 | + | |
| 392 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 393 | + distance: json["distance"], | |
| 394 | + pressure: json["pressure"], | |
| 395 | + speed: json["speed"], | |
| 396 | + temperature: json["temperature"], | |
| 397 | + ); | |
| 398 | + | |
| 399 | + Map<String, dynamic> toJson() => { | |
| 400 | + "distance": distance, | |
| 401 | + "pressure": pressure, | |
| 402 | + "speed": speed, | |
| 403 | + "temperature": temperature, | |
| 404 | + }; | |
| 405 | +} | |
| 406 | + | |
| 407 | +class Wind { | |
| 408 | + final String chill; | |
| 409 | + final String direction; | |
| 410 | + final String speed; | |
| 411 | + | |
| 412 | + Wind({ | |
| 413 | + required this.chill, | |
| 414 | + required this.direction, | |
| 415 | + required this.speed, | |
| 416 | + }); | |
| 417 | + | |
| 418 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 419 | + chill: json["chill"], | |
| 420 | + direction: json["direction"], | |
| 421 | + speed: json["speed"], | |
| 422 | + ); | |
| 423 | + | |
| 424 | + Map<String, dynamic> toJson() => { | |
| 425 | + "chill": chill, | |
| 426 | + "direction": direction, | |
| 427 | + "speed": speed, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class EnumValues<T> { | |
| 432 | + Map<String, T> map; | |
| 433 | + late Map<T, String> reverseMap; | |
| 434 | + | |
| 435 | + EnumValues(this.map); | |
| 436 | + | |
| 437 | + Map<T, String> get reverse { | |
| 438 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 439 | + return reverseMap; | |
| 440 | + } | |
| 441 | +} |
Test case
1 generated file · +471 −0test/inputs/json/misc/26b49.json
Adartdefault / TopLevel.dart+471 −0
| @@ -0,0 +1,471 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final String username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: json["username"], | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": username, | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final DownsizedSmall? hd; | |
| 136 | + final Looping looping; | |
| 137 | + final FixedHeight original; | |
| 138 | + final DownsizedSmall originalMp4; | |
| 139 | + final Downsized originalStill; | |
| 140 | + final DownsizedSmall preview; | |
| 141 | + final Downsized previewGif; | |
| 142 | + final Downsized previewWebp; | |
| 143 | + final Downsized? the480WStill; | |
| 144 | + | |
| 145 | + Images({ | |
| 146 | + required this.downsized, | |
| 147 | + required this.downsizedLarge, | |
| 148 | + required this.downsizedMedium, | |
| 149 | + required this.downsizedSmall, | |
| 150 | + required this.downsizedStill, | |
| 151 | + required this.fixedHeight, | |
| 152 | + required this.fixedHeightDownsampled, | |
| 153 | + required this.fixedHeightSmall, | |
| 154 | + required this.fixedHeightSmallStill, | |
| 155 | + required this.fixedHeightStill, | |
| 156 | + required this.fixedWidth, | |
| 157 | + required this.fixedWidthDownsampled, | |
| 158 | + required this.fixedWidthSmall, | |
| 159 | + required this.fixedWidthSmallStill, | |
| 160 | + required this.fixedWidthStill, | |
| 161 | + this.hd, | |
| 162 | + required this.looping, | |
| 163 | + required this.original, | |
| 164 | + required this.originalMp4, | |
| 165 | + required this.originalStill, | |
| 166 | + required this.preview, | |
| 167 | + required this.previewGif, | |
| 168 | + required this.previewWebp, | |
| 169 | + this.the480WStill, | |
| 170 | + }); | |
| 171 | + | |
| 172 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 173 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 174 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 175 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 176 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 177 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 178 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 179 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 180 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 181 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 182 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 183 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 184 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 185 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 186 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 187 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 188 | + hd: json["hd"] == null ? null : DownsizedSmall.fromJson(json["hd"]), | |
| 189 | + looping: Looping.fromJson(json["looping"]), | |
| 190 | + original: FixedHeight.fromJson(json["original"]), | |
| 191 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 192 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 193 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 194 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 195 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 196 | + the480WStill: json["480w_still"] == null ? null : Downsized.fromJson(json["480w_still"]), | |
| 197 | + ); | |
| 198 | + | |
| 199 | + Map<String, dynamic> toJson() => { | |
| 200 | + "downsized": downsized.toJson(), | |
| 201 | + "downsized_large": downsizedLarge.toJson(), | |
| 202 | + "downsized_medium": downsizedMedium.toJson(), | |
| 203 | + "downsized_small": downsizedSmall.toJson(), | |
| 204 | + "downsized_still": downsizedStill.toJson(), | |
| 205 | + "fixed_height": fixedHeight.toJson(), | |
| 206 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 207 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 208 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 209 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 210 | + "fixed_width": fixedWidth.toJson(), | |
| 211 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 212 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 213 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 214 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 215 | + "hd": hd?.toJson(), | |
| 216 | + "looping": looping.toJson(), | |
| 217 | + "original": original.toJson(), | |
| 218 | + "original_mp4": originalMp4.toJson(), | |
| 219 | + "original_still": originalStill.toJson(), | |
| 220 | + "preview": preview.toJson(), | |
| 221 | + "preview_gif": previewGif.toJson(), | |
| 222 | + "preview_webp": previewWebp.toJson(), | |
| 223 | + "480w_still": the480WStill?.toJson(), | |
| 224 | + }; | |
| 225 | +} | |
| 226 | + | |
| 227 | +class Downsized { | |
| 228 | + final String height; | |
| 229 | + final String? size; | |
| 230 | + final String url; | |
| 231 | + final String width; | |
| 232 | + | |
| 233 | + Downsized({ | |
| 234 | + required this.height, | |
| 235 | + this.size, | |
| 236 | + required this.url, | |
| 237 | + required this.width, | |
| 238 | + }); | |
| 239 | + | |
| 240 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 241 | + height: json["height"], | |
| 242 | + size: json["size"], | |
| 243 | + url: json["url"], | |
| 244 | + width: json["width"], | |
| 245 | + ); | |
| 246 | + | |
| 247 | + Map<String, dynamic> toJson() => { | |
| 248 | + "height": height, | |
| 249 | + "size": size, | |
| 250 | + "url": url, | |
| 251 | + "width": width, | |
| 252 | + }; | |
| 253 | +} | |
| 254 | + | |
| 255 | +class DownsizedSmall { | |
| 256 | + final String height; | |
| 257 | + final String mp4; | |
| 258 | + final String mp4Size; | |
| 259 | + final String width; | |
| 260 | + | |
| 261 | + DownsizedSmall({ | |
| 262 | + required this.height, | |
| 263 | + required this.mp4, | |
| 264 | + required this.mp4Size, | |
| 265 | + required this.width, | |
| 266 | + }); | |
| 267 | + | |
| 268 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 269 | + height: json["height"], | |
| 270 | + mp4: json["mp4"], | |
| 271 | + mp4Size: json["mp4_size"], | |
| 272 | + width: json["width"], | |
| 273 | + ); | |
| 274 | + | |
| 275 | + Map<String, dynamic> toJson() => { | |
| 276 | + "height": height, | |
| 277 | + "mp4": mp4, | |
| 278 | + "mp4_size": mp4Size, | |
| 279 | + "width": width, | |
| 280 | + }; | |
| 281 | +} | |
| 282 | + | |
| 283 | +class FixedHeight { | |
| 284 | + final String? frames; | |
| 285 | + final String? hash; | |
| 286 | + final String height; | |
| 287 | + final String? mp4; | |
| 288 | + final String? mp4Size; | |
| 289 | + final String size; | |
| 290 | + final String url; | |
| 291 | + final String webp; | |
| 292 | + final String webpSize; | |
| 293 | + final String width; | |
| 294 | + | |
| 295 | + FixedHeight({ | |
| 296 | + this.frames, | |
| 297 | + this.hash, | |
| 298 | + required this.height, | |
| 299 | + this.mp4, | |
| 300 | + this.mp4Size, | |
| 301 | + required this.size, | |
| 302 | + required this.url, | |
| 303 | + required this.webp, | |
| 304 | + required this.webpSize, | |
| 305 | + required this.width, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 309 | + frames: json["frames"], | |
| 310 | + hash: json["hash"], | |
| 311 | + height: json["height"], | |
| 312 | + mp4: json["mp4"], | |
| 313 | + mp4Size: json["mp4_size"], | |
| 314 | + size: json["size"], | |
| 315 | + url: json["url"], | |
| 316 | + webp: json["webp"], | |
| 317 | + webpSize: json["webp_size"], | |
| 318 | + width: json["width"], | |
| 319 | + ); | |
| 320 | + | |
| 321 | + Map<String, dynamic> toJson() => { | |
| 322 | + "frames": frames, | |
| 323 | + "hash": hash, | |
| 324 | + "height": height, | |
| 325 | + "mp4": mp4, | |
| 326 | + "mp4_size": mp4Size, | |
| 327 | + "size": size, | |
| 328 | + "url": url, | |
| 329 | + "webp": webp, | |
| 330 | + "webp_size": webpSize, | |
| 331 | + "width": width, | |
| 332 | + }; | |
| 333 | +} | |
| 334 | + | |
| 335 | +class Looping { | |
| 336 | + final String mp4; | |
| 337 | + final String mp4Size; | |
| 338 | + | |
| 339 | + Looping({ | |
| 340 | + required this.mp4, | |
| 341 | + required this.mp4Size, | |
| 342 | + }); | |
| 343 | + | |
| 344 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 345 | + mp4: json["mp4"], | |
| 346 | + mp4Size: json["mp4_size"], | |
| 347 | + ); | |
| 348 | + | |
| 349 | + Map<String, dynamic> toJson() => { | |
| 350 | + "mp4": mp4, | |
| 351 | + "mp4_size": mp4Size, | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +enum Rating { | |
| 356 | + PG, | |
| 357 | + G, | |
| 358 | + PG_13, | |
| 359 | + Y | |
| 360 | +} | |
| 361 | + | |
| 362 | +final ratingValues = EnumValues({ | |
| 363 | + "pg": Rating.PG, | |
| 364 | + "g": Rating.G, | |
| 365 | + "pg-13": Rating.PG_13, | |
| 366 | + "y": Rating.Y | |
| 367 | +}); | |
| 368 | + | |
| 369 | +enum Type { | |
| 370 | + GIF | |
| 371 | +} | |
| 372 | + | |
| 373 | +final typeValues = EnumValues({ | |
| 374 | + "gif": Type.GIF | |
| 375 | +}); | |
| 376 | + | |
| 377 | +class User { | |
| 378 | + final String avatarUrl; | |
| 379 | + final String bannerUrl; | |
| 380 | + final String displayName; | |
| 381 | + final String profileUrl; | |
| 382 | + final String? twitter; | |
| 383 | + final String username; | |
| 384 | + | |
| 385 | + User({ | |
| 386 | + required this.avatarUrl, | |
| 387 | + required this.bannerUrl, | |
| 388 | + required this.displayName, | |
| 389 | + required this.profileUrl, | |
| 390 | + this.twitter, | |
| 391 | + required this.username, | |
| 392 | + }); | |
| 393 | + | |
| 394 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 395 | + avatarUrl: json["avatar_url"], | |
| 396 | + bannerUrl: json["banner_url"], | |
| 397 | + displayName: json["display_name"], | |
| 398 | + profileUrl: json["profile_url"], | |
| 399 | + twitter: json["twitter"], | |
| 400 | + username: json["username"], | |
| 401 | + ); | |
| 402 | + | |
| 403 | + Map<String, dynamic> toJson() => { | |
| 404 | + "avatar_url": avatarUrl, | |
| 405 | + "banner_url": bannerUrl, | |
| 406 | + "display_name": displayName, | |
| 407 | + "profile_url": profileUrl, | |
| 408 | + "twitter": twitter, | |
| 409 | + "username": username, | |
| 410 | + }; | |
| 411 | +} | |
| 412 | + | |
| 413 | +class Meta { | |
| 414 | + final String msg; | |
| 415 | + final String responseId; | |
| 416 | + final int status; | |
| 417 | + | |
| 418 | + Meta({ | |
| 419 | + required this.msg, | |
| 420 | + required this.responseId, | |
| 421 | + required this.status, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 425 | + msg: json["msg"], | |
| 426 | + responseId: json["response_id"], | |
| 427 | + status: json["status"], | |
| 428 | + ); | |
| 429 | + | |
| 430 | + Map<String, dynamic> toJson() => { | |
| 431 | + "msg": msg, | |
| 432 | + "response_id": responseId, | |
| 433 | + "status": status, | |
| 434 | + }; | |
| 435 | +} | |
| 436 | + | |
| 437 | +class Pagination { | |
| 438 | + final int count; | |
| 439 | + final int offset; | |
| 440 | + final int totalCount; | |
| 441 | + | |
| 442 | + Pagination({ | |
| 443 | + required this.count, | |
| 444 | + required this.offset, | |
| 445 | + required this.totalCount, | |
| 446 | + }); | |
| 447 | + | |
| 448 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 449 | + count: json["count"], | |
| 450 | + offset: json["offset"], | |
| 451 | + totalCount: json["total_count"], | |
| 452 | + ); | |
| 453 | + | |
| 454 | + Map<String, dynamic> toJson() => { | |
| 455 | + "count": count, | |
| 456 | + "offset": offset, | |
| 457 | + "total_count": totalCount, | |
| 458 | + }; | |
| 459 | +} | |
| 460 | + | |
| 461 | +class EnumValues<T> { | |
| 462 | + Map<String, T> map; | |
| 463 | + late Map<T, String> reverseMap; | |
| 464 | + | |
| 465 | + EnumValues(this.map); | |
| 466 | + | |
| 467 | + Map<T, String> get reverse { | |
| 468 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 469 | + return reverseMap; | |
| 470 | + } | |
| 471 | +} |
Test case
1 generated file · +765 −0test/inputs/json/misc/26c9c.json
Adartdefault / TopLevel.dart+765 −0
| @@ -0,0 +1,765 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final String attribution; | |
| 49 | + final String attributionLink; | |
| 50 | + final int averageRating; | |
| 51 | + final String category; | |
| 52 | + final List<Column> columns; | |
| 53 | + final int createdAt; | |
| 54 | + final String description; | |
| 55 | + final String displayType; | |
| 56 | + final int downloadCount; | |
| 57 | + final List<String> flags; | |
| 58 | + final List<Grant> grants; | |
| 59 | + final bool hideFromCatalog; | |
| 60 | + final bool hideFromDataJson; | |
| 61 | + final String id; | |
| 62 | + final int indexUpdatedAt; | |
| 63 | + final String locale; | |
| 64 | + final Metadata metadata; | |
| 65 | + final String name; | |
| 66 | + final bool newBackend; | |
| 67 | + final int numberOfComments; | |
| 68 | + final int oid; | |
| 69 | + final Owner owner; | |
| 70 | + final String provenance; | |
| 71 | + final bool publicationAppendEnabled; | |
| 72 | + final int publicationDate; | |
| 73 | + final int publicationGroup; | |
| 74 | + final String publicationStage; | |
| 75 | + final Query query; | |
| 76 | + final List<String> rights; | |
| 77 | + final int rowsUpdatedAt; | |
| 78 | + final String rowsUpdatedBy; | |
| 79 | + final Owner tableAuthor; | |
| 80 | + final int tableId; | |
| 81 | + final List<String> tags; | |
| 82 | + final int totalTimesRated; | |
| 83 | + final int viewCount; | |
| 84 | + final int viewLastModified; | |
| 85 | + final String viewType; | |
| 86 | + | |
| 87 | + View({ | |
| 88 | + required this.attribution, | |
| 89 | + required this.attributionLink, | |
| 90 | + required this.averageRating, | |
| 91 | + required this.category, | |
| 92 | + required this.columns, | |
| 93 | + required this.createdAt, | |
| 94 | + required this.description, | |
| 95 | + required this.displayType, | |
| 96 | + required this.downloadCount, | |
| 97 | + required this.flags, | |
| 98 | + required this.grants, | |
| 99 | + required this.hideFromCatalog, | |
| 100 | + required this.hideFromDataJson, | |
| 101 | + required this.id, | |
| 102 | + required this.indexUpdatedAt, | |
| 103 | + required this.locale, | |
| 104 | + required this.metadata, | |
| 105 | + required this.name, | |
| 106 | + required this.newBackend, | |
| 107 | + required this.numberOfComments, | |
| 108 | + required this.oid, | |
| 109 | + required this.owner, | |
| 110 | + required this.provenance, | |
| 111 | + required this.publicationAppendEnabled, | |
| 112 | + required this.publicationDate, | |
| 113 | + required this.publicationGroup, | |
| 114 | + required this.publicationStage, | |
| 115 | + required this.query, | |
| 116 | + required this.rights, | |
| 117 | + required this.rowsUpdatedAt, | |
| 118 | + required this.rowsUpdatedBy, | |
| 119 | + required this.tableAuthor, | |
| 120 | + required this.tableId, | |
| 121 | + required this.tags, | |
| 122 | + required this.totalTimesRated, | |
| 123 | + required this.viewCount, | |
| 124 | + required this.viewLastModified, | |
| 125 | + required this.viewType, | |
| 126 | + }); | |
| 127 | + | |
| 128 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 129 | + attribution: json["attribution"], | |
| 130 | + attributionLink: json["attributionLink"], | |
| 131 | + averageRating: json["averageRating"], | |
| 132 | + category: json["category"], | |
| 133 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 134 | + createdAt: json["createdAt"], | |
| 135 | + description: json["description"], | |
| 136 | + displayType: json["displayType"], | |
| 137 | + downloadCount: json["downloadCount"], | |
| 138 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 139 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 140 | + hideFromCatalog: json["hideFromCatalog"], | |
| 141 | + hideFromDataJson: json["hideFromDataJson"], | |
| 142 | + id: json["id"], | |
| 143 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 144 | + locale: json["locale"], | |
| 145 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 146 | + name: json["name"], | |
| 147 | + newBackend: json["newBackend"], | |
| 148 | + numberOfComments: json["numberOfComments"], | |
| 149 | + oid: json["oid"], | |
| 150 | + owner: Owner.fromJson(json["owner"]), | |
| 151 | + provenance: json["provenance"], | |
| 152 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 153 | + publicationDate: json["publicationDate"], | |
| 154 | + publicationGroup: json["publicationGroup"], | |
| 155 | + publicationStage: json["publicationStage"], | |
| 156 | + query: Query.fromJson(json["query"]), | |
| 157 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 158 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 159 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 160 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 161 | + tableId: json["tableId"], | |
| 162 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 163 | + totalTimesRated: json["totalTimesRated"], | |
| 164 | + viewCount: json["viewCount"], | |
| 165 | + viewLastModified: json["viewLastModified"], | |
| 166 | + viewType: json["viewType"], | |
| 167 | + ); | |
| 168 | + | |
| 169 | + Map<String, dynamic> toJson() => { | |
| 170 | + "attribution": attribution, | |
| 171 | + "attributionLink": attributionLink, | |
| 172 | + "averageRating": averageRating, | |
| 173 | + "category": category, | |
| 174 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 175 | + "createdAt": createdAt, | |
| 176 | + "description": description, | |
| 177 | + "displayType": displayType, | |
| 178 | + "downloadCount": downloadCount, | |
| 179 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 180 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 181 | + "hideFromCatalog": hideFromCatalog, | |
| 182 | + "hideFromDataJson": hideFromDataJson, | |
| 183 | + "id": id, | |
| 184 | + "indexUpdatedAt": indexUpdatedAt, | |
| 185 | + "locale": locale, | |
| 186 | + "metadata": metadata.toJson(), | |
| 187 | + "name": name, | |
| 188 | + "newBackend": newBackend, | |
| 189 | + "numberOfComments": numberOfComments, | |
| 190 | + "oid": oid, | |
| 191 | + "owner": owner.toJson(), | |
| 192 | + "provenance": provenance, | |
| 193 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 194 | + "publicationDate": publicationDate, | |
| 195 | + "publicationGroup": publicationGroup, | |
| 196 | + "publicationStage": publicationStage, | |
| 197 | + "query": query.toJson(), | |
| 198 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 199 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 200 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 201 | + "tableAuthor": tableAuthor.toJson(), | |
| 202 | + "tableId": tableId, | |
| 203 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 204 | + "totalTimesRated": totalTimesRated, | |
| 205 | + "viewCount": viewCount, | |
| 206 | + "viewLastModified": viewLastModified, | |
| 207 | + "viewType": viewType, | |
| 208 | + }; | |
| 209 | +} | |
| 210 | + | |
| 211 | +class Column { | |
| 212 | + final CachedContents? cachedContents; | |
| 213 | + final String dataTypeName; | |
| 214 | + final String fieldName; | |
| 215 | + final List<String>? flags; | |
| 216 | + final Format format; | |
| 217 | + final int id; | |
| 218 | + final String name; | |
| 219 | + final int position; | |
| 220 | + final String renderTypeName; | |
| 221 | + final int? tableColumnId; | |
| 222 | + final int? width; | |
| 223 | + | |
| 224 | + Column({ | |
| 225 | + this.cachedContents, | |
| 226 | + required this.dataTypeName, | |
| 227 | + required this.fieldName, | |
| 228 | + this.flags, | |
| 229 | + required this.format, | |
| 230 | + required this.id, | |
| 231 | + required this.name, | |
| 232 | + required this.position, | |
| 233 | + required this.renderTypeName, | |
| 234 | + this.tableColumnId, | |
| 235 | + this.width, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 239 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 240 | + dataTypeName: json["dataTypeName"], | |
| 241 | + fieldName: json["fieldName"], | |
| 242 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 243 | + format: Format.fromJson(json["format"]), | |
| 244 | + id: json["id"], | |
| 245 | + name: json["name"], | |
| 246 | + position: json["position"], | |
| 247 | + renderTypeName: json["renderTypeName"], | |
| 248 | + tableColumnId: json["tableColumnId"], | |
| 249 | + width: json["width"], | |
| 250 | + ); | |
| 251 | + | |
| 252 | + Map<String, dynamic> toJson() => { | |
| 253 | + "cachedContents": cachedContents?.toJson(), | |
| 254 | + "dataTypeName": dataTypeName, | |
| 255 | + "fieldName": fieldName, | |
| 256 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 257 | + "format": format.toJson(), | |
| 258 | + "id": id, | |
| 259 | + "name": name, | |
| 260 | + "position": position, | |
| 261 | + "renderTypeName": renderTypeName, | |
| 262 | + "tableColumnId": tableColumnId, | |
| 263 | + "width": width, | |
| 264 | + }; | |
| 265 | +} | |
| 266 | + | |
| 267 | +class CachedContents { | |
| 268 | + final String? average; | |
| 269 | + final int cachedContentsNull; | |
| 270 | + final String largest; | |
| 271 | + final int nonNull; | |
| 272 | + final String smallest; | |
| 273 | + final String? sum; | |
| 274 | + final List<Top> top; | |
| 275 | + | |
| 276 | + CachedContents({ | |
| 277 | + this.average, | |
| 278 | + required this.cachedContentsNull, | |
| 279 | + required this.largest, | |
| 280 | + required this.nonNull, | |
| 281 | + required this.smallest, | |
| 282 | + this.sum, | |
| 283 | + required this.top, | |
| 284 | + }); | |
| 285 | + | |
| 286 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 287 | + average: json["average"], | |
| 288 | + cachedContentsNull: json["null"], | |
| 289 | + largest: json["largest"], | |
| 290 | + nonNull: json["non_null"], | |
| 291 | + smallest: json["smallest"], | |
| 292 | + sum: json["sum"], | |
| 293 | + top: List<Top>.from(json["top"].map((x) => Top.fromJson(x))), | |
| 294 | + ); | |
| 295 | + | |
| 296 | + Map<String, dynamic> toJson() => { | |
| 297 | + "average": average, | |
| 298 | + "null": cachedContentsNull, | |
| 299 | + "largest": largest, | |
| 300 | + "non_null": nonNull, | |
| 301 | + "smallest": smallest, | |
| 302 | + "sum": sum, | |
| 303 | + "top": List<dynamic>.from(top.map((x) => x.toJson())), | |
| 304 | + }; | |
| 305 | +} | |
| 306 | + | |
| 307 | +class Top { | |
| 308 | + final int count; | |
| 309 | + final String item; | |
| 310 | + | |
| 311 | + Top({ | |
| 312 | + required this.count, | |
| 313 | + required this.item, | |
| 314 | + }); | |
| 315 | + | |
| 316 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 317 | + count: json["count"], | |
| 318 | + item: json["item"], | |
| 319 | + ); | |
| 320 | + | |
| 321 | + Map<String, dynamic> toJson() => { | |
| 322 | + "count": count, | |
| 323 | + "item": item, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Format { | |
| 328 | + final String? align; | |
| 329 | + final String? noCommas; | |
| 330 | + final String? precisionStyle; | |
| 331 | + final String? view; | |
| 332 | + | |
| 333 | + Format({ | |
| 334 | + this.align, | |
| 335 | + this.noCommas, | |
| 336 | + this.precisionStyle, | |
| 337 | + this.view, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Format.fromJson(Map<String, dynamic> json) => Format( | |
| 341 | + align: json["align"], | |
| 342 | + noCommas: json["noCommas"], | |
| 343 | + precisionStyle: json["precisionStyle"], | |
| 344 | + view: json["view"], | |
| 345 | + ); | |
| 346 | + | |
| 347 | + Map<String, dynamic> toJson() => { | |
| 348 | + "align": align, | |
| 349 | + "noCommas": noCommas, | |
| 350 | + "precisionStyle": precisionStyle, | |
| 351 | + "view": view, | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +class Grant { | |
| 356 | + final List<String> flags; | |
| 357 | + final bool inherited; | |
| 358 | + final String type; | |
| 359 | + | |
| 360 | + Grant({ | |
| 361 | + required this.flags, | |
| 362 | + required this.inherited, | |
| 363 | + required this.type, | |
| 364 | + }); | |
| 365 | + | |
| 366 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 367 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 368 | + inherited: json["inherited"], | |
| 369 | + type: json["type"], | |
| 370 | + ); | |
| 371 | + | |
| 372 | + Map<String, dynamic> toJson() => { | |
| 373 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 374 | + "inherited": inherited, | |
| 375 | + "type": type, | |
| 376 | + }; | |
| 377 | +} | |
| 378 | + | |
| 379 | +class Metadata { | |
| 380 | + final List<Attachment> attachments; | |
| 381 | + final List<String> availableDisplayTypes; | |
| 382 | + final CustomFields customFields; | |
| 383 | + final JsonQuery jsonQuery; | |
| 384 | + final String rdfSubject; | |
| 385 | + final RenderTypeConfig renderTypeConfig; | |
| 386 | + | |
| 387 | + Metadata({ | |
| 388 | + required this.attachments, | |
| 389 | + required this.availableDisplayTypes, | |
| 390 | + required this.customFields, | |
| 391 | + required this.jsonQuery, | |
| 392 | + required this.rdfSubject, | |
| 393 | + required this.renderTypeConfig, | |
| 394 | + }); | |
| 395 | + | |
| 396 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 397 | + attachments: List<Attachment>.from(json["attachments"].map((x) => Attachment.fromJson(x))), | |
| 398 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 399 | + customFields: CustomFields.fromJson(json["custom_fields"]), | |
| 400 | + jsonQuery: JsonQuery.fromJson(json["jsonQuery"]), | |
| 401 | + rdfSubject: json["rdfSubject"], | |
| 402 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 403 | + ); | |
| 404 | + | |
| 405 | + Map<String, dynamic> toJson() => { | |
| 406 | + "attachments": List<dynamic>.from(attachments.map((x) => x.toJson())), | |
| 407 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 408 | + "custom_fields": customFields.toJson(), | |
| 409 | + "jsonQuery": jsonQuery.toJson(), | |
| 410 | + "rdfSubject": rdfSubject, | |
| 411 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 412 | + }; | |
| 413 | +} | |
| 414 | + | |
| 415 | +class Attachment { | |
| 416 | + final String assetId; | |
| 417 | + final String blobId; | |
| 418 | + final String filename; | |
| 419 | + final String name; | |
| 420 | + | |
| 421 | + Attachment({ | |
| 422 | + required this.assetId, | |
| 423 | + required this.blobId, | |
| 424 | + required this.filename, | |
| 425 | + required this.name, | |
| 426 | + }); | |
| 427 | + | |
| 428 | + factory Attachment.fromJson(Map<String, dynamic> json) => Attachment( | |
| 429 | + assetId: json["assetId"], | |
| 430 | + blobId: json["blobId"], | |
| 431 | + filename: json["filename"], | |
| 432 | + name: json["name"], | |
| 433 | + ); | |
| 434 | + | |
| 435 | + Map<String, dynamic> toJson() => { | |
| 436 | + "assetId": assetId, | |
| 437 | + "blobId": blobId, | |
| 438 | + "filename": filename, | |
| 439 | + "name": name, | |
| 440 | + }; | |
| 441 | +} | |
| 442 | + | |
| 443 | +class CustomFields { | |
| 444 | + final AdditionalResources additionalResources; | |
| 445 | + final CommonCore commonCore; | |
| 446 | + final DatasetInformation datasetInformation; | |
| 447 | + final DatasetSummary datasetSummary; | |
| 448 | + final Notes notes; | |
| 449 | + | |
| 450 | + CustomFields({ | |
| 451 | + required this.additionalResources, | |
| 452 | + required this.commonCore, | |
| 453 | + required this.datasetInformation, | |
| 454 | + required this.datasetSummary, | |
| 455 | + required this.notes, | |
| 456 | + }); | |
| 457 | + | |
| 458 | + factory CustomFields.fromJson(Map<String, dynamic> json) => CustomFields( | |
| 459 | + additionalResources: AdditionalResources.fromJson(json["Additional Resources"]), | |
| 460 | + commonCore: CommonCore.fromJson(json["Common Core"]), | |
| 461 | + datasetInformation: DatasetInformation.fromJson(json["Dataset Information"]), | |
| 462 | + datasetSummary: DatasetSummary.fromJson(json["Dataset Summary"]), | |
| 463 | + notes: Notes.fromJson(json["Notes"]), | |
| 464 | + ); | |
| 465 | + | |
| 466 | + Map<String, dynamic> toJson() => { | |
| 467 | + "Additional Resources": additionalResources.toJson(), | |
| 468 | + "Common Core": commonCore.toJson(), | |
| 469 | + "Dataset Information": datasetInformation.toJson(), | |
| 470 | + "Dataset Summary": datasetSummary.toJson(), | |
| 471 | + "Notes": notes.toJson(), | |
| 472 | + }; | |
| 473 | +} | |
| 474 | + | |
| 475 | +class AdditionalResources { | |
| 476 | + final String additionalResourcesSeeAlso; | |
| 477 | + final String seeAlso; | |
| 478 | + | |
| 479 | + AdditionalResources({ | |
| 480 | + required this.additionalResourcesSeeAlso, | |
| 481 | + required this.seeAlso, | |
| 482 | + }); | |
| 483 | + | |
| 484 | + factory AdditionalResources.fromJson(Map<String, dynamic> json) => AdditionalResources( | |
| 485 | + additionalResourcesSeeAlso: json["See Also "], | |
| 486 | + seeAlso: json["See Also"], | |
| 487 | + ); | |
| 488 | + | |
| 489 | + Map<String, dynamic> toJson() => { | |
| 490 | + "See Also ": additionalResourcesSeeAlso, | |
| 491 | + "See Also": seeAlso, | |
| 492 | + }; | |
| 493 | +} | |
| 494 | + | |
| 495 | +class CommonCore { | |
| 496 | + final String contactEmail; | |
| 497 | + final String contactName; | |
| 498 | + final String publisher; | |
| 499 | + | |
| 500 | + CommonCore({ | |
| 501 | + required this.contactEmail, | |
| 502 | + required this.contactName, | |
| 503 | + required this.publisher, | |
| 504 | + }); | |
| 505 | + | |
| 506 | + factory CommonCore.fromJson(Map<String, dynamic> json) => CommonCore( | |
| 507 | + contactEmail: json["Contact Email"], | |
| 508 | + contactName: json["Contact Name"], | |
| 509 | + publisher: json["Publisher"], | |
| 510 | + ); | |
| 511 | + | |
| 512 | + Map<String, dynamic> toJson() => { | |
| 513 | + "Contact Email": contactEmail, | |
| 514 | + "Contact Name": contactName, | |
| 515 | + "Publisher": publisher, | |
| 516 | + }; | |
| 517 | +} | |
| 518 | + | |
| 519 | +class DatasetInformation { | |
| 520 | + final String agency; | |
| 521 | + | |
| 522 | + DatasetInformation({ | |
| 523 | + required this.agency, | |
| 524 | + }); | |
| 525 | + | |
| 526 | + factory DatasetInformation.fromJson(Map<String, dynamic> json) => DatasetInformation( | |
| 527 | + agency: json["Agency"], | |
| 528 | + ); | |
| 529 | + | |
| 530 | + Map<String, dynamic> toJson() => { | |
| 531 | + "Agency": agency, | |
| 532 | + }; | |
| 533 | +} | |
| 534 | + | |
| 535 | +class DatasetSummary { | |
| 536 | + final String contactInformation; | |
| 537 | + final String coverage; | |
| 538 | + final String dataFrequency; | |
| 539 | + final String datasetOwner; | |
| 540 | + final String granularity; | |
| 541 | + final String organization; | |
| 542 | + final String postingFrequency; | |
| 543 | + final String timePeriod; | |
| 544 | + final String units; | |
| 545 | + | |
| 546 | + DatasetSummary({ | |
| 547 | + required this.contactInformation, | |
| 548 | + required this.coverage, | |
| 549 | + required this.dataFrequency, | |
| 550 | + required this.datasetOwner, | |
| 551 | + required this.granularity, | |
| 552 | + required this.organization, | |
| 553 | + required this.postingFrequency, | |
| 554 | + required this.timePeriod, | |
| 555 | + required this.units, | |
| 556 | + }); | |
| 557 | + | |
| 558 | + factory DatasetSummary.fromJson(Map<String, dynamic> json) => DatasetSummary( | |
| 559 | + contactInformation: json["Contact Information"], | |
| 560 | + coverage: json["Coverage"], | |
| 561 | + dataFrequency: json["Data Frequency"], | |
| 562 | + datasetOwner: json["Dataset Owner"], | |
| 563 | + granularity: json["Granularity"], | |
| 564 | + organization: json["Organization"], | |
| 565 | + postingFrequency: json["Posting Frequency"], | |
| 566 | + timePeriod: json["Time Period"], | |
| 567 | + units: json["Units"], | |
| 568 | + ); | |
| 569 | + | |
| 570 | + Map<String, dynamic> toJson() => { | |
| 571 | + "Contact Information": contactInformation, | |
| 572 | + "Coverage": coverage, | |
| 573 | + "Data Frequency": dataFrequency, | |
| 574 | + "Dataset Owner": datasetOwner, | |
| 575 | + "Granularity": granularity, | |
| 576 | + "Organization": organization, | |
| 577 | + "Posting Frequency": postingFrequency, | |
| 578 | + "Time Period": timePeriod, | |
| 579 | + "Units": units, | |
| 580 | + }; | |
| 581 | +} | |
| 582 | + | |
| 583 | +class Notes { | |
| 584 | + final String notes; | |
| 585 | + | |
| 586 | + Notes({ | |
| 587 | + required this.notes, | |
| 588 | + }); | |
| 589 | + | |
| 590 | + factory Notes.fromJson(Map<String, dynamic> json) => Notes( | |
| 591 | + notes: json["Notes"], | |
| 592 | + ); | |
| 593 | + | |
| 594 | + Map<String, dynamic> toJson() => { | |
| 595 | + "Notes": notes, | |
| 596 | + }; | |
| 597 | +} | |
| 598 | + | |
| 599 | +class JsonQuery { | |
| 600 | + final List<Order> order; | |
| 601 | + | |
| 602 | + JsonQuery({ | |
| 603 | + required this.order, | |
| 604 | + }); | |
| 605 | + | |
| 606 | + factory JsonQuery.fromJson(Map<String, dynamic> json) => JsonQuery( | |
| 607 | + order: List<Order>.from(json["order"].map((x) => Order.fromJson(x))), | |
| 608 | + ); | |
| 609 | + | |
| 610 | + Map<String, dynamic> toJson() => { | |
| 611 | + "order": List<dynamic>.from(order.map((x) => x.toJson())), | |
| 612 | + }; | |
| 613 | +} | |
| 614 | + | |
| 615 | +class Order { | |
| 616 | + final bool ascending; | |
| 617 | + final String columnFieldName; | |
| 618 | + | |
| 619 | + Order({ | |
| 620 | + required this.ascending, | |
| 621 | + required this.columnFieldName, | |
| 622 | + }); | |
| 623 | + | |
| 624 | + factory Order.fromJson(Map<String, dynamic> json) => Order( | |
| 625 | + ascending: json["ascending"], | |
| 626 | + columnFieldName: json["columnFieldName"], | |
| 627 | + ); | |
| 628 | + | |
| 629 | + Map<String, dynamic> toJson() => { | |
| 630 | + "ascending": ascending, | |
| 631 | + "columnFieldName": columnFieldName, | |
| 632 | + }; | |
| 633 | +} | |
| 634 | + | |
| 635 | +class RenderTypeConfig { | |
| 636 | + final Visible visible; | |
| 637 | + | |
| 638 | + RenderTypeConfig({ | |
| 639 | + required this.visible, | |
| 640 | + }); | |
| 641 | + | |
| 642 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 643 | + visible: Visible.fromJson(json["visible"]), | |
| 644 | + ); | |
| 645 | + | |
| 646 | + Map<String, dynamic> toJson() => { | |
| 647 | + "visible": visible.toJson(), | |
| 648 | + }; | |
| 649 | +} | |
| 650 | + | |
| 651 | +class Visible { | |
| 652 | + final bool table; | |
| 653 | + | |
| 654 | + Visible({ | |
| 655 | + required this.table, | |
| 656 | + }); | |
| 657 | + | |
| 658 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 659 | + table: json["table"], | |
| 660 | + ); | |
| 661 | + | |
| 662 | + Map<String, dynamic> toJson() => { | |
| 663 | + "table": table, | |
| 664 | + }; | |
| 665 | +} | |
| 666 | + | |
| 667 | +class Owner { | |
| 668 | + final String displayName; | |
| 669 | + final String id; | |
| 670 | + final String profileImageUrlLarge; | |
| 671 | + final String profileImageUrlMedium; | |
| 672 | + final String profileImageUrlSmall; | |
| 673 | + final List<String> rights; | |
| 674 | + final String roleName; | |
| 675 | + final String screenName; | |
| 676 | + | |
| 677 | + Owner({ | |
| 678 | + required this.displayName, | |
| 679 | + required this.id, | |
| 680 | + required this.profileImageUrlLarge, | |
| 681 | + required this.profileImageUrlMedium, | |
| 682 | + required this.profileImageUrlSmall, | |
| 683 | + required this.rights, | |
| 684 | + required this.roleName, | |
| 685 | + required this.screenName, | |
| 686 | + }); | |
| 687 | + | |
| 688 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 689 | + displayName: json["displayName"], | |
| 690 | + id: json["id"], | |
| 691 | + profileImageUrlLarge: json["profileImageUrlLarge"], | |
| 692 | + profileImageUrlMedium: json["profileImageUrlMedium"], | |
| 693 | + profileImageUrlSmall: json["profileImageUrlSmall"], | |
| 694 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 695 | + roleName: json["roleName"], | |
| 696 | + screenName: json["screenName"], | |
| 697 | + ); | |
| 698 | + | |
| 699 | + Map<String, dynamic> toJson() => { | |
| 700 | + "displayName": displayName, | |
| 701 | + "id": id, | |
| 702 | + "profileImageUrlLarge": profileImageUrlLarge, | |
| 703 | + "profileImageUrlMedium": profileImageUrlMedium, | |
| 704 | + "profileImageUrlSmall": profileImageUrlSmall, | |
| 705 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 706 | + "roleName": roleName, | |
| 707 | + "screenName": screenName, | |
| 708 | + }; | |
| 709 | +} | |
| 710 | + | |
| 711 | +class Query { | |
| 712 | + final List<OrderBy> orderBys; | |
| 713 | + | |
| 714 | + Query({ | |
| 715 | + required this.orderBys, | |
| 716 | + }); | |
| 717 | + | |
| 718 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 719 | + orderBys: List<OrderBy>.from(json["orderBys"].map((x) => OrderBy.fromJson(x))), | |
| 720 | + ); | |
| 721 | + | |
| 722 | + Map<String, dynamic> toJson() => { | |
| 723 | + "orderBys": List<dynamic>.from(orderBys.map((x) => x.toJson())), | |
| 724 | + }; | |
| 725 | +} | |
| 726 | + | |
| 727 | +class OrderBy { | |
| 728 | + final bool ascending; | |
| 729 | + final Expression expression; | |
| 730 | + | |
| 731 | + OrderBy({ | |
| 732 | + required this.ascending, | |
| 733 | + required this.expression, | |
| 734 | + }); | |
| 735 | + | |
| 736 | + factory OrderBy.fromJson(Map<String, dynamic> json) => OrderBy( | |
| 737 | + ascending: json["ascending"], | |
| 738 | + expression: Expression.fromJson(json["expression"]), | |
| 739 | + ); | |
| 740 | + | |
| 741 | + Map<String, dynamic> toJson() => { | |
| 742 | + "ascending": ascending, | |
| 743 | + "expression": expression.toJson(), | |
| 744 | + }; | |
| 745 | +} | |
| 746 | + | |
| 747 | +class Expression { | |
| 748 | + final int columnId; | |
| 749 | + final String type; | |
| 750 | + | |
| 751 | + Expression({ | |
| 752 | + required this.columnId, | |
| 753 | + required this.type, | |
| 754 | + }); | |
| 755 | + | |
| 756 | + factory Expression.fromJson(Map<String, dynamic> json) => Expression( | |
| 757 | + columnId: json["columnId"], | |
| 758 | + type: json["type"], | |
| 759 | + ); | |
| 760 | + | |
| 761 | + Map<String, dynamic> toJson() => { | |
| 762 | + "columnId": columnId, | |
| 763 | + "type": type, | |
| 764 | + }; | |
| 765 | +} |
Test case
1 generated file · +611 −0test/inputs/json/misc/27332.json
Adartdefault / TopLevel.dart+611 −0
| @@ -0,0 +1,611 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final String? authorFlairCssClass; | |
| 85 | + final String? authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final String? distinguished; | |
| 96 | + final Domain domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final String? linkFlairCssClass; | |
| 107 | + final String? linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final Media? media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final PostHint? postHint; | |
| 118 | + final Preview? preview; | |
| 119 | + final bool quarantine; | |
| 120 | + final dynamic removalReason; | |
| 121 | + final dynamic reportReasons; | |
| 122 | + final bool saved; | |
| 123 | + final int score; | |
| 124 | + final Media? secureMedia; | |
| 125 | + final MediaEmbed secureMediaEmbed; | |
| 126 | + final String selftext; | |
| 127 | + final String? selftextHtml; | |
| 128 | + final bool spoiler; | |
| 129 | + final bool stickied; | |
| 130 | + final Subreddit subreddit; | |
| 131 | + final SubredditId subredditId; | |
| 132 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 133 | + final SubredditType subredditType; | |
| 134 | + final dynamic suggestedSort; | |
| 135 | + final String thumbnail; | |
| 136 | + final int? thumbnailHeight; | |
| 137 | + final int? thumbnailWidth; | |
| 138 | + final String title; | |
| 139 | + final int ups; | |
| 140 | + final String url; | |
| 141 | + final List<dynamic> userReports; | |
| 142 | + final dynamic viewCount; | |
| 143 | + final bool visited; | |
| 144 | + | |
| 145 | + ChildData({ | |
| 146 | + required this.approvedAtUtc, | |
| 147 | + required this.approvedBy, | |
| 148 | + required this.archived, | |
| 149 | + required this.author, | |
| 150 | + required this.authorFlairCssClass, | |
| 151 | + required this.authorFlairText, | |
| 152 | + required this.bannedAtUtc, | |
| 153 | + required this.bannedBy, | |
| 154 | + required this.brandSafe, | |
| 155 | + required this.canGild, | |
| 156 | + required this.canModPost, | |
| 157 | + required this.clicked, | |
| 158 | + required this.contestMode, | |
| 159 | + required this.created, | |
| 160 | + required this.createdUtc, | |
| 161 | + required this.distinguished, | |
| 162 | + required this.domain, | |
| 163 | + required this.downs, | |
| 164 | + required this.edited, | |
| 165 | + required this.gilded, | |
| 166 | + required this.hidden, | |
| 167 | + required this.hideScore, | |
| 168 | + required this.id, | |
| 169 | + required this.isSelf, | |
| 170 | + required this.isVideo, | |
| 171 | + required this.likes, | |
| 172 | + required this.linkFlairCssClass, | |
| 173 | + required this.linkFlairText, | |
| 174 | + required this.locked, | |
| 175 | + required this.media, | |
| 176 | + required this.mediaEmbed, | |
| 177 | + required this.modReports, | |
| 178 | + required this.name, | |
| 179 | + required this.numComments, | |
| 180 | + required this.numReports, | |
| 181 | + required this.over18, | |
| 182 | + required this.permalink, | |
| 183 | + this.postHint, | |
| 184 | + this.preview, | |
| 185 | + required this.quarantine, | |
| 186 | + required this.removalReason, | |
| 187 | + required this.reportReasons, | |
| 188 | + required this.saved, | |
| 189 | + required this.score, | |
| 190 | + required this.secureMedia, | |
| 191 | + required this.secureMediaEmbed, | |
| 192 | + required this.selftext, | |
| 193 | + required this.selftextHtml, | |
| 194 | + required this.spoiler, | |
| 195 | + required this.stickied, | |
| 196 | + required this.subreddit, | |
| 197 | + required this.subredditId, | |
| 198 | + required this.subredditNamePrefixed, | |
| 199 | + required this.subredditType, | |
| 200 | + required this.suggestedSort, | |
| 201 | + required this.thumbnail, | |
| 202 | + required this.thumbnailHeight, | |
| 203 | + required this.thumbnailWidth, | |
| 204 | + required this.title, | |
| 205 | + required this.ups, | |
| 206 | + required this.url, | |
| 207 | + required this.userReports, | |
| 208 | + required this.viewCount, | |
| 209 | + required this.visited, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 213 | + approvedAtUtc: json["approved_at_utc"], | |
| 214 | + approvedBy: json["approved_by"], | |
| 215 | + archived: json["archived"], | |
| 216 | + author: json["author"], | |
| 217 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 218 | + authorFlairText: json["author_flair_text"], | |
| 219 | + bannedAtUtc: json["banned_at_utc"], | |
| 220 | + bannedBy: json["banned_by"], | |
| 221 | + brandSafe: json["brand_safe"], | |
| 222 | + canGild: json["can_gild"], | |
| 223 | + canModPost: json["can_mod_post"], | |
| 224 | + clicked: json["clicked"], | |
| 225 | + contestMode: json["contest_mode"], | |
| 226 | + created: json["created"]?.toDouble(), | |
| 227 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 228 | + distinguished: json["distinguished"], | |
| 229 | + domain: domainValues.map[json["domain"]]!, | |
| 230 | + downs: json["downs"], | |
| 231 | + edited: json["edited"], | |
| 232 | + gilded: json["gilded"], | |
| 233 | + hidden: json["hidden"], | |
| 234 | + hideScore: json["hide_score"], | |
| 235 | + id: json["id"], | |
| 236 | + isSelf: json["is_self"], | |
| 237 | + isVideo: json["is_video"], | |
| 238 | + likes: json["likes"], | |
| 239 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 240 | + linkFlairText: json["link_flair_text"], | |
| 241 | + locked: json["locked"], | |
| 242 | + media: json["media"] == null ? null : Media.fromJson(json["media"]), | |
| 243 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 244 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 245 | + name: json["name"], | |
| 246 | + numComments: json["num_comments"], | |
| 247 | + numReports: json["num_reports"], | |
| 248 | + over18: json["over_18"], | |
| 249 | + permalink: json["permalink"], | |
| 250 | + postHint: postHintValues.map[json["post_hint"]], | |
| 251 | + preview: json["preview"] == null ? null : Preview.fromJson(json["preview"]), | |
| 252 | + quarantine: json["quarantine"], | |
| 253 | + removalReason: json["removal_reason"], | |
| 254 | + reportReasons: json["report_reasons"], | |
| 255 | + saved: json["saved"], | |
| 256 | + score: json["score"], | |
| 257 | + secureMedia: json["secure_media"] == null ? null : Media.fromJson(json["secure_media"]), | |
| 258 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 259 | + selftext: json["selftext"], | |
| 260 | + selftextHtml: json["selftext_html"], | |
| 261 | + spoiler: json["spoiler"], | |
| 262 | + stickied: json["stickied"], | |
| 263 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 264 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 265 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 266 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 267 | + suggestedSort: json["suggested_sort"], | |
| 268 | + thumbnail: json["thumbnail"], | |
| 269 | + thumbnailHeight: json["thumbnail_height"], | |
| 270 | + thumbnailWidth: json["thumbnail_width"], | |
| 271 | + title: json["title"], | |
| 272 | + ups: json["ups"], | |
| 273 | + url: json["url"], | |
| 274 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 275 | + viewCount: json["view_count"], | |
| 276 | + visited: json["visited"], | |
| 277 | + ); | |
| 278 | + | |
| 279 | + Map<String, dynamic> toJson() => { | |
| 280 | + "approved_at_utc": approvedAtUtc, | |
| 281 | + "approved_by": approvedBy, | |
| 282 | + "archived": archived, | |
| 283 | + "author": author, | |
| 284 | + "author_flair_css_class": authorFlairCssClass, | |
| 285 | + "author_flair_text": authorFlairText, | |
| 286 | + "banned_at_utc": bannedAtUtc, | |
| 287 | + "banned_by": bannedBy, | |
| 288 | + "brand_safe": brandSafe, | |
| 289 | + "can_gild": canGild, | |
| 290 | + "can_mod_post": canModPost, | |
| 291 | + "clicked": clicked, | |
| 292 | + "contest_mode": contestMode, | |
| 293 | + "created": created, | |
| 294 | + "created_utc": createdUtc, | |
| 295 | + "distinguished": distinguished, | |
| 296 | + "domain": domainValues.reverse[domain], | |
| 297 | + "downs": downs, | |
| 298 | + "edited": edited, | |
| 299 | + "gilded": gilded, | |
| 300 | + "hidden": hidden, | |
| 301 | + "hide_score": hideScore, | |
| 302 | + "id": id, | |
| 303 | + "is_self": isSelf, | |
| 304 | + "is_video": isVideo, | |
| 305 | + "likes": likes, | |
| 306 | + "link_flair_css_class": linkFlairCssClass, | |
| 307 | + "link_flair_text": linkFlairText, | |
| 308 | + "locked": locked, | |
| 309 | + "media": media?.toJson(), | |
| 310 | + "media_embed": mediaEmbed.toJson(), | |
| 311 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 312 | + "name": name, | |
| 313 | + "num_comments": numComments, | |
| 314 | + "num_reports": numReports, | |
| 315 | + "over_18": over18, | |
| 316 | + "permalink": permalink, | |
| 317 | + "post_hint": postHintValues.reverse[postHint], | |
| 318 | + "preview": preview?.toJson(), | |
| 319 | + "quarantine": quarantine, | |
| 320 | + "removal_reason": removalReason, | |
| 321 | + "report_reasons": reportReasons, | |
| 322 | + "saved": saved, | |
| 323 | + "score": score, | |
| 324 | + "secure_media": secureMedia?.toJson(), | |
| 325 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 326 | + "selftext": selftext, | |
| 327 | + "selftext_html": selftextHtml, | |
| 328 | + "spoiler": spoiler, | |
| 329 | + "stickied": stickied, | |
| 330 | + "subreddit": subredditValues.reverse[subreddit], | |
| 331 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 332 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 333 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 334 | + "suggested_sort": suggestedSort, | |
| 335 | + "thumbnail": thumbnail, | |
| 336 | + "thumbnail_height": thumbnailHeight, | |
| 337 | + "thumbnail_width": thumbnailWidth, | |
| 338 | + "title": title, | |
| 339 | + "ups": ups, | |
| 340 | + "url": url, | |
| 341 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 342 | + "view_count": viewCount, | |
| 343 | + "visited": visited, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +enum Domain { | |
| 348 | + SELF_PICS, | |
| 349 | + IMGUR_COM, | |
| 350 | + I_IMGUR_COM, | |
| 351 | + I_REDD_IT | |
| 352 | +} | |
| 353 | + | |
| 354 | +final domainValues = EnumValues({ | |
| 355 | + "self.pics": Domain.SELF_PICS, | |
| 356 | + "imgur.com": Domain.IMGUR_COM, | |
| 357 | + "i.imgur.com": Domain.I_IMGUR_COM, | |
| 358 | + "i.redd.it": Domain.I_REDD_IT | |
| 359 | +}); | |
| 360 | + | |
| 361 | +class Media { | |
| 362 | + final Oembed oembed; | |
| 363 | + final Domain type; | |
| 364 | + | |
| 365 | + Media({ | |
| 366 | + required this.oembed, | |
| 367 | + required this.type, | |
| 368 | + }); | |
| 369 | + | |
| 370 | + factory Media.fromJson(Map<String, dynamic> json) => Media( | |
| 371 | + oembed: Oembed.fromJson(json["oembed"]), | |
| 372 | + type: domainValues.map[json["type"]]!, | |
| 373 | + ); | |
| 374 | + | |
| 375 | + Map<String, dynamic> toJson() => { | |
| 376 | + "oembed": oembed.toJson(), | |
| 377 | + "type": domainValues.reverse[type], | |
| 378 | + }; | |
| 379 | +} | |
| 380 | + | |
| 381 | +class Oembed { | |
| 382 | + final String description; | |
| 383 | + final int height; | |
| 384 | + final String html; | |
| 385 | + final String providerName; | |
| 386 | + final String providerUrl; | |
| 387 | + final int thumbnailHeight; | |
| 388 | + final String thumbnailUrl; | |
| 389 | + final int thumbnailWidth; | |
| 390 | + final String title; | |
| 391 | + final String type; | |
| 392 | + final String version; | |
| 393 | + final int width; | |
| 394 | + | |
| 395 | + Oembed({ | |
| 396 | + required this.description, | |
| 397 | + required this.height, | |
| 398 | + required this.html, | |
| 399 | + required this.providerName, | |
| 400 | + required this.providerUrl, | |
| 401 | + required this.thumbnailHeight, | |
| 402 | + required this.thumbnailUrl, | |
| 403 | + required this.thumbnailWidth, | |
| 404 | + required this.title, | |
| 405 | + required this.type, | |
| 406 | + required this.version, | |
| 407 | + required this.width, | |
| 408 | + }); | |
| 409 | + | |
| 410 | + factory Oembed.fromJson(Map<String, dynamic> json) => Oembed( | |
| 411 | + description: json["description"], | |
| 412 | + height: json["height"], | |
| 413 | + html: json["html"], | |
| 414 | + providerName: json["provider_name"], | |
| 415 | + providerUrl: json["provider_url"], | |
| 416 | + thumbnailHeight: json["thumbnail_height"], | |
| 417 | + thumbnailUrl: json["thumbnail_url"], | |
| 418 | + thumbnailWidth: json["thumbnail_width"], | |
| 419 | + title: json["title"], | |
| 420 | + type: json["type"], | |
| 421 | + version: json["version"], | |
| 422 | + width: json["width"], | |
| 423 | + ); | |
| 424 | + | |
| 425 | + Map<String, dynamic> toJson() => { | |
| 426 | + "description": description, | |
| 427 | + "height": height, | |
| 428 | + "html": html, | |
| 429 | + "provider_name": providerName, | |
| 430 | + "provider_url": providerUrl, | |
| 431 | + "thumbnail_height": thumbnailHeight, | |
| 432 | + "thumbnail_url": thumbnailUrl, | |
| 433 | + "thumbnail_width": thumbnailWidth, | |
| 434 | + "title": title, | |
| 435 | + "type": type, | |
| 436 | + "version": version, | |
| 437 | + "width": width, | |
| 438 | + }; | |
| 439 | +} | |
| 440 | + | |
| 441 | +class MediaEmbed { | |
| 442 | + final String? content; | |
| 443 | + final int? height; | |
| 444 | + final bool? scrolling; | |
| 445 | + final int? width; | |
| 446 | + | |
| 447 | + MediaEmbed({ | |
| 448 | + this.content, | |
| 449 | + this.height, | |
| 450 | + this.scrolling, | |
| 451 | + this.width, | |
| 452 | + }); | |
| 453 | + | |
| 454 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 455 | + content: json["content"], | |
| 456 | + height: json["height"], | |
| 457 | + scrolling: json["scrolling"], | |
| 458 | + width: json["width"], | |
| 459 | + ); | |
| 460 | + | |
| 461 | + Map<String, dynamic> toJson() => { | |
| 462 | + "content": content, | |
| 463 | + "height": height, | |
| 464 | + "scrolling": scrolling, | |
| 465 | + "width": width, | |
| 466 | + }; | |
| 467 | +} | |
| 468 | + | |
| 469 | +enum PostHint { | |
| 470 | + LINK, | |
| 471 | + IMAGE | |
| 472 | +} | |
| 473 | + | |
| 474 | +final postHintValues = EnumValues({ | |
| 475 | + "link": PostHint.LINK, | |
| 476 | + "image": PostHint.IMAGE | |
| 477 | +}); | |
| 478 | + | |
| 479 | +class Preview { | |
| 480 | + final bool enabled; | |
| 481 | + final List<Image> images; | |
| 482 | + | |
| 483 | + Preview({ | |
| 484 | + required this.enabled, | |
| 485 | + required this.images, | |
| 486 | + }); | |
| 487 | + | |
| 488 | + factory Preview.fromJson(Map<String, dynamic> json) => Preview( | |
| 489 | + enabled: json["enabled"], | |
| 490 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 491 | + ); | |
| 492 | + | |
| 493 | + Map<String, dynamic> toJson() => { | |
| 494 | + "enabled": enabled, | |
| 495 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 496 | + }; | |
| 497 | +} | |
| 498 | + | |
| 499 | +class Image { | |
| 500 | + final String id; | |
| 501 | + final List<Source> resolutions; | |
| 502 | + final Source source; | |
| 503 | + final Variants variants; | |
| 504 | + | |
| 505 | + Image({ | |
| 506 | + required this.id, | |
| 507 | + required this.resolutions, | |
| 508 | + required this.source, | |
| 509 | + required this.variants, | |
| 510 | + }); | |
| 511 | + | |
| 512 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 513 | + id: json["id"], | |
| 514 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 515 | + source: Source.fromJson(json["source"]), | |
| 516 | + variants: Variants.fromJson(json["variants"]), | |
| 517 | + ); | |
| 518 | + | |
| 519 | + Map<String, dynamic> toJson() => { | |
| 520 | + "id": id, | |
| 521 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 522 | + "source": source.toJson(), | |
| 523 | + "variants": variants.toJson(), | |
| 524 | + }; | |
| 525 | +} | |
| 526 | + | |
| 527 | +class Source { | |
| 528 | + final int height; | |
| 529 | + final String url; | |
| 530 | + final int width; | |
| 531 | + | |
| 532 | + Source({ | |
| 533 | + required this.height, | |
| 534 | + required this.url, | |
| 535 | + required this.width, | |
| 536 | + }); | |
| 537 | + | |
| 538 | + factory Source.fromJson(Map<String, dynamic> json) => Source( | |
| 539 | + height: json["height"], | |
| 540 | + url: json["url"], | |
| 541 | + width: json["width"], | |
| 542 | + ); | |
| 543 | + | |
| 544 | + Map<String, dynamic> toJson() => { | |
| 545 | + "height": height, | |
| 546 | + "url": url, | |
| 547 | + "width": width, | |
| 548 | + }; | |
| 549 | +} | |
| 550 | + | |
| 551 | +class Variants { | |
| 552 | + Variants(); | |
| 553 | + | |
| 554 | + factory Variants.fromJson(Map<String, dynamic> json) => Variants( | |
| 555 | + ); | |
| 556 | + | |
| 557 | + Map<String, dynamic> toJson() => { | |
| 558 | + }; | |
| 559 | +} | |
| 560 | + | |
| 561 | +enum Subreddit { | |
| 562 | + PICS | |
| 563 | +} | |
| 564 | + | |
| 565 | +final subredditValues = EnumValues({ | |
| 566 | + "pics": Subreddit.PICS | |
| 567 | +}); | |
| 568 | + | |
| 569 | +enum SubredditId { | |
| 570 | + T5_2_QH0_U | |
| 571 | +} | |
| 572 | + | |
| 573 | +final subredditIdValues = EnumValues({ | |
| 574 | + "t5_2qh0u": SubredditId.T5_2_QH0_U | |
| 575 | +}); | |
| 576 | + | |
| 577 | +enum SubredditNamePrefixed { | |
| 578 | + R_PICS | |
| 579 | +} | |
| 580 | + | |
| 581 | +final subredditNamePrefixedValues = EnumValues({ | |
| 582 | + "r/pics": SubredditNamePrefixed.R_PICS | |
| 583 | +}); | |
| 584 | + | |
| 585 | +enum SubredditType { | |
| 586 | + PUBLIC | |
| 587 | +} | |
| 588 | + | |
| 589 | +final subredditTypeValues = EnumValues({ | |
| 590 | + "public": SubredditType.PUBLIC | |
| 591 | +}); | |
| 592 | + | |
| 593 | +enum Kind { | |
| 594 | + T3 | |
| 595 | +} | |
| 596 | + | |
| 597 | +final kindValues = EnumValues({ | |
| 598 | + "t3": Kind.T3 | |
| 599 | +}); | |
| 600 | + | |
| 601 | +class EnumValues<T> { | |
| 602 | + Map<String, T> map; | |
| 603 | + late Map<T, String> reverseMap; | |
| 604 | + | |
| 605 | + EnumValues(this.map); | |
| 606 | + | |
| 607 | + Map<T, String> get reverse { | |
| 608 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 609 | + return reverseMap; | |
| 610 | + } | |
| 611 | +} |
Test case
1 generated file · +547 −0test/inputs/json/misc/29f47.json
Adartdefault / TopLevel.dart+547 −0
| @@ -0,0 +1,547 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final dynamic authorFlairCssClass; | |
| 85 | + final dynamic authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final Distinguished distinguished; | |
| 96 | + final Domain domain; | |
| 97 | + final int downs; | |
| 98 | + final dynamic edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final dynamic linkFlairCssClass; | |
| 107 | + final dynamic linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final dynamic media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final PostHint? postHint; | |
| 118 | + final Preview? preview; | |
| 119 | + final bool quarantine; | |
| 120 | + final dynamic removalReason; | |
| 121 | + final dynamic reportReasons; | |
| 122 | + final bool saved; | |
| 123 | + final int score; | |
| 124 | + final dynamic secureMedia; | |
| 125 | + final MediaEmbed secureMediaEmbed; | |
| 126 | + final String selftext; | |
| 127 | + final String? selftextHtml; | |
| 128 | + final bool spoiler; | |
| 129 | + final bool stickied; | |
| 130 | + final Subreddit subreddit; | |
| 131 | + final SubredditId subredditId; | |
| 132 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 133 | + final SubredditType subredditType; | |
| 134 | + final String? suggestedSort; | |
| 135 | + final String thumbnail; | |
| 136 | + final int? thumbnailHeight; | |
| 137 | + final int? thumbnailWidth; | |
| 138 | + final String title; | |
| 139 | + final int ups; | |
| 140 | + final String url; | |
| 141 | + final List<dynamic> userReports; | |
| 142 | + final dynamic viewCount; | |
| 143 | + final bool visited; | |
| 144 | + | |
| 145 | + ChildData({ | |
| 146 | + required this.approvedAtUtc, | |
| 147 | + required this.approvedBy, | |
| 148 | + required this.archived, | |
| 149 | + required this.author, | |
| 150 | + required this.authorFlairCssClass, | |
| 151 | + required this.authorFlairText, | |
| 152 | + required this.bannedAtUtc, | |
| 153 | + required this.bannedBy, | |
| 154 | + required this.brandSafe, | |
| 155 | + required this.canGild, | |
| 156 | + required this.canModPost, | |
| 157 | + required this.clicked, | |
| 158 | + required this.contestMode, | |
| 159 | + required this.created, | |
| 160 | + required this.createdUtc, | |
| 161 | + required this.distinguished, | |
| 162 | + required this.domain, | |
| 163 | + required this.downs, | |
| 164 | + required this.edited, | |
| 165 | + required this.gilded, | |
| 166 | + required this.hidden, | |
| 167 | + required this.hideScore, | |
| 168 | + required this.id, | |
| 169 | + required this.isSelf, | |
| 170 | + required this.isVideo, | |
| 171 | + required this.likes, | |
| 172 | + required this.linkFlairCssClass, | |
| 173 | + required this.linkFlairText, | |
| 174 | + required this.locked, | |
| 175 | + required this.media, | |
| 176 | + required this.mediaEmbed, | |
| 177 | + required this.modReports, | |
| 178 | + required this.name, | |
| 179 | + required this.numComments, | |
| 180 | + required this.numReports, | |
| 181 | + required this.over18, | |
| 182 | + required this.permalink, | |
| 183 | + this.postHint, | |
| 184 | + this.preview, | |
| 185 | + required this.quarantine, | |
| 186 | + required this.removalReason, | |
| 187 | + required this.reportReasons, | |
| 188 | + required this.saved, | |
| 189 | + required this.score, | |
| 190 | + required this.secureMedia, | |
| 191 | + required this.secureMediaEmbed, | |
| 192 | + required this.selftext, | |
| 193 | + required this.selftextHtml, | |
| 194 | + required this.spoiler, | |
| 195 | + required this.stickied, | |
| 196 | + required this.subreddit, | |
| 197 | + required this.subredditId, | |
| 198 | + required this.subredditNamePrefixed, | |
| 199 | + required this.subredditType, | |
| 200 | + required this.suggestedSort, | |
| 201 | + required this.thumbnail, | |
| 202 | + required this.thumbnailHeight, | |
| 203 | + required this.thumbnailWidth, | |
| 204 | + required this.title, | |
| 205 | + required this.ups, | |
| 206 | + required this.url, | |
| 207 | + required this.userReports, | |
| 208 | + required this.viewCount, | |
| 209 | + required this.visited, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 213 | + approvedAtUtc: json["approved_at_utc"], | |
| 214 | + approvedBy: json["approved_by"], | |
| 215 | + archived: json["archived"], | |
| 216 | + author: json["author"], | |
| 217 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 218 | + authorFlairText: json["author_flair_text"], | |
| 219 | + bannedAtUtc: json["banned_at_utc"], | |
| 220 | + bannedBy: json["banned_by"], | |
| 221 | + brandSafe: json["brand_safe"], | |
| 222 | + canGild: json["can_gild"], | |
| 223 | + canModPost: json["can_mod_post"], | |
| 224 | + clicked: json["clicked"], | |
| 225 | + contestMode: json["contest_mode"], | |
| 226 | + created: json["created"]?.toDouble(), | |
| 227 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 228 | + distinguished: distinguishedValues.map[json["distinguished"]]!, | |
| 229 | + domain: domainValues.map[json["domain"]]!, | |
| 230 | + downs: json["downs"], | |
| 231 | + edited: json["edited"], | |
| 232 | + gilded: json["gilded"], | |
| 233 | + hidden: json["hidden"], | |
| 234 | + hideScore: json["hide_score"], | |
| 235 | + id: json["id"], | |
| 236 | + isSelf: json["is_self"], | |
| 237 | + isVideo: json["is_video"], | |
| 238 | + likes: json["likes"], | |
| 239 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 240 | + linkFlairText: json["link_flair_text"], | |
| 241 | + locked: json["locked"], | |
| 242 | + media: json["media"], | |
| 243 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 244 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 245 | + name: json["name"], | |
| 246 | + numComments: json["num_comments"], | |
| 247 | + numReports: json["num_reports"], | |
| 248 | + over18: json["over_18"], | |
| 249 | + permalink: json["permalink"], | |
| 250 | + postHint: postHintValues.map[json["post_hint"]], | |
| 251 | + preview: json["preview"] == null ? null : Preview.fromJson(json["preview"]), | |
| 252 | + quarantine: json["quarantine"], | |
| 253 | + removalReason: json["removal_reason"], | |
| 254 | + reportReasons: json["report_reasons"], | |
| 255 | + saved: json["saved"], | |
| 256 | + score: json["score"], | |
| 257 | + secureMedia: json["secure_media"], | |
| 258 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 259 | + selftext: json["selftext"], | |
| 260 | + selftextHtml: json["selftext_html"], | |
| 261 | + spoiler: json["spoiler"], | |
| 262 | + stickied: json["stickied"], | |
| 263 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 264 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 265 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 266 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 267 | + suggestedSort: json["suggested_sort"], | |
| 268 | + thumbnail: json["thumbnail"], | |
| 269 | + thumbnailHeight: json["thumbnail_height"], | |
| 270 | + thumbnailWidth: json["thumbnail_width"], | |
| 271 | + title: json["title"], | |
| 272 | + ups: json["ups"], | |
| 273 | + url: json["url"], | |
| 274 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 275 | + viewCount: json["view_count"], | |
| 276 | + visited: json["visited"], | |
| 277 | + ); | |
| 278 | + | |
| 279 | + Map<String, dynamic> toJson() => { | |
| 280 | + "approved_at_utc": approvedAtUtc, | |
| 281 | + "approved_by": approvedBy, | |
| 282 | + "archived": archived, | |
| 283 | + "author": author, | |
| 284 | + "author_flair_css_class": authorFlairCssClass, | |
| 285 | + "author_flair_text": authorFlairText, | |
| 286 | + "banned_at_utc": bannedAtUtc, | |
| 287 | + "banned_by": bannedBy, | |
| 288 | + "brand_safe": brandSafe, | |
| 289 | + "can_gild": canGild, | |
| 290 | + "can_mod_post": canModPost, | |
| 291 | + "clicked": clicked, | |
| 292 | + "contest_mode": contestMode, | |
| 293 | + "created": created, | |
| 294 | + "created_utc": createdUtc, | |
| 295 | + "distinguished": distinguishedValues.reverse[distinguished], | |
| 296 | + "domain": domainValues.reverse[domain], | |
| 297 | + "downs": downs, | |
| 298 | + "edited": edited, | |
| 299 | + "gilded": gilded, | |
| 300 | + "hidden": hidden, | |
| 301 | + "hide_score": hideScore, | |
| 302 | + "id": id, | |
| 303 | + "is_self": isSelf, | |
| 304 | + "is_video": isVideo, | |
| 305 | + "likes": likes, | |
| 306 | + "link_flair_css_class": linkFlairCssClass, | |
| 307 | + "link_flair_text": linkFlairText, | |
| 308 | + "locked": locked, | |
| 309 | + "media": media, | |
| 310 | + "media_embed": mediaEmbed.toJson(), | |
| 311 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 312 | + "name": name, | |
| 313 | + "num_comments": numComments, | |
| 314 | + "num_reports": numReports, | |
| 315 | + "over_18": over18, | |
| 316 | + "permalink": permalink, | |
| 317 | + "post_hint": postHintValues.reverse[postHint], | |
| 318 | + "preview": preview?.toJson(), | |
| 319 | + "quarantine": quarantine, | |
| 320 | + "removal_reason": removalReason, | |
| 321 | + "report_reasons": reportReasons, | |
| 322 | + "saved": saved, | |
| 323 | + "score": score, | |
| 324 | + "secure_media": secureMedia, | |
| 325 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 326 | + "selftext": selftext, | |
| 327 | + "selftext_html": selftextHtml, | |
| 328 | + "spoiler": spoiler, | |
| 329 | + "stickied": stickied, | |
| 330 | + "subreddit": subredditValues.reverse[subreddit], | |
| 331 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 332 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 333 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 334 | + "suggested_sort": suggestedSort, | |
| 335 | + "thumbnail": thumbnail, | |
| 336 | + "thumbnail_height": thumbnailHeight, | |
| 337 | + "thumbnail_width": thumbnailWidth, | |
| 338 | + "title": title, | |
| 339 | + "ups": ups, | |
| 340 | + "url": url, | |
| 341 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 342 | + "view_count": viewCount, | |
| 343 | + "visited": visited, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +enum Distinguished { | |
| 348 | + ADMIN | |
| 349 | +} | |
| 350 | + | |
| 351 | +final distinguishedValues = EnumValues({ | |
| 352 | + "admin": Distinguished.ADMIN | |
| 353 | +}); | |
| 354 | + | |
| 355 | +enum Domain { | |
| 356 | + SELF_ANNOUNCEMENTS, | |
| 357 | + I_REDD_IT | |
| 358 | +} | |
| 359 | + | |
| 360 | +final domainValues = EnumValues({ | |
| 361 | + "self.announcements": Domain.SELF_ANNOUNCEMENTS, | |
| 362 | + "i.redd.it": Domain.I_REDD_IT | |
| 363 | +}); | |
| 364 | + | |
| 365 | +class MediaEmbed { | |
| 366 | + MediaEmbed(); | |
| 367 | + | |
| 368 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 369 | + ); | |
| 370 | + | |
| 371 | + Map<String, dynamic> toJson() => { | |
| 372 | + }; | |
| 373 | +} | |
| 374 | + | |
| 375 | +enum PostHint { | |
| 376 | + SELF, | |
| 377 | + IMAGE | |
| 378 | +} | |
| 379 | + | |
| 380 | +final postHintValues = EnumValues({ | |
| 381 | + "self": PostHint.SELF, | |
| 382 | + "image": PostHint.IMAGE | |
| 383 | +}); | |
| 384 | + | |
| 385 | +class Preview { | |
| 386 | + final bool enabled; | |
| 387 | + final List<Image> images; | |
| 388 | + | |
| 389 | + Preview({ | |
| 390 | + required this.enabled, | |
| 391 | + required this.images, | |
| 392 | + }); | |
| 393 | + | |
| 394 | + factory Preview.fromJson(Map<String, dynamic> json) => Preview( | |
| 395 | + enabled: json["enabled"], | |
| 396 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 397 | + ); | |
| 398 | + | |
| 399 | + Map<String, dynamic> toJson() => { | |
| 400 | + "enabled": enabled, | |
| 401 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 402 | + }; | |
| 403 | +} | |
| 404 | + | |
| 405 | +class Image { | |
| 406 | + final String id; | |
| 407 | + final List<Source> resolutions; | |
| 408 | + final Source source; | |
| 409 | + final Variants variants; | |
| 410 | + | |
| 411 | + Image({ | |
| 412 | + required this.id, | |
| 413 | + required this.resolutions, | |
| 414 | + required this.source, | |
| 415 | + required this.variants, | |
| 416 | + }); | |
| 417 | + | |
| 418 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 419 | + id: json["id"], | |
| 420 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 421 | + source: Source.fromJson(json["source"]), | |
| 422 | + variants: Variants.fromJson(json["variants"]), | |
| 423 | + ); | |
| 424 | + | |
| 425 | + Map<String, dynamic> toJson() => { | |
| 426 | + "id": id, | |
| 427 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 428 | + "source": source.toJson(), | |
| 429 | + "variants": variants.toJson(), | |
| 430 | + }; | |
| 431 | +} | |
| 432 | + | |
| 433 | +class Source { | |
| 434 | + final int height; | |
| 435 | + final String url; | |
| 436 | + final int width; | |
| 437 | + | |
| 438 | + Source({ | |
| 439 | + required this.height, | |
| 440 | + required this.url, | |
| 441 | + required this.width, | |
| 442 | + }); | |
| 443 | + | |
| 444 | + factory Source.fromJson(Map<String, dynamic> json) => Source( | |
| 445 | + height: json["height"], | |
| 446 | + url: json["url"], | |
| 447 | + width: json["width"], | |
| 448 | + ); | |
| 449 | + | |
| 450 | + Map<String, dynamic> toJson() => { | |
| 451 | + "height": height, | |
| 452 | + "url": url, | |
| 453 | + "width": width, | |
| 454 | + }; | |
| 455 | +} | |
| 456 | + | |
| 457 | +class Variants { | |
| 458 | + final Gif? gif; | |
| 459 | + final Gif? mp4; | |
| 460 | + | |
| 461 | + Variants({ | |
| 462 | + this.gif, | |
| 463 | + this.mp4, | |
| 464 | + }); | |
| 465 | + | |
| 466 | + factory Variants.fromJson(Map<String, dynamic> json) => Variants( | |
| 467 | + gif: json["gif"] == null ? null : Gif.fromJson(json["gif"]), | |
| 468 | + mp4: json["mp4"] == null ? null : Gif.fromJson(json["mp4"]), | |
| 469 | + ); | |
| 470 | + | |
| 471 | + Map<String, dynamic> toJson() => { | |
| 472 | + "gif": gif?.toJson(), | |
| 473 | + "mp4": mp4?.toJson(), | |
| 474 | + }; | |
| 475 | +} | |
| 476 | + | |
| 477 | +class Gif { | |
| 478 | + final List<Source> resolutions; | |
| 479 | + final Source source; | |
| 480 | + | |
| 481 | + Gif({ | |
| 482 | + required this.resolutions, | |
| 483 | + required this.source, | |
| 484 | + }); | |
| 485 | + | |
| 486 | + factory Gif.fromJson(Map<String, dynamic> json) => Gif( | |
| 487 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 488 | + source: Source.fromJson(json["source"]), | |
| 489 | + ); | |
| 490 | + | |
| 491 | + Map<String, dynamic> toJson() => { | |
| 492 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 493 | + "source": source.toJson(), | |
| 494 | + }; | |
| 495 | +} | |
| 496 | + | |
| 497 | +enum Subreddit { | |
| 498 | + ANNOUNCEMENTS | |
| 499 | +} | |
| 500 | + | |
| 501 | +final subredditValues = EnumValues({ | |
| 502 | + "announcements": Subreddit.ANNOUNCEMENTS | |
| 503 | +}); | |
| 504 | + | |
| 505 | +enum SubredditId { | |
| 506 | + T5_2_R0_IJ | |
| 507 | +} | |
| 508 | + | |
| 509 | +final subredditIdValues = EnumValues({ | |
| 510 | + "t5_2r0ij": SubredditId.T5_2_R0_IJ | |
| 511 | +}); | |
| 512 | + | |
| 513 | +enum SubredditNamePrefixed { | |
| 514 | + R_ANNOUNCEMENTS | |
| 515 | +} | |
| 516 | + | |
| 517 | +final subredditNamePrefixedValues = EnumValues({ | |
| 518 | + "r/announcements": SubredditNamePrefixed.R_ANNOUNCEMENTS | |
| 519 | +}); | |
| 520 | + | |
| 521 | +enum SubredditType { | |
| 522 | + RESTRICTED | |
| 523 | +} | |
| 524 | + | |
| 525 | +final subredditTypeValues = EnumValues({ | |
| 526 | + "restricted": SubredditType.RESTRICTED | |
| 527 | +}); | |
| 528 | + | |
| 529 | +enum Kind { | |
| 530 | + T3 | |
| 531 | +} | |
| 532 | + | |
| 533 | +final kindValues = EnumValues({ | |
| 534 | + "t3": Kind.T3 | |
| 535 | +}); | |
| 536 | + | |
| 537 | +class EnumValues<T> { | |
| 538 | + Map<String, T> map; | |
| 539 | + late Map<T, String> reverseMap; | |
| 540 | + | |
| 541 | + EnumValues(this.map); | |
| 542 | + | |
| 543 | + Map<T, String> get reverse { | |
| 544 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 545 | + return reverseMap; | |
| 546 | + } | |
| 547 | +} |
Test case
1 generated file · +397 −0test/inputs/json/misc/2d4e2.json
Adartdefault / TopLevel.dart+397 −0
| @@ -0,0 +1,397 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Meta meta; | |
| 13 | + final List<Object> objects; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.meta, | |
| 17 | + required this.objects, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + meta: Meta.fromJson(json["meta"]), | |
| 22 | + objects: List<Object>.from(json["objects"].map((x) => Object.fromJson(x))), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "meta": meta.toJson(), | |
| 27 | + "objects": List<dynamic>.from(objects.map((x) => x.toJson())), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final int limit; | |
| 33 | + final int offset; | |
| 34 | + final int totalCount; | |
| 35 | + | |
| 36 | + Meta({ | |
| 37 | + required this.limit, | |
| 38 | + required this.offset, | |
| 39 | + required this.totalCount, | |
| 40 | + }); | |
| 41 | + | |
| 42 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 43 | + limit: json["limit"], | |
| 44 | + offset: json["offset"], | |
| 45 | + totalCount: json["total_count"], | |
| 46 | + ); | |
| 47 | + | |
| 48 | + Map<String, dynamic> toJson() => { | |
| 49 | + "limit": limit, | |
| 50 | + "offset": offset, | |
| 51 | + "total_count": totalCount, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Object { | |
| 56 | + final Party? caucus; | |
| 57 | + final List<int> congressNumbers; | |
| 58 | + final bool current; | |
| 59 | + final String description; | |
| 60 | + final dynamic district; | |
| 61 | + final DateTime enddate; | |
| 62 | + final Extra extra; | |
| 63 | + final int id; | |
| 64 | + final String? leadershipTitle; | |
| 65 | + final Party party; | |
| 66 | + final Person person; | |
| 67 | + final String phone; | |
| 68 | + final RoleType roleType; | |
| 69 | + final RoleTypeLabel roleTypeLabel; | |
| 70 | + final SenatorClass senatorClass; | |
| 71 | + final SenatorClassLabel senatorClassLabel; | |
| 72 | + final SenatorRank senatorRank; | |
| 73 | + final SenatorRankLabel senatorRankLabel; | |
| 74 | + final DateTime startdate; | |
| 75 | + final String state; | |
| 76 | + final Title title; | |
| 77 | + final RoleTypeLabel titleLong; | |
| 78 | + final String website; | |
| 79 | + | |
| 80 | + Object({ | |
| 81 | + required this.caucus, | |
| 82 | + required this.congressNumbers, | |
| 83 | + required this.current, | |
| 84 | + required this.description, | |
| 85 | + required this.district, | |
| 86 | + required this.enddate, | |
| 87 | + required this.extra, | |
| 88 | + required this.id, | |
| 89 | + required this.leadershipTitle, | |
| 90 | + required this.party, | |
| 91 | + required this.person, | |
| 92 | + required this.phone, | |
| 93 | + required this.roleType, | |
| 94 | + required this.roleTypeLabel, | |
| 95 | + required this.senatorClass, | |
| 96 | + required this.senatorClassLabel, | |
| 97 | + required this.senatorRank, | |
| 98 | + required this.senatorRankLabel, | |
| 99 | + required this.startdate, | |
| 100 | + required this.state, | |
| 101 | + required this.title, | |
| 102 | + required this.titleLong, | |
| 103 | + required this.website, | |
| 104 | + }); | |
| 105 | + | |
| 106 | + factory Object.fromJson(Map<String, dynamic> json) => Object( | |
| 107 | + caucus: partyValues.map[json["caucus"]], | |
| 108 | + congressNumbers: List<int>.from(json["congress_numbers"].map((x) => x)), | |
| 109 | + current: json["current"], | |
| 110 | + description: json["description"], | |
| 111 | + district: json["district"], | |
| 112 | + enddate: DateTime.parse(json["enddate"]), | |
| 113 | + extra: Extra.fromJson(json["extra"]), | |
| 114 | + id: json["id"], | |
| 115 | + leadershipTitle: json["leadership_title"], | |
| 116 | + party: partyValues.map[json["party"]]!, | |
| 117 | + person: Person.fromJson(json["person"]), | |
| 118 | + phone: json["phone"], | |
| 119 | + roleType: roleTypeValues.map[json["role_type"]]!, | |
| 120 | + roleTypeLabel: roleTypeLabelValues.map[json["role_type_label"]]!, | |
| 121 | + senatorClass: senatorClassValues.map[json["senator_class"]]!, | |
| 122 | + senatorClassLabel: senatorClassLabelValues.map[json["senator_class_label"]]!, | |
| 123 | + senatorRank: senatorRankValues.map[json["senator_rank"]]!, | |
| 124 | + senatorRankLabel: senatorRankLabelValues.map[json["senator_rank_label"]]!, | |
| 125 | + startdate: DateTime.parse(json["startdate"]), | |
| 126 | + state: json["state"], | |
| 127 | + title: titleValues.map[json["title"]]!, | |
| 128 | + titleLong: roleTypeLabelValues.map[json["title_long"]]!, | |
| 129 | + website: json["website"], | |
| 130 | + ); | |
| 131 | + | |
| 132 | + Map<String, dynamic> toJson() => { | |
| 133 | + "caucus": partyValues.reverse[caucus], | |
| 134 | + "congress_numbers": List<dynamic>.from(congressNumbers.map((x) => x)), | |
| 135 | + "current": current, | |
| 136 | + "description": description, | |
| 137 | + "district": district, | |
| 138 | + "enddate": "${enddate.year.toString().padLeft(4, '0')}-${enddate.month.toString().padLeft(2, '0')}-${enddate.day.toString().padLeft(2, '0')}", | |
| 139 | + "extra": extra.toJson(), | |
| 140 | + "id": id, | |
| 141 | + "leadership_title": leadershipTitle, | |
| 142 | + "party": partyValues.reverse[party], | |
| 143 | + "person": person.toJson(), | |
| 144 | + "phone": phone, | |
| 145 | + "role_type": roleTypeValues.reverse[roleType], | |
| 146 | + "role_type_label": roleTypeLabelValues.reverse[roleTypeLabel], | |
| 147 | + "senator_class": senatorClassValues.reverse[senatorClass], | |
| 148 | + "senator_class_label": senatorClassLabelValues.reverse[senatorClassLabel], | |
| 149 | + "senator_rank": senatorRankValues.reverse[senatorRank], | |
| 150 | + "senator_rank_label": senatorRankLabelValues.reverse[senatorRankLabel], | |
| 151 | + "startdate": "${startdate.year.toString().padLeft(4, '0')}-${startdate.month.toString().padLeft(2, '0')}-${startdate.day.toString().padLeft(2, '0')}", | |
| 152 | + "state": state, | |
| 153 | + "title": titleValues.reverse[title], | |
| 154 | + "title_long": roleTypeLabelValues.reverse[titleLong], | |
| 155 | + "website": website, | |
| 156 | + }; | |
| 157 | +} | |
| 158 | + | |
| 159 | +enum Party { | |
| 160 | + REPUBLICAN, | |
| 161 | + DEMOCRAT, | |
| 162 | + INDEPENDENT | |
| 163 | +} | |
| 164 | + | |
| 165 | +final partyValues = EnumValues({ | |
| 166 | + "Republican": Party.REPUBLICAN, | |
| 167 | + "Democrat": Party.DEMOCRAT, | |
| 168 | + "Independent": Party.INDEPENDENT | |
| 169 | +}); | |
| 170 | + | |
| 171 | +class Extra { | |
| 172 | + final String address; | |
| 173 | + final String contactForm; | |
| 174 | + final String? fax; | |
| 175 | + final String office; | |
| 176 | + final String? rssUrl; | |
| 177 | + | |
| 178 | + Extra({ | |
| 179 | + required this.address, | |
| 180 | + required this.contactForm, | |
| 181 | + this.fax, | |
| 182 | + required this.office, | |
| 183 | + this.rssUrl, | |
| 184 | + }); | |
| 185 | + | |
| 186 | + factory Extra.fromJson(Map<String, dynamic> json) => Extra( | |
| 187 | + address: json["address"], | |
| 188 | + contactForm: json["contact_form"], | |
| 189 | + fax: json["fax"], | |
| 190 | + office: json["office"], | |
| 191 | + rssUrl: json["rss_url"], | |
| 192 | + ); | |
| 193 | + | |
| 194 | + Map<String, dynamic> toJson() => { | |
| 195 | + "address": address, | |
| 196 | + "contact_form": contactForm, | |
| 197 | + "fax": fax, | |
| 198 | + "office": office, | |
| 199 | + "rss_url": rssUrl, | |
| 200 | + }; | |
| 201 | +} | |
| 202 | + | |
| 203 | +class Person { | |
| 204 | + final String bioguideid; | |
| 205 | + final DateTime birthday; | |
| 206 | + final int cspanid; | |
| 207 | + final String firstname; | |
| 208 | + final Gender gender; | |
| 209 | + final GenderLabel genderLabel; | |
| 210 | + final int id; | |
| 211 | + final String lastname; | |
| 212 | + final String link; | |
| 213 | + final String middlename; | |
| 214 | + final String name; | |
| 215 | + final Namemod namemod; | |
| 216 | + final String nickname; | |
| 217 | + final String osid; | |
| 218 | + final String pvsid; | |
| 219 | + final String sortname; | |
| 220 | + final String? twitterid; | |
| 221 | + final String? youtubeid; | |
| 222 | + | |
| 223 | + Person({ | |
| 224 | + required this.bioguideid, | |
| 225 | + required this.birthday, | |
| 226 | + required this.cspanid, | |
| 227 | + required this.firstname, | |
| 228 | + required this.gender, | |
| 229 | + required this.genderLabel, | |
| 230 | + required this.id, | |
| 231 | + required this.lastname, | |
| 232 | + required this.link, | |
| 233 | + required this.middlename, | |
| 234 | + required this.name, | |
| 235 | + required this.namemod, | |
| 236 | + required this.nickname, | |
| 237 | + required this.osid, | |
| 238 | + required this.pvsid, | |
| 239 | + required this.sortname, | |
| 240 | + required this.twitterid, | |
| 241 | + required this.youtubeid, | |
| 242 | + }); | |
| 243 | + | |
| 244 | + factory Person.fromJson(Map<String, dynamic> json) => Person( | |
| 245 | + bioguideid: json["bioguideid"], | |
| 246 | + birthday: DateTime.parse(json["birthday"]), | |
| 247 | + cspanid: json["cspanid"], | |
| 248 | + firstname: json["firstname"], | |
| 249 | + gender: genderValues.map[json["gender"]]!, | |
| 250 | + genderLabel: genderLabelValues.map[json["gender_label"]]!, | |
| 251 | + id: json["id"], | |
| 252 | + lastname: json["lastname"], | |
| 253 | + link: json["link"], | |
| 254 | + middlename: json["middlename"], | |
| 255 | + name: json["name"], | |
| 256 | + namemod: namemodValues.map[json["namemod"]]!, | |
| 257 | + nickname: json["nickname"], | |
| 258 | + osid: json["osid"], | |
| 259 | + pvsid: json["pvsid"], | |
| 260 | + sortname: json["sortname"], | |
| 261 | + twitterid: json["twitterid"], | |
| 262 | + youtubeid: json["youtubeid"], | |
| 263 | + ); | |
| 264 | + | |
| 265 | + Map<String, dynamic> toJson() => { | |
| 266 | + "bioguideid": bioguideid, | |
| 267 | + "birthday": "${birthday.year.toString().padLeft(4, '0')}-${birthday.month.toString().padLeft(2, '0')}-${birthday.day.toString().padLeft(2, '0')}", | |
| 268 | + "cspanid": cspanid, | |
| 269 | + "firstname": firstname, | |
| 270 | + "gender": genderValues.reverse[gender], | |
| 271 | + "gender_label": genderLabelValues.reverse[genderLabel], | |
| 272 | + "id": id, | |
| 273 | + "lastname": lastname, | |
| 274 | + "link": link, | |
| 275 | + "middlename": middlename, | |
| 276 | + "name": name, | |
| 277 | + "namemod": namemodValues.reverse[namemod], | |
| 278 | + "nickname": nickname, | |
| 279 | + "osid": osid, | |
| 280 | + "pvsid": pvsid, | |
| 281 | + "sortname": sortname, | |
| 282 | + "twitterid": twitterid, | |
| 283 | + "youtubeid": youtubeid, | |
| 284 | + }; | |
| 285 | +} | |
| 286 | + | |
| 287 | +enum Gender { | |
| 288 | + MALE, | |
| 289 | + FEMALE | |
| 290 | +} | |
| 291 | + | |
| 292 | +final genderValues = EnumValues({ | |
| 293 | + "male": Gender.MALE, | |
| 294 | + "female": Gender.FEMALE | |
| 295 | +}); | |
| 296 | + | |
| 297 | +enum GenderLabel { | |
| 298 | + MALE, | |
| 299 | + FEMALE | |
| 300 | +} | |
| 301 | + | |
| 302 | +final genderLabelValues = EnumValues({ | |
| 303 | + "Male": GenderLabel.MALE, | |
| 304 | + "Female": GenderLabel.FEMALE | |
| 305 | +}); | |
| 306 | + | |
| 307 | +enum Namemod { | |
| 308 | + EMPTY, | |
| 309 | + III, | |
| 310 | + JR | |
| 311 | +} | |
| 312 | + | |
| 313 | +final namemodValues = EnumValues({ | |
| 314 | + "": Namemod.EMPTY, | |
| 315 | + "III": Namemod.III, | |
| 316 | + "Jr.": Namemod.JR | |
| 317 | +}); | |
| 318 | + | |
| 319 | +enum RoleType { | |
| 320 | + SENATOR | |
| 321 | +} | |
| 322 | + | |
| 323 | +final roleTypeValues = EnumValues({ | |
| 324 | + "senator": RoleType.SENATOR | |
| 325 | +}); | |
| 326 | + | |
| 327 | +enum RoleTypeLabel { | |
| 328 | + SENATOR | |
| 329 | +} | |
| 330 | + | |
| 331 | +final roleTypeLabelValues = EnumValues({ | |
| 332 | + "Senator": RoleTypeLabel.SENATOR | |
| 333 | +}); | |
| 334 | + | |
| 335 | +enum SenatorClass { | |
| 336 | + CLASS2, | |
| 337 | + CLASS1, | |
| 338 | + CLASS3 | |
| 339 | +} | |
| 340 | + | |
| 341 | +final senatorClassValues = EnumValues({ | |
| 342 | + "class2": SenatorClass.CLASS2, | |
| 343 | + "class1": SenatorClass.CLASS1, | |
| 344 | + "class3": SenatorClass.CLASS3 | |
| 345 | +}); | |
| 346 | + | |
| 347 | +enum SenatorClassLabel { | |
| 348 | + CLASS_2, | |
| 349 | + CLASS_1, | |
| 350 | + CLASS_3 | |
| 351 | +} | |
| 352 | + | |
| 353 | +final senatorClassLabelValues = EnumValues({ | |
| 354 | + "Class 2": SenatorClassLabel.CLASS_2, | |
| 355 | + "Class 1": SenatorClassLabel.CLASS_1, | |
| 356 | + "Class 3": SenatorClassLabel.CLASS_3 | |
| 357 | +}); | |
| 358 | + | |
| 359 | +enum SenatorRank { | |
| 360 | + SENIOR, | |
| 361 | + JUNIOR | |
| 362 | +} | |
| 363 | + | |
| 364 | +final senatorRankValues = EnumValues({ | |
| 365 | + "senior": SenatorRank.SENIOR, | |
| 366 | + "junior": SenatorRank.JUNIOR | |
| 367 | +}); | |
| 368 | + | |
| 369 | +enum SenatorRankLabel { | |
| 370 | + SENIOR, | |
| 371 | + JUNIOR | |
| 372 | +} | |
| 373 | + | |
| 374 | +final senatorRankLabelValues = EnumValues({ | |
| 375 | + "Senior": SenatorRankLabel.SENIOR, | |
| 376 | + "Junior": SenatorRankLabel.JUNIOR | |
| 377 | +}); | |
| 378 | + | |
| 379 | +enum Title { | |
| 380 | + SEN | |
| 381 | +} | |
| 382 | + | |
| 383 | +final titleValues = EnumValues({ | |
| 384 | + "Sen.": Title.SEN | |
| 385 | +}); | |
| 386 | + | |
| 387 | +class EnumValues<T> { | |
| 388 | + Map<String, T> map; | |
| 389 | + late Map<T, String> reverseMap; | |
| 390 | + | |
| 391 | + EnumValues(this.map); | |
| 392 | + | |
| 393 | + Map<T, String> get reverse { | |
| 394 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 395 | + return reverseMap; | |
| 396 | + } | |
| 397 | +} |
Test case
1 generated file · +221 −0test/inputs/json/misc/2df80.json
Adartdefault / TopLevel.dart+221 −0
| @@ -0,0 +1,221 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<dynamic> topLevelFromJson(String str) => List<dynamic>.from(json.decode(str).map((x) => x)); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<dynamic> data) => json.encode(List<dynamic>.from(data.map((x) => x))); | |
| 10 | + | |
| 11 | +class TopLevelElement { | |
| 12 | + final Adminregion adminregion; | |
| 13 | + final String capitalCity; | |
| 14 | + final String id; | |
| 15 | + final Adminregion incomeLevel; | |
| 16 | + final String iso2Code; | |
| 17 | + final String latitude; | |
| 18 | + final Adminregion lendingType; | |
| 19 | + final String longitude; | |
| 20 | + final String name; | |
| 21 | + final Adminregion region; | |
| 22 | + | |
| 23 | + TopLevelElement({ | |
| 24 | + required this.adminregion, | |
| 25 | + required this.capitalCity, | |
| 26 | + required this.id, | |
| 27 | + required this.incomeLevel, | |
| 28 | + required this.iso2Code, | |
| 29 | + required this.latitude, | |
| 30 | + required this.lendingType, | |
| 31 | + required this.longitude, | |
| 32 | + required this.name, | |
| 33 | + required this.region, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TopLevelElement.fromJson(Map<String, dynamic> json) => TopLevelElement( | |
| 37 | + adminregion: Adminregion.fromJson(json["adminregion"]), | |
| 38 | + capitalCity: json["capitalCity"], | |
| 39 | + id: json["id"], | |
| 40 | + incomeLevel: Adminregion.fromJson(json["incomeLevel"]), | |
| 41 | + iso2Code: json["iso2Code"], | |
| 42 | + latitude: json["latitude"], | |
| 43 | + lendingType: Adminregion.fromJson(json["lendingType"]), | |
| 44 | + longitude: json["longitude"], | |
| 45 | + name: json["name"], | |
| 46 | + region: Adminregion.fromJson(json["region"]), | |
| 47 | + ); | |
| 48 | + | |
| 49 | + Map<String, dynamic> toJson() => { | |
| 50 | + "adminregion": adminregion.toJson(), | |
| 51 | + "capitalCity": capitalCity, | |
| 52 | + "id": id, | |
| 53 | + "incomeLevel": incomeLevel.toJson(), | |
| 54 | + "iso2Code": iso2Code, | |
| 55 | + "latitude": latitude, | |
| 56 | + "lendingType": lendingType.toJson(), | |
| 57 | + "longitude": longitude, | |
| 58 | + "name": name, | |
| 59 | + "region": region.toJson(), | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +class Adminregion { | |
| 64 | + final Id id; | |
| 65 | + final Value value; | |
| 66 | + | |
| 67 | + Adminregion({ | |
| 68 | + required this.id, | |
| 69 | + required this.value, | |
| 70 | + }); | |
| 71 | + | |
| 72 | + factory Adminregion.fromJson(Map<String, dynamic> json) => Adminregion( | |
| 73 | + id: idValues.map[json["id"]]!, | |
| 74 | + value: valueValues.map[json["value"]]!, | |
| 75 | + ); | |
| 76 | + | |
| 77 | + Map<String, dynamic> toJson() => { | |
| 78 | + "id": idValues.reverse[id], | |
| 79 | + "value": valueValues.reverse[value], | |
| 80 | + }; | |
| 81 | +} | |
| 82 | + | |
| 83 | +enum Id { | |
| 84 | + EMPTY, | |
| 85 | + SAS, | |
| 86 | + SSA, | |
| 87 | + ECA, | |
| 88 | + LAC, | |
| 89 | + EAP, | |
| 90 | + MNA, | |
| 91 | + HIC, | |
| 92 | + LIC, | |
| 93 | + NA, | |
| 94 | + LMC, | |
| 95 | + UMC, | |
| 96 | + LNX, | |
| 97 | + IDX, | |
| 98 | + IBD, | |
| 99 | + IDB, | |
| 100 | + LCN, | |
| 101 | + SSF, | |
| 102 | + ECS, | |
| 103 | + MEA, | |
| 104 | + EAS, | |
| 105 | + NAC | |
| 106 | +} | |
| 107 | + | |
| 108 | +final idValues = EnumValues({ | |
| 109 | + "": Id.EMPTY, | |
| 110 | + "SAS": Id.SAS, | |
| 111 | + "SSA": Id.SSA, | |
| 112 | + "ECA": Id.ECA, | |
| 113 | + "LAC": Id.LAC, | |
| 114 | + "EAP": Id.EAP, | |
| 115 | + "MNA": Id.MNA, | |
| 116 | + "HIC": Id.HIC, | |
| 117 | + "LIC": Id.LIC, | |
| 118 | + "NA": Id.NA, | |
| 119 | + "LMC": Id.LMC, | |
| 120 | + "UMC": Id.UMC, | |
| 121 | + "LNX": Id.LNX, | |
| 122 | + "IDX": Id.IDX, | |
| 123 | + "IBD": Id.IBD, | |
| 124 | + "IDB": Id.IDB, | |
| 125 | + "LCN": Id.LCN, | |
| 126 | + "SSF": Id.SSF, | |
| 127 | + "ECS": Id.ECS, | |
| 128 | + "MEA": Id.MEA, | |
| 129 | + "EAS": Id.EAS, | |
| 130 | + "NAC": Id.NAC | |
| 131 | +}); | |
| 132 | + | |
| 133 | +enum Value { | |
| 134 | + EMPTY, | |
| 135 | + SOUTH_ASIA, | |
| 136 | + SUB_SAHARAN_AFRICA_EXCLUDING_HIGH_INCOME, | |
| 137 | + EUROPE_CENTRAL_ASIA_EXCLUDING_HIGH_INCOME, | |
| 138 | + LATIN_AMERICA_CARIBBEAN_EXCLUDING_HIGH_INCOME, | |
| 139 | + EAST_ASIA_PACIFIC_EXCLUDING_HIGH_INCOME, | |
| 140 | + MIDDLE_EAST_NORTH_AFRICA_EXCLUDING_HIGH_INCOME, | |
| 141 | + HIGH_INCOME, | |
| 142 | + LOW_INCOME, | |
| 143 | + AGGREGATES, | |
| 144 | + LOWER_MIDDLE_INCOME, | |
| 145 | + UPPER_MIDDLE_INCOME, | |
| 146 | + NOT_CLASSIFIED, | |
| 147 | + IDA, | |
| 148 | + IBRD, | |
| 149 | + BLEND, | |
| 150 | + LATIN_AMERICA_CARIBBEAN, | |
| 151 | + SUB_SAHARAN_AFRICA, | |
| 152 | + EUROPE_CENTRAL_ASIA, | |
| 153 | + MIDDLE_EAST_NORTH_AFRICA, | |
| 154 | + EAST_ASIA_PACIFIC, | |
| 155 | + NORTH_AMERICA | |
| 156 | +} | |
| 157 | + | |
| 158 | +final valueValues = EnumValues({ | |
| 159 | + "": Value.EMPTY, | |
| 160 | + "South Asia": Value.SOUTH_ASIA, | |
| 161 | + "Sub-Saharan Africa (excluding high income)": Value.SUB_SAHARAN_AFRICA_EXCLUDING_HIGH_INCOME, | |
| 162 | + "Europe & Central Asia (excluding high income)": Value.EUROPE_CENTRAL_ASIA_EXCLUDING_HIGH_INCOME, | |
| 163 | + "Latin America & Caribbean (excluding high income)": Value.LATIN_AMERICA_CARIBBEAN_EXCLUDING_HIGH_INCOME, | |
| 164 | + "East Asia & Pacific (excluding high income)": Value.EAST_ASIA_PACIFIC_EXCLUDING_HIGH_INCOME, | |
| 165 | + "Middle East & North Africa (excluding high income)": Value.MIDDLE_EAST_NORTH_AFRICA_EXCLUDING_HIGH_INCOME, | |
| 166 | + "High income": Value.HIGH_INCOME, | |
| 167 | + "Low income": Value.LOW_INCOME, | |
| 168 | + "Aggregates": Value.AGGREGATES, | |
| 169 | + "Lower middle income": Value.LOWER_MIDDLE_INCOME, | |
| 170 | + "Upper middle income": Value.UPPER_MIDDLE_INCOME, | |
| 171 | + "Not classified": Value.NOT_CLASSIFIED, | |
| 172 | + "IDA": Value.IDA, | |
| 173 | + "IBRD": Value.IBRD, | |
| 174 | + "Blend": Value.BLEND, | |
| 175 | + "Latin America & Caribbean ": Value.LATIN_AMERICA_CARIBBEAN, | |
| 176 | + "Sub-Saharan Africa ": Value.SUB_SAHARAN_AFRICA, | |
| 177 | + "Europe & Central Asia": Value.EUROPE_CENTRAL_ASIA, | |
| 178 | + "Middle East & North Africa": Value.MIDDLE_EAST_NORTH_AFRICA, | |
| 179 | + "East Asia & Pacific": Value.EAST_ASIA_PACIFIC, | |
| 180 | + "North America": Value.NORTH_AMERICA | |
| 181 | +}); | |
| 182 | + | |
| 183 | +class PurpleTopLevel { | |
| 184 | + final int page; | |
| 185 | + final int pages; | |
| 186 | + final String perPage; | |
| 187 | + final int total; | |
| 188 | + | |
| 189 | + PurpleTopLevel({ | |
| 190 | + required this.page, | |
| 191 | + required this.pages, | |
| 192 | + required this.perPage, | |
| 193 | + required this.total, | |
| 194 | + }); | |
| 195 | + | |
| 196 | + factory PurpleTopLevel.fromJson(Map<String, dynamic> json) => PurpleTopLevel( | |
| 197 | + page: json["page"], | |
| 198 | + pages: json["pages"], | |
| 199 | + perPage: json["per_page"], | |
| 200 | + total: json["total"], | |
| 201 | + ); | |
| 202 | + | |
| 203 | + Map<String, dynamic> toJson() => { | |
| 204 | + "page": page, | |
| 205 | + "pages": pages, | |
| 206 | + "per_page": perPage, | |
| 207 | + "total": total, | |
| 208 | + }; | |
| 209 | +} | |
| 210 | + | |
| 211 | +class EnumValues<T> { | |
| 212 | + Map<String, T> map; | |
| 213 | + late Map<T, String> reverseMap; | |
| 214 | + | |
| 215 | + EnumValues(this.map); | |
| 216 | + | |
| 217 | + Map<T, String> get reverse { | |
| 218 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 219 | + return reverseMap; | |
| 220 | + } | |
| 221 | +} |
Test case
1 generated file · +117 −0test/inputs/json/misc/31189.json
Adartdefault / TopLevel.dart+117 −0
| @@ -0,0 +1,117 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String details; | |
| 13 | + final List<Rate> rates; | |
| 14 | + final dynamic version; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.details, | |
| 18 | + required this.rates, | |
| 19 | + required this.version, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + details: json["details"], | |
| 24 | + rates: List<Rate>.from(json["rates"].map((x) => Rate.fromJson(x))), | |
| 25 | + version: json["version"], | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "details": details, | |
| 30 | + "rates": List<dynamic>.from(rates.map((x) => x.toJson())), | |
| 31 | + "version": version, | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Rate { | |
| 36 | + final String code; | |
| 37 | + final String countryCode; | |
| 38 | + final String name; | |
| 39 | + final List<Period> periods; | |
| 40 | + | |
| 41 | + Rate({ | |
| 42 | + required this.code, | |
| 43 | + required this.countryCode, | |
| 44 | + required this.name, | |
| 45 | + required this.periods, | |
| 46 | + }); | |
| 47 | + | |
| 48 | + factory Rate.fromJson(Map<String, dynamic> json) => Rate( | |
| 49 | + code: json["code"], | |
| 50 | + countryCode: json["country_code"], | |
| 51 | + name: json["name"], | |
| 52 | + periods: List<Period>.from(json["periods"].map((x) => Period.fromJson(x))), | |
| 53 | + ); | |
| 54 | + | |
| 55 | + Map<String, dynamic> toJson() => { | |
| 56 | + "code": code, | |
| 57 | + "country_code": countryCode, | |
| 58 | + "name": name, | |
| 59 | + "periods": List<dynamic>.from(periods.map((x) => x.toJson())), | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +class Period { | |
| 64 | + final DateTime effectiveFrom; | |
| 65 | + final Rates rates; | |
| 66 | + | |
| 67 | + Period({ | |
| 68 | + required this.effectiveFrom, | |
| 69 | + required this.rates, | |
| 70 | + }); | |
| 71 | + | |
| 72 | + factory Period.fromJson(Map<String, dynamic> json) => Period( | |
| 73 | + effectiveFrom: DateTime.parse(json["effective_from"]), | |
| 74 | + rates: Rates.fromJson(json["rates"]), | |
| 75 | + ); | |
| 76 | + | |
| 77 | + Map<String, dynamic> toJson() => { | |
| 78 | + "effective_from": "${effectiveFrom.year.toString().padLeft(4, '0')}-${effectiveFrom.month.toString().padLeft(2, '0')}-${effectiveFrom.day.toString().padLeft(2, '0')}", | |
| 79 | + "rates": rates.toJson(), | |
| 80 | + }; | |
| 81 | +} | |
| 82 | + | |
| 83 | +class Rates { | |
| 84 | + final double? parking; | |
| 85 | + final double? reduced; | |
| 86 | + final double? reduced1; | |
| 87 | + final double? reduced2; | |
| 88 | + final double standard; | |
| 89 | + final double? superReduced; | |
| 90 | + | |
| 91 | + Rates({ | |
| 92 | + this.parking, | |
| 93 | + this.reduced, | |
| 94 | + this.reduced1, | |
| 95 | + this.reduced2, | |
| 96 | + required this.standard, | |
| 97 | + this.superReduced, | |
| 98 | + }); | |
| 99 | + | |
| 100 | + factory Rates.fromJson(Map<String, dynamic> json) => Rates( | |
| 101 | + parking: json["parking"]?.toDouble(), | |
| 102 | + reduced: json["reduced"]?.toDouble(), | |
| 103 | + reduced1: json["reduced1"]?.toDouble(), | |
| 104 | + reduced2: json["reduced2"]?.toDouble(), | |
| 105 | + standard: json["standard"]?.toDouble(), | |
| 106 | + superReduced: json["super_reduced"]?.toDouble(), | |
| 107 | + ); | |
| 108 | + | |
| 109 | + Map<String, dynamic> toJson() => { | |
| 110 | + "parking": parking, | |
| 111 | + "reduced": reduced, | |
| 112 | + "reduced1": reduced1, | |
| 113 | + "reduced2": reduced2, | |
| 114 | + "standard": standard, | |
| 115 | + "super_reduced": superReduced, | |
| 116 | + }; | |
| 117 | +} |
Test case
1 generated file · +295 −0test/inputs/json/misc/32431.json
Adartdefault / TopLevel.dart+295 −0
| @@ -0,0 +1,295 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<double> bbox; | |
| 13 | + final List<Feature> features; | |
| 14 | + final Metadata metadata; | |
| 15 | + final String type; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.bbox, | |
| 19 | + required this.features, | |
| 20 | + required this.metadata, | |
| 21 | + required this.type, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + bbox: List<double>.from(json["bbox"].map((x) => x?.toDouble())), | |
| 26 | + features: List<Feature>.from(json["features"].map((x) => Feature.fromJson(x))), | |
| 27 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 28 | + type: json["type"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "bbox": List<dynamic>.from(bbox.map((x) => x)), | |
| 33 | + "features": List<dynamic>.from(features.map((x) => x.toJson())), | |
| 34 | + "metadata": metadata.toJson(), | |
| 35 | + "type": type, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Feature { | |
| 40 | + final Geometry geometry; | |
| 41 | + final String id; | |
| 42 | + final Properties properties; | |
| 43 | + final FeatureType type; | |
| 44 | + | |
| 45 | + Feature({ | |
| 46 | + required this.geometry, | |
| 47 | + required this.id, | |
| 48 | + required this.properties, | |
| 49 | + required this.type, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory Feature.fromJson(Map<String, dynamic> json) => Feature( | |
| 53 | + geometry: Geometry.fromJson(json["geometry"]), | |
| 54 | + id: json["id"], | |
| 55 | + properties: Properties.fromJson(json["properties"]), | |
| 56 | + type: featureTypeValues.map[json["type"]]!, | |
| 57 | + ); | |
| 58 | + | |
| 59 | + Map<String, dynamic> toJson() => { | |
| 60 | + "geometry": geometry.toJson(), | |
| 61 | + "id": id, | |
| 62 | + "properties": properties.toJson(), | |
| 63 | + "type": featureTypeValues.reverse[type], | |
| 64 | + }; | |
| 65 | +} | |
| 66 | + | |
| 67 | +class Geometry { | |
| 68 | + final List<double> coordinates; | |
| 69 | + final GeometryType type; | |
| 70 | + | |
| 71 | + Geometry({ | |
| 72 | + required this.coordinates, | |
| 73 | + required this.type, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Geometry.fromJson(Map<String, dynamic> json) => Geometry( | |
| 77 | + coordinates: List<double>.from(json["coordinates"].map((x) => x?.toDouble())), | |
| 78 | + type: geometryTypeValues.map[json["type"]]!, | |
| 79 | + ); | |
| 80 | + | |
| 81 | + Map<String, dynamic> toJson() => { | |
| 82 | + "coordinates": List<dynamic>.from(coordinates.map((x) => x)), | |
| 83 | + "type": geometryTypeValues.reverse[type], | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +enum GeometryType { | |
| 88 | + POINT | |
| 89 | +} | |
| 90 | + | |
| 91 | +final geometryTypeValues = EnumValues({ | |
| 92 | + "Point": GeometryType.POINT | |
| 93 | +}); | |
| 94 | + | |
| 95 | +class Properties { | |
| 96 | + final dynamic alert; | |
| 97 | + final dynamic cdi; | |
| 98 | + final String code; | |
| 99 | + final String detail; | |
| 100 | + final double? dmin; | |
| 101 | + final dynamic felt; | |
| 102 | + final int? gap; | |
| 103 | + final String ids; | |
| 104 | + final double mag; | |
| 105 | + final MagType magType; | |
| 106 | + final dynamic mmi; | |
| 107 | + final String net; | |
| 108 | + final int? nst; | |
| 109 | + final String place; | |
| 110 | + final double rms; | |
| 111 | + final int sig; | |
| 112 | + final String sources; | |
| 113 | + final Status status; | |
| 114 | + final int time; | |
| 115 | + final String title; | |
| 116 | + final int tsunami; | |
| 117 | + final PropertiesType type; | |
| 118 | + final String types; | |
| 119 | + final int tz; | |
| 120 | + final int updated; | |
| 121 | + final String url; | |
| 122 | + | |
| 123 | + Properties({ | |
| 124 | + required this.alert, | |
| 125 | + required this.cdi, | |
| 126 | + required this.code, | |
| 127 | + required this.detail, | |
| 128 | + required this.dmin, | |
| 129 | + required this.felt, | |
| 130 | + required this.gap, | |
| 131 | + required this.ids, | |
| 132 | + required this.mag, | |
| 133 | + required this.magType, | |
| 134 | + required this.mmi, | |
| 135 | + required this.net, | |
| 136 | + required this.nst, | |
| 137 | + required this.place, | |
| 138 | + required this.rms, | |
| 139 | + required this.sig, | |
| 140 | + required this.sources, | |
| 141 | + required this.status, | |
| 142 | + required this.time, | |
| 143 | + required this.title, | |
| 144 | + required this.tsunami, | |
| 145 | + required this.type, | |
| 146 | + required this.types, | |
| 147 | + required this.tz, | |
| 148 | + required this.updated, | |
| 149 | + required this.url, | |
| 150 | + }); | |
| 151 | + | |
| 152 | + factory Properties.fromJson(Map<String, dynamic> json) => Properties( | |
| 153 | + alert: json["alert"], | |
| 154 | + cdi: json["cdi"], | |
| 155 | + code: json["code"], | |
| 156 | + detail: json["detail"], | |
| 157 | + dmin: json["dmin"]?.toDouble(), | |
| 158 | + felt: json["felt"], | |
| 159 | + gap: json["gap"], | |
| 160 | + ids: json["ids"], | |
| 161 | + mag: json["mag"]?.toDouble(), | |
| 162 | + magType: magTypeValues.map[json["magType"]]!, | |
| 163 | + mmi: json["mmi"], | |
| 164 | + net: json["net"], | |
| 165 | + nst: json["nst"], | |
| 166 | + place: json["place"], | |
| 167 | + rms: json["rms"]?.toDouble(), | |
| 168 | + sig: json["sig"], | |
| 169 | + sources: json["sources"], | |
| 170 | + status: statusValues.map[json["status"]]!, | |
| 171 | + time: json["time"], | |
| 172 | + title: json["title"], | |
| 173 | + tsunami: json["tsunami"], | |
| 174 | + type: propertiesTypeValues.map[json["type"]]!, | |
| 175 | + types: json["types"], | |
| 176 | + tz: json["tz"], | |
| 177 | + updated: json["updated"], | |
| 178 | + url: json["url"], | |
| 179 | + ); | |
| 180 | + | |
| 181 | + Map<String, dynamic> toJson() => { | |
| 182 | + "alert": alert, | |
| 183 | + "cdi": cdi, | |
| 184 | + "code": code, | |
| 185 | + "detail": detail, | |
| 186 | + "dmin": dmin, | |
| 187 | + "felt": felt, | |
| 188 | + "gap": gap, | |
| 189 | + "ids": ids, | |
| 190 | + "mag": mag, | |
| 191 | + "magType": magTypeValues.reverse[magType], | |
| 192 | + "mmi": mmi, | |
| 193 | + "net": net, | |
| 194 | + "nst": nst, | |
| 195 | + "place": place, | |
| 196 | + "rms": rms, | |
| 197 | + "sig": sig, | |
| 198 | + "sources": sources, | |
| 199 | + "status": statusValues.reverse[status], | |
| 200 | + "time": time, | |
| 201 | + "title": title, | |
| 202 | + "tsunami": tsunami, | |
| 203 | + "type": propertiesTypeValues.reverse[type], | |
| 204 | + "types": types, | |
| 205 | + "tz": tz, | |
| 206 | + "updated": updated, | |
| 207 | + "url": url, | |
| 208 | + }; | |
| 209 | +} | |
| 210 | + | |
| 211 | +enum MagType { | |
| 212 | + MD, | |
| 213 | + ML, | |
| 214 | + MB | |
| 215 | +} | |
| 216 | + | |
| 217 | +final magTypeValues = EnumValues({ | |
| 218 | + "md": MagType.MD, | |
| 219 | + "ml": MagType.ML, | |
| 220 | + "mb": MagType.MB | |
| 221 | +}); | |
| 222 | + | |
| 223 | +enum Status { | |
| 224 | + AUTOMATIC, | |
| 225 | + REVIEWED | |
| 226 | +} | |
| 227 | + | |
| 228 | +final statusValues = EnumValues({ | |
| 229 | + "automatic": Status.AUTOMATIC, | |
| 230 | + "reviewed": Status.REVIEWED | |
| 231 | +}); | |
| 232 | + | |
| 233 | +enum PropertiesType { | |
| 234 | + EARTHQUAKE | |
| 235 | +} | |
| 236 | + | |
| 237 | +final propertiesTypeValues = EnumValues({ | |
| 238 | + "earthquake": PropertiesType.EARTHQUAKE | |
| 239 | +}); | |
| 240 | + | |
| 241 | +enum FeatureType { | |
| 242 | + FEATURE | |
| 243 | +} | |
| 244 | + | |
| 245 | +final featureTypeValues = EnumValues({ | |
| 246 | + "Feature": FeatureType.FEATURE | |
| 247 | +}); | |
| 248 | + | |
| 249 | +class Metadata { | |
| 250 | + final String api; | |
| 251 | + final int count; | |
| 252 | + final int generated; | |
| 253 | + final int status; | |
| 254 | + final String title; | |
| 255 | + final String url; | |
| 256 | + | |
| 257 | + Metadata({ | |
| 258 | + required this.api, | |
| 259 | + required this.count, | |
| 260 | + required this.generated, | |
| 261 | + required this.status, | |
| 262 | + required this.title, | |
| 263 | + required this.url, | |
| 264 | + }); | |
| 265 | + | |
| 266 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 267 | + api: json["api"], | |
| 268 | + count: json["count"], | |
| 269 | + generated: json["generated"], | |
| 270 | + status: json["status"], | |
| 271 | + title: json["title"], | |
| 272 | + url: json["url"], | |
| 273 | + ); | |
| 274 | + | |
| 275 | + Map<String, dynamic> toJson() => { | |
| 276 | + "api": api, | |
| 277 | + "count": count, | |
| 278 | + "generated": generated, | |
| 279 | + "status": status, | |
| 280 | + "title": title, | |
| 281 | + "url": url, | |
| 282 | + }; | |
| 283 | +} | |
| 284 | + | |
| 285 | +class EnumValues<T> { | |
| 286 | + Map<String, T> map; | |
| 287 | + late Map<T, String> reverseMap; | |
| 288 | + | |
| 289 | + EnumValues(this.map); | |
| 290 | + | |
| 291 | + Map<T, String> get reverse { | |
| 292 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 293 | + return reverseMap; | |
| 294 | + } | |
| 295 | +} |
Test case
1 generated file · +53 −0test/inputs/json/misc/32d5c.json
Adartdefault / TopLevel.dart+53 −0
| @@ -0,0 +1,53 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final DateTime? birthDate; | |
| 13 | + final bool birthDateIsProtected; | |
| 14 | + final int genderTypeId; | |
| 15 | + final String notes; | |
| 16 | + final String parliamentaryName; | |
| 17 | + final int personId; | |
| 18 | + final String photoUrl; | |
| 19 | + final String preferredName; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.birthDate, | |
| 23 | + required this.birthDateIsProtected, | |
| 24 | + required this.genderTypeId, | |
| 25 | + required this.notes, | |
| 26 | + required this.parliamentaryName, | |
| 27 | + required this.personId, | |
| 28 | + required this.photoUrl, | |
| 29 | + required this.preferredName, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + birthDate: json["BirthDate"] == null ? null : DateTime.parse(json["BirthDate"]), | |
| 34 | + birthDateIsProtected: json["BirthDateIsProtected"], | |
| 35 | + genderTypeId: json["GenderTypeID"], | |
| 36 | + notes: json["Notes"], | |
| 37 | + parliamentaryName: json["ParliamentaryName"], | |
| 38 | + personId: json["PersonID"], | |
| 39 | + photoUrl: json["PhotoURL"], | |
| 40 | + preferredName: json["PreferredName"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "BirthDate": birthDate?.toIso8601String(), | |
| 45 | + "BirthDateIsProtected": birthDateIsProtected, | |
| 46 | + "GenderTypeID": genderTypeId, | |
| 47 | + "Notes": notes, | |
| 48 | + "ParliamentaryName": parliamentaryName, | |
| 49 | + "PersonID": personId, | |
| 50 | + "PhotoURL": photoUrl, | |
| 51 | + "PreferredName": preferredName, | |
| 52 | + }; | |
| 53 | +} |
Test case
1 generated file · +287 −0test/inputs/json/misc/337ed.json
Adartdefault / TopLevel.dart+287 −0
| @@ -0,0 +1,287 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final String next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final int? costAbsolute; | |
| 63 | + final int? costMax; | |
| 64 | + final int? costMin; | |
| 65 | + final DateTime createdAt; | |
| 66 | + final List<CustomIncome> customIncomes; | |
| 67 | + final dynamic directRepCostsMax; | |
| 68 | + final dynamic directRepCostsMin; | |
| 69 | + final DateTime endDate; | |
| 70 | + final int eurSourcesGrants; | |
| 71 | + final String? eurSourcesGrantsSrc; | |
| 72 | + final int eurSourcesProcurement; | |
| 73 | + final String? eurSourcesProcurementSrc; | |
| 74 | + final String id; | |
| 75 | + final dynamic newOrganisation; | |
| 76 | + final String? noClients; | |
| 77 | + final String? otherFinancialInformation; | |
| 78 | + final int? otherSourcesContributions; | |
| 79 | + final int? otherSourcesDonation; | |
| 80 | + final int? otherSourcesTotal; | |
| 81 | + final int? publicFinancingInfranational; | |
| 82 | + final int? publicFinancingNational; | |
| 83 | + final int? publicFinancingTotal; | |
| 84 | + final String representative; | |
| 85 | + final DateTime startDate; | |
| 86 | + final Status status; | |
| 87 | + final int? totalBudget; | |
| 88 | + final int? turnoverAbsolute; | |
| 89 | + final int? turnoverMax; | |
| 90 | + final int? turnoverMin; | |
| 91 | + final ResultType type; | |
| 92 | + final DateTime updatedAt; | |
| 93 | + final String uri; | |
| 94 | + | |
| 95 | + Result({ | |
| 96 | + required this.costAbsolute, | |
| 97 | + required this.costMax, | |
| 98 | + required this.costMin, | |
| 99 | + required this.createdAt, | |
| 100 | + required this.customIncomes, | |
| 101 | + required this.directRepCostsMax, | |
| 102 | + required this.directRepCostsMin, | |
| 103 | + required this.endDate, | |
| 104 | + required this.eurSourcesGrants, | |
| 105 | + required this.eurSourcesGrantsSrc, | |
| 106 | + required this.eurSourcesProcurement, | |
| 107 | + required this.eurSourcesProcurementSrc, | |
| 108 | + required this.id, | |
| 109 | + required this.newOrganisation, | |
| 110 | + required this.noClients, | |
| 111 | + required this.otherFinancialInformation, | |
| 112 | + required this.otherSourcesContributions, | |
| 113 | + required this.otherSourcesDonation, | |
| 114 | + required this.otherSourcesTotal, | |
| 115 | + required this.publicFinancingInfranational, | |
| 116 | + required this.publicFinancingNational, | |
| 117 | + required this.publicFinancingTotal, | |
| 118 | + required this.representative, | |
| 119 | + required this.startDate, | |
| 120 | + required this.status, | |
| 121 | + required this.totalBudget, | |
| 122 | + required this.turnoverAbsolute, | |
| 123 | + required this.turnoverMax, | |
| 124 | + required this.turnoverMin, | |
| 125 | + required this.type, | |
| 126 | + required this.updatedAt, | |
| 127 | + required this.uri, | |
| 128 | + }); | |
| 129 | + | |
| 130 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 131 | + costAbsolute: json["cost_absolute"], | |
| 132 | + costMax: json["cost_max"], | |
| 133 | + costMin: json["cost_min"], | |
| 134 | + createdAt: DateTime.parse(json["created_at"]), | |
| 135 | + customIncomes: List<CustomIncome>.from(json["customIncomes"].map((x) => CustomIncome.fromJson(x))), | |
| 136 | + directRepCostsMax: json["direct_rep_costs_max"], | |
| 137 | + directRepCostsMin: json["direct_rep_costs_min"], | |
| 138 | + endDate: DateTime.parse(json["end_date"]), | |
| 139 | + eurSourcesGrants: json["eur_sources_grants"], | |
| 140 | + eurSourcesGrantsSrc: json["eur_sources_grants_src"], | |
| 141 | + eurSourcesProcurement: json["eur_sources_procurement"], | |
| 142 | + eurSourcesProcurementSrc: json["eur_sources_procurement_src"], | |
| 143 | + id: json["id"], | |
| 144 | + newOrganisation: json["new_organisation"], | |
| 145 | + noClients: json["no_clients"], | |
| 146 | + otherFinancialInformation: json["other_financial_information"], | |
| 147 | + otherSourcesContributions: json["other_sources_contributions"], | |
| 148 | + otherSourcesDonation: json["other_sources_donation"], | |
| 149 | + otherSourcesTotal: json["other_sources_total"], | |
| 150 | + publicFinancingInfranational: json["public_financing_infranational"], | |
| 151 | + publicFinancingNational: json["public_financing_national"], | |
| 152 | + publicFinancingTotal: json["public_financing_total"], | |
| 153 | + representative: json["representative"], | |
| 154 | + startDate: DateTime.parse(json["start_date"]), | |
| 155 | + status: statusValues.map[json["status"]]!, | |
| 156 | + totalBudget: json["total_budget"], | |
| 157 | + turnoverAbsolute: json["turnover_absolute"], | |
| 158 | + turnoverMax: json["turnover_max"], | |
| 159 | + turnoverMin: json["turnover_min"], | |
| 160 | + type: resultTypeValues.map[json["type"]]!, | |
| 161 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 162 | + uri: json["uri"], | |
| 163 | + ); | |
| 164 | + | |
| 165 | + Map<String, dynamic> toJson() => { | |
| 166 | + "cost_absolute": costAbsolute, | |
| 167 | + "cost_max": costMax, | |
| 168 | + "cost_min": costMin, | |
| 169 | + "created_at": createdAt.toIso8601String(), | |
| 170 | + "customIncomes": List<dynamic>.from(customIncomes.map((x) => x.toJson())), | |
| 171 | + "direct_rep_costs_max": directRepCostsMax, | |
| 172 | + "direct_rep_costs_min": directRepCostsMin, | |
| 173 | + "end_date": endDate.toIso8601String(), | |
| 174 | + "eur_sources_grants": eurSourcesGrants, | |
| 175 | + "eur_sources_grants_src": eurSourcesGrantsSrc, | |
| 176 | + "eur_sources_procurement": eurSourcesProcurement, | |
| 177 | + "eur_sources_procurement_src": eurSourcesProcurementSrc, | |
| 178 | + "id": id, | |
| 179 | + "new_organisation": newOrganisation, | |
| 180 | + "no_clients": noClients, | |
| 181 | + "other_financial_information": otherFinancialInformation, | |
| 182 | + "other_sources_contributions": otherSourcesContributions, | |
| 183 | + "other_sources_donation": otherSourcesDonation, | |
| 184 | + "other_sources_total": otherSourcesTotal, | |
| 185 | + "public_financing_infranational": publicFinancingInfranational, | |
| 186 | + "public_financing_national": publicFinancingNational, | |
| 187 | + "public_financing_total": publicFinancingTotal, | |
| 188 | + "representative": representative, | |
| 189 | + "start_date": startDate.toIso8601String(), | |
| 190 | + "status": statusValues.reverse[status], | |
| 191 | + "total_budget": totalBudget, | |
| 192 | + "turnover_absolute": turnoverAbsolute, | |
| 193 | + "turnover_max": turnoverMax, | |
| 194 | + "turnover_min": turnoverMin, | |
| 195 | + "type": resultTypeValues.reverse[type], | |
| 196 | + "updated_at": updatedAt.toIso8601String(), | |
| 197 | + "uri": uri, | |
| 198 | + }; | |
| 199 | +} | |
| 200 | + | |
| 201 | +class CustomIncome { | |
| 202 | + final int amount; | |
| 203 | + final DateTime createdAt; | |
| 204 | + final String id; | |
| 205 | + final String name; | |
| 206 | + final Status status; | |
| 207 | + final CustomIncomeType type; | |
| 208 | + final DateTime updatedAt; | |
| 209 | + final String uri; | |
| 210 | + | |
| 211 | + CustomIncome({ | |
| 212 | + required this.amount, | |
| 213 | + required this.createdAt, | |
| 214 | + required this.id, | |
| 215 | + required this.name, | |
| 216 | + required this.status, | |
| 217 | + required this.type, | |
| 218 | + required this.updatedAt, | |
| 219 | + required this.uri, | |
| 220 | + }); | |
| 221 | + | |
| 222 | + factory CustomIncome.fromJson(Map<String, dynamic> json) => CustomIncome( | |
| 223 | + amount: json["amount"], | |
| 224 | + createdAt: DateTime.parse(json["created_at"]), | |
| 225 | + id: json["id"], | |
| 226 | + name: json["name"], | |
| 227 | + status: statusValues.map[json["status"]]!, | |
| 228 | + type: customIncomeTypeValues.map[json["type"]]!, | |
| 229 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 230 | + uri: json["uri"], | |
| 231 | + ); | |
| 232 | + | |
| 233 | + Map<String, dynamic> toJson() => { | |
| 234 | + "amount": amount, | |
| 235 | + "created_at": createdAt.toIso8601String(), | |
| 236 | + "id": id, | |
| 237 | + "name": name, | |
| 238 | + "status": statusValues.reverse[status], | |
| 239 | + "type": customIncomeTypeValues.reverse[type], | |
| 240 | + "updated_at": updatedAt.toIso8601String(), | |
| 241 | + "uri": uri, | |
| 242 | + }; | |
| 243 | +} | |
| 244 | + | |
| 245 | +enum Status { | |
| 246 | + ACTIVE, | |
| 247 | + INACTIVE | |
| 248 | +} | |
| 249 | + | |
| 250 | +final statusValues = EnumValues({ | |
| 251 | + "active": Status.ACTIVE, | |
| 252 | + "inactive": Status.INACTIVE | |
| 253 | +}); | |
| 254 | + | |
| 255 | +enum CustomIncomeType { | |
| 256 | + PUBLIC, | |
| 257 | + OTHER | |
| 258 | +} | |
| 259 | + | |
| 260 | +final customIncomeTypeValues = EnumValues({ | |
| 261 | + "public": CustomIncomeType.PUBLIC, | |
| 262 | + "other": CustomIncomeType.OTHER | |
| 263 | +}); | |
| 264 | + | |
| 265 | +enum ResultType { | |
| 266 | + FINANCIAL_DATA_NGO, | |
| 267 | + FINANCIAL_DATA_LAWYER, | |
| 268 | + FINANCIAL_DATA_TRADE_ASSOCIATION | |
| 269 | +} | |
| 270 | + | |
| 271 | +final resultTypeValues = EnumValues({ | |
| 272 | + "FinancialDataNGO": ResultType.FINANCIAL_DATA_NGO, | |
| 273 | + "FinancialDataLawyer": ResultType.FINANCIAL_DATA_LAWYER, | |
| 274 | + "FinancialDataTradeAssociation": ResultType.FINANCIAL_DATA_TRADE_ASSOCIATION | |
| 275 | +}); | |
| 276 | + | |
| 277 | +class EnumValues<T> { | |
| 278 | + Map<String, T> map; | |
| 279 | + late Map<T, String> reverseMap; | |
| 280 | + | |
| 281 | + EnumValues(this.map); | |
| 282 | + | |
| 283 | + Map<T, String> get reverse { | |
| 284 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 285 | + return reverseMap; | |
| 286 | + } | |
| 287 | +} |
Test case
1 generated file · +203 −0test/inputs/json/misc/33d2e.json
Adartdefault / TopLevel.dart+203 −0
| @@ -0,0 +1,203 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Laureate> laureates; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.laureates, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + laureates: List<Laureate>.from(json["laureates"].map((x) => Laureate.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "laureates": List<dynamic>.from(laureates.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Laureate { | |
| 28 | + final dynamic born; | |
| 29 | + final String? bornCity; | |
| 30 | + final String? bornCountry; | |
| 31 | + final String? bornCountryCode; | |
| 32 | + final dynamic died; | |
| 33 | + final String? diedCity; | |
| 34 | + final String? diedCountry; | |
| 35 | + final String? diedCountryCode; | |
| 36 | + final String? firstname; | |
| 37 | + final Gender gender; | |
| 38 | + final String id; | |
| 39 | + final List<Prize> prizes; | |
| 40 | + final String? surname; | |
| 41 | + | |
| 42 | + Laureate({ | |
| 43 | + required this.born, | |
| 44 | + this.bornCity, | |
| 45 | + this.bornCountry, | |
| 46 | + this.bornCountryCode, | |
| 47 | + required this.died, | |
| 48 | + this.diedCity, | |
| 49 | + this.diedCountry, | |
| 50 | + this.diedCountryCode, | |
| 51 | + this.firstname, | |
| 52 | + required this.gender, | |
| 53 | + required this.id, | |
| 54 | + required this.prizes, | |
| 55 | + this.surname, | |
| 56 | + }); | |
| 57 | + | |
| 58 | + factory Laureate.fromJson(Map<String, dynamic> json) => Laureate( | |
| 59 | + born: json["born"], | |
| 60 | + bornCity: json["bornCity"], | |
| 61 | + bornCountry: json["bornCountry"], | |
| 62 | + bornCountryCode: json["bornCountryCode"], | |
| 63 | + died: json["died"], | |
| 64 | + diedCity: json["diedCity"], | |
| 65 | + diedCountry: json["diedCountry"], | |
| 66 | + diedCountryCode: json["diedCountryCode"], | |
| 67 | + firstname: json["firstname"], | |
| 68 | + gender: genderValues.map[json["gender"]]!, | |
| 69 | + id: json["id"], | |
| 70 | + prizes: List<Prize>.from(json["prizes"].map((x) => Prize.fromJson(x))), | |
| 71 | + surname: json["surname"], | |
| 72 | + ); | |
| 73 | + | |
| 74 | + Map<String, dynamic> toJson() => { | |
| 75 | + "born": born, | |
| 76 | + "bornCity": bornCity, | |
| 77 | + "bornCountry": bornCountry, | |
| 78 | + "bornCountryCode": bornCountryCode, | |
| 79 | + "died": died, | |
| 80 | + "diedCity": diedCity, | |
| 81 | + "diedCountry": diedCountry, | |
| 82 | + "diedCountryCode": diedCountryCode, | |
| 83 | + "firstname": firstname, | |
| 84 | + "gender": genderValues.reverse[gender], | |
| 85 | + "id": id, | |
| 86 | + "prizes": List<dynamic>.from(prizes.map((x) => x.toJson())), | |
| 87 | + "surname": surname, | |
| 88 | + }; | |
| 89 | +} | |
| 90 | + | |
| 91 | +enum BornEnum { | |
| 92 | + THE_00000000, | |
| 93 | + THE_18980000, | |
| 94 | + THE_19430000 | |
| 95 | +} | |
| 96 | + | |
| 97 | +final bornEnumValues = EnumValues({ | |
| 98 | + "0000-00-00": BornEnum.THE_00000000, | |
| 99 | + "1898-00-00": BornEnum.THE_18980000, | |
| 100 | + "1943-00-00": BornEnum.THE_19430000 | |
| 101 | +}); | |
| 102 | + | |
| 103 | +enum Gender { | |
| 104 | + MALE, | |
| 105 | + FEMALE, | |
| 106 | + ORG | |
| 107 | +} | |
| 108 | + | |
| 109 | +final genderValues = EnumValues({ | |
| 110 | + "male": Gender.MALE, | |
| 111 | + "female": Gender.FEMALE, | |
| 112 | + "org": Gender.ORG | |
| 113 | +}); | |
| 114 | + | |
| 115 | +class Prize { | |
| 116 | + final List<dynamic> affiliations; | |
| 117 | + final Category? category; | |
| 118 | + final String? motivation; | |
| 119 | + final String? overallMotivation; | |
| 120 | + final String? share; | |
| 121 | + final String? year; | |
| 122 | + | |
| 123 | + Prize({ | |
| 124 | + required this.affiliations, | |
| 125 | + this.category, | |
| 126 | + this.motivation, | |
| 127 | + this.overallMotivation, | |
| 128 | + this.share, | |
| 129 | + this.year, | |
| 130 | + }); | |
| 131 | + | |
| 132 | + factory Prize.fromJson(Map<String, dynamic> json) => Prize( | |
| 133 | + affiliations: List<dynamic>.from(json["affiliations"].map((x) => x)), | |
| 134 | + category: categoryValues.map[json["category"]], | |
| 135 | + motivation: json["motivation"], | |
| 136 | + overallMotivation: json["overallMotivation"], | |
| 137 | + share: json["share"], | |
| 138 | + year: json["year"], | |
| 139 | + ); | |
| 140 | + | |
| 141 | + Map<String, dynamic> toJson() => { | |
| 142 | + "affiliations": List<dynamic>.from(affiliations.map((x) => x)), | |
| 143 | + "category": categoryValues.reverse[category], | |
| 144 | + "motivation": motivation, | |
| 145 | + "overallMotivation": overallMotivation, | |
| 146 | + "share": share, | |
| 147 | + "year": year, | |
| 148 | + }; | |
| 149 | +} | |
| 150 | + | |
| 151 | +class AffiliationClass { | |
| 152 | + final String? city; | |
| 153 | + final String? country; | |
| 154 | + final String? name; | |
| 155 | + | |
| 156 | + AffiliationClass({ | |
| 157 | + this.city, | |
| 158 | + this.country, | |
| 159 | + this.name, | |
| 160 | + }); | |
| 161 | + | |
| 162 | + factory AffiliationClass.fromJson(Map<String, dynamic> json) => AffiliationClass( | |
| 163 | + city: json["city"], | |
| 164 | + country: json["country"], | |
| 165 | + name: json["name"], | |
| 166 | + ); | |
| 167 | + | |
| 168 | + Map<String, dynamic> toJson() => { | |
| 169 | + "city": city, | |
| 170 | + "country": country, | |
| 171 | + "name": name, | |
| 172 | + }; | |
| 173 | +} | |
| 174 | + | |
| 175 | +enum Category { | |
| 176 | + PHYSICS, | |
| 177 | + CHEMISTRY, | |
| 178 | + PEACE, | |
| 179 | + MEDICINE, | |
| 180 | + LITERATURE, | |
| 181 | + ECONOMICS | |
| 182 | +} | |
| 183 | + | |
| 184 | +final categoryValues = EnumValues({ | |
| 185 | + "physics": Category.PHYSICS, | |
| 186 | + "chemistry": Category.CHEMISTRY, | |
| 187 | + "peace": Category.PEACE, | |
| 188 | + "medicine": Category.MEDICINE, | |
| 189 | + "literature": Category.LITERATURE, | |
| 190 | + "economics": Category.ECONOMICS | |
| 191 | +}); | |
| 192 | + | |
| 193 | +class EnumValues<T> { | |
| 194 | + Map<String, T> map; | |
| 195 | + late Map<T, String> reverseMap; | |
| 196 | + | |
| 197 | + EnumValues(this.map); | |
| 198 | + | |
| 199 | + Map<T, String> get reverse { | |
| 200 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 201 | + return reverseMap; | |
| 202 | + } | |
| 203 | +} |
Test case
1 generated file · +311 −0test/inputs/json/misc/34702.json
Adartdefault / TopLevel.dart+311 −0
| @@ -0,0 +1,311 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Crs crs; | |
| 13 | + final List<Feature> features; | |
| 14 | + final int totalFeatures; | |
| 15 | + final String type; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.crs, | |
| 19 | + required this.features, | |
| 20 | + required this.totalFeatures, | |
| 21 | + required this.type, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + crs: Crs.fromJson(json["crs"]), | |
| 26 | + features: List<Feature>.from(json["features"].map((x) => Feature.fromJson(x))), | |
| 27 | + totalFeatures: json["totalFeatures"], | |
| 28 | + type: json["type"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "crs": crs.toJson(), | |
| 33 | + "features": List<dynamic>.from(features.map((x) => x.toJson())), | |
| 34 | + "totalFeatures": totalFeatures, | |
| 35 | + "type": type, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Crs { | |
| 40 | + final CrsProperties properties; | |
| 41 | + final String type; | |
| 42 | + | |
| 43 | + Crs({ | |
| 44 | + required this.properties, | |
| 45 | + required this.type, | |
| 46 | + }); | |
| 47 | + | |
| 48 | + factory Crs.fromJson(Map<String, dynamic> json) => Crs( | |
| 49 | + properties: CrsProperties.fromJson(json["properties"]), | |
| 50 | + type: json["type"], | |
| 51 | + ); | |
| 52 | + | |
| 53 | + Map<String, dynamic> toJson() => { | |
| 54 | + "properties": properties.toJson(), | |
| 55 | + "type": type, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class CrsProperties { | |
| 60 | + final String name; | |
| 61 | + | |
| 62 | + CrsProperties({ | |
| 63 | + required this.name, | |
| 64 | + }); | |
| 65 | + | |
| 66 | + factory CrsProperties.fromJson(Map<String, dynamic> json) => CrsProperties( | |
| 67 | + name: json["name"], | |
| 68 | + ); | |
| 69 | + | |
| 70 | + Map<String, dynamic> toJson() => { | |
| 71 | + "name": name, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Feature { | |
| 76 | + final Geometry geometry; | |
| 77 | + final GeometryName geometryName; | |
| 78 | + final String id; | |
| 79 | + final FeatureProperties properties; | |
| 80 | + final FeatureType type; | |
| 81 | + | |
| 82 | + Feature({ | |
| 83 | + required this.geometry, | |
| 84 | + required this.geometryName, | |
| 85 | + required this.id, | |
| 86 | + required this.properties, | |
| 87 | + required this.type, | |
| 88 | + }); | |
| 89 | + | |
| 90 | + factory Feature.fromJson(Map<String, dynamic> json) => Feature( | |
| 91 | + geometry: Geometry.fromJson(json["geometry"]), | |
| 92 | + geometryName: geometryNameValues.map[json["geometry_name"]]!, | |
| 93 | + id: json["id"], | |
| 94 | + properties: FeatureProperties.fromJson(json["properties"]), | |
| 95 | + type: featureTypeValues.map[json["type"]]!, | |
| 96 | + ); | |
| 97 | + | |
| 98 | + Map<String, dynamic> toJson() => { | |
| 99 | + "geometry": geometry.toJson(), | |
| 100 | + "geometry_name": geometryNameValues.reverse[geometryName], | |
| 101 | + "id": id, | |
| 102 | + "properties": properties.toJson(), | |
| 103 | + "type": featureTypeValues.reverse[type], | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Geometry { | |
| 108 | + final List<double> coordinates; | |
| 109 | + final GeometryType type; | |
| 110 | + | |
| 111 | + Geometry({ | |
| 112 | + required this.coordinates, | |
| 113 | + required this.type, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory Geometry.fromJson(Map<String, dynamic> json) => Geometry( | |
| 117 | + coordinates: List<double>.from(json["coordinates"].map((x) => x?.toDouble())), | |
| 118 | + type: geometryTypeValues.map[json["type"]]!, | |
| 119 | + ); | |
| 120 | + | |
| 121 | + Map<String, dynamic> toJson() => { | |
| 122 | + "coordinates": List<dynamic>.from(coordinates.map((x) => x)), | |
| 123 | + "type": geometryTypeValues.reverse[type], | |
| 124 | + }; | |
| 125 | +} | |
| 126 | + | |
| 127 | +enum GeometryType { | |
| 128 | + POINT | |
| 129 | +} | |
| 130 | + | |
| 131 | +final geometryTypeValues = EnumValues({ | |
| 132 | + "Point": GeometryType.POINT | |
| 133 | +}); | |
| 134 | + | |
| 135 | +enum GeometryName { | |
| 136 | + GEOM | |
| 137 | +} | |
| 138 | + | |
| 139 | +final geometryNameValues = EnumValues({ | |
| 140 | + "geom": GeometryName.GEOM | |
| 141 | +}); | |
| 142 | + | |
| 143 | +class FeatureProperties { | |
| 144 | + final String division; | |
| 145 | + final double fax; | |
| 146 | + final FireBanR? fireBanR; | |
| 147 | + final double latitude; | |
| 148 | + final String localGovt; | |
| 149 | + final double longitude; | |
| 150 | + final String? no; | |
| 151 | + final double phone; | |
| 152 | + final int postcode; | |
| 153 | + final String psa; | |
| 154 | + final Region region; | |
| 155 | + final String station; | |
| 156 | + final String street; | |
| 157 | + final String suburb; | |
| 158 | + final PropertiesType? type; | |
| 159 | + | |
| 160 | + FeatureProperties({ | |
| 161 | + required this.division, | |
| 162 | + required this.fax, | |
| 163 | + required this.fireBanR, | |
| 164 | + required this.latitude, | |
| 165 | + required this.localGovt, | |
| 166 | + required this.longitude, | |
| 167 | + required this.no, | |
| 168 | + required this.phone, | |
| 169 | + required this.postcode, | |
| 170 | + required this.psa, | |
| 171 | + required this.region, | |
| 172 | + required this.station, | |
| 173 | + required this.street, | |
| 174 | + required this.suburb, | |
| 175 | + required this.type, | |
| 176 | + }); | |
| 177 | + | |
| 178 | + factory FeatureProperties.fromJson(Map<String, dynamic> json) => FeatureProperties( | |
| 179 | + division: json["division"], | |
| 180 | + fax: json["fax"]?.toDouble(), | |
| 181 | + fireBanR: fireBanRValues.map[json["fire_ban_r"]], | |
| 182 | + latitude: json["latitude"]?.toDouble(), | |
| 183 | + localGovt: json["local_govt"], | |
| 184 | + longitude: json["longitude"]?.toDouble(), | |
| 185 | + no: json["no"], | |
| 186 | + phone: json["phone"]?.toDouble(), | |
| 187 | + postcode: json["postcode"], | |
| 188 | + psa: json["psa"], | |
| 189 | + region: regionValues.map[json["region"]]!, | |
| 190 | + station: json["station"], | |
| 191 | + street: json["street"], | |
| 192 | + suburb: json["suburb"], | |
| 193 | + type: propertiesTypeValues.map[json["type"]], | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "division": division, | |
| 198 | + "fax": fax, | |
| 199 | + "fire_ban_r": fireBanRValues.reverse[fireBanR], | |
| 200 | + "latitude": latitude, | |
| 201 | + "local_govt": localGovt, | |
| 202 | + "longitude": longitude, | |
| 203 | + "no": no, | |
| 204 | + "phone": phone, | |
| 205 | + "postcode": postcode, | |
| 206 | + "psa": psa, | |
| 207 | + "region": regionValues.reverse[region], | |
| 208 | + "station": station, | |
| 209 | + "street": street, | |
| 210 | + "suburb": suburb, | |
| 211 | + "type": propertiesTypeValues.reverse[type], | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +enum FireBanR { | |
| 216 | + NORTH_CENTRAL, | |
| 217 | + CENTRAL, | |
| 218 | + SOUTH_WEST, | |
| 219 | + WIMMERA, | |
| 220 | + NORTHERN_COUNTRY, | |
| 221 | + EAST_GIPPSLAND, | |
| 222 | + NORTH_EAST, | |
| 223 | + MALLEE, | |
| 224 | + WEST_SOUTH_GIPPSLAND, | |
| 225 | + BALLARAT | |
| 226 | +} | |
| 227 | + | |
| 228 | +final fireBanRValues = EnumValues({ | |
| 229 | + "North Central": FireBanR.NORTH_CENTRAL, | |
| 230 | + "Central": FireBanR.CENTRAL, | |
| 231 | + "South West": FireBanR.SOUTH_WEST, | |
| 232 | + "Wimmera": FireBanR.WIMMERA, | |
| 233 | + "Northern Country": FireBanR.NORTHERN_COUNTRY, | |
| 234 | + "East Gippsland": FireBanR.EAST_GIPPSLAND, | |
| 235 | + "North East": FireBanR.NORTH_EAST, | |
| 236 | + "Mallee": FireBanR.MALLEE, | |
| 237 | + "West &South Gippsland": FireBanR.WEST_SOUTH_GIPPSLAND, | |
| 238 | + "Ballarat": FireBanR.BALLARAT | |
| 239 | +}); | |
| 240 | + | |
| 241 | +enum Region { | |
| 242 | + EASTERN, | |
| 243 | + NORTHERN_METRO, | |
| 244 | + WESTERN, | |
| 245 | + SOUTHERN_METRO | |
| 246 | +} | |
| 247 | + | |
| 248 | +final regionValues = EnumValues({ | |
| 249 | + "Eastern": Region.EASTERN, | |
| 250 | + "Northern Metro": Region.NORTHERN_METRO, | |
| 251 | + "Western": Region.WESTERN, | |
| 252 | + "Southern Metro": Region.SOUTHERN_METRO | |
| 253 | +}); | |
| 254 | + | |
| 255 | +enum PropertiesType { | |
| 256 | + STREET, | |
| 257 | + AVENUE, | |
| 258 | + ROAD, | |
| 259 | + HIGHWAY, | |
| 260 | + BOULEVARD, | |
| 261 | + COURT, | |
| 262 | + WAY, | |
| 263 | + DRIVE, | |
| 264 | + SOUTH, | |
| 265 | + HILL, | |
| 266 | + LANE, | |
| 267 | + CLOSE, | |
| 268 | + PARADE, | |
| 269 | + TYPE_ROAD, | |
| 270 | + PLACE, | |
| 271 | + RD | |
| 272 | +} | |
| 273 | + | |
| 274 | +final propertiesTypeValues = EnumValues({ | |
| 275 | + "STREET": PropertiesType.STREET, | |
| 276 | + "AVENUE": PropertiesType.AVENUE, | |
| 277 | + "ROAD": PropertiesType.ROAD, | |
| 278 | + "HIGHWAY": PropertiesType.HIGHWAY, | |
| 279 | + "BOULEVARD": PropertiesType.BOULEVARD, | |
| 280 | + "COURT": PropertiesType.COURT, | |
| 281 | + "WAY": PropertiesType.WAY, | |
| 282 | + "DRIVE": PropertiesType.DRIVE, | |
| 283 | + "SOUTH": PropertiesType.SOUTH, | |
| 284 | + "HILL": PropertiesType.HILL, | |
| 285 | + "LANE": PropertiesType.LANE, | |
| 286 | + "CLOSE": PropertiesType.CLOSE, | |
| 287 | + "PARADE": PropertiesType.PARADE, | |
| 288 | + "Road": PropertiesType.TYPE_ROAD, | |
| 289 | + "PLACE": PropertiesType.PLACE, | |
| 290 | + "RD": PropertiesType.RD | |
| 291 | +}); | |
| 292 | + | |
| 293 | +enum FeatureType { | |
| 294 | + FEATURE | |
| 295 | +} | |
| 296 | + | |
| 297 | +final featureTypeValues = EnumValues({ | |
| 298 | + "Feature": FeatureType.FEATURE | |
| 299 | +}); | |
| 300 | + | |
| 301 | +class EnumValues<T> { | |
| 302 | + Map<String, T> map; | |
| 303 | + late Map<T, String> reverseMap; | |
| 304 | + | |
| 305 | + EnumValues(this.map); | |
| 306 | + | |
| 307 | + Map<T, String> get reverse { | |
| 308 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 309 | + return reverseMap; | |
| 310 | + } | |
| 311 | +} |
Test case
1 generated file · +153 −0test/inputs/json/misc/3536b.json
Adartdefault / TopLevel.dart+153 −0
| @@ -0,0 +1,153 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final String supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + SPDX, | |
| 77 | + DEP5, | |
| 78 | + TROVE | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "SPDX": Scheme.SPDX, | |
| 83 | + "DEP5": Scheme.DEP5, | |
| 84 | + "Trove": Scheme.TROVE | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + DISCOURAGED, | |
| 89 | + OBSOLETE, | |
| 90 | + OSI_APPROVED | |
| 91 | +} | |
| 92 | + | |
| 93 | +final keywordValues = EnumValues({ | |
| 94 | + "discouraged": Keyword.DISCOURAGED, | |
| 95 | + "obsolete": Keyword.OBSOLETE, | |
| 96 | + "osi-approved": Keyword.OSI_APPROVED | |
| 97 | +}); | |
| 98 | + | |
| 99 | +class Link { | |
| 100 | + final String note; | |
| 101 | + final String url; | |
| 102 | + | |
| 103 | + Link({ | |
| 104 | + required this.note, | |
| 105 | + required this.url, | |
| 106 | + }); | |
| 107 | + | |
| 108 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 109 | + note: json["note"], | |
| 110 | + url: json["url"], | |
| 111 | + ); | |
| 112 | + | |
| 113 | + Map<String, dynamic> toJson() => { | |
| 114 | + "note": note, | |
| 115 | + "url": url, | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Text { | |
| 120 | + final String mediaType; | |
| 121 | + final String title; | |
| 122 | + final String url; | |
| 123 | + | |
| 124 | + Text({ | |
| 125 | + required this.mediaType, | |
| 126 | + required this.title, | |
| 127 | + required this.url, | |
| 128 | + }); | |
| 129 | + | |
| 130 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 131 | + mediaType: json["media_type"], | |
| 132 | + title: json["title"], | |
| 133 | + url: json["url"], | |
| 134 | + ); | |
| 135 | + | |
| 136 | + Map<String, dynamic> toJson() => { | |
| 137 | + "media_type": mediaType, | |
| 138 | + "title": title, | |
| 139 | + "url": url, | |
| 140 | + }; | |
| 141 | +} | |
| 142 | + | |
| 143 | +class EnumValues<T> { | |
| 144 | + Map<String, T> map; | |
| 145 | + late Map<T, String> reverseMap; | |
| 146 | + | |
| 147 | + EnumValues(this.map); | |
| 148 | + | |
| 149 | + Map<T, String> get reverse { | |
| 150 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 151 | + return reverseMap; | |
| 152 | + } | |
| 153 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/3659d.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/36d5d.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/3a6b3.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +125 −0test/inputs/json/misc/3e9a3.json
Adartdefault / TopLevel.dart+125 −0
| @@ -0,0 +1,125 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<dynamic> message; | |
| 13 | + final int responseTime; | |
| 14 | + final Results results; | |
| 15 | + final String status; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.message, | |
| 19 | + required this.responseTime, | |
| 20 | + required this.results, | |
| 21 | + required this.status, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + message: List<dynamic>.from(json["message"].map((x) => x)), | |
| 26 | + responseTime: json["responseTime"], | |
| 27 | + results: Results.fromJson(json["Results"]), | |
| 28 | + status: json["status"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "message": List<dynamic>.from(message.map((x) => x)), | |
| 33 | + "responseTime": responseTime, | |
| 34 | + "Results": results.toJson(), | |
| 35 | + "status": status, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Results { | |
| 40 | + final List<Series> series; | |
| 41 | + | |
| 42 | + Results({ | |
| 43 | + required this.series, | |
| 44 | + }); | |
| 45 | + | |
| 46 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 47 | + series: List<Series>.from(json["series"].map((x) => Series.fromJson(x))), | |
| 48 | + ); | |
| 49 | + | |
| 50 | + Map<String, dynamic> toJson() => { | |
| 51 | + "series": List<dynamic>.from(series.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Series { | |
| 56 | + final List<Datum> data; | |
| 57 | + final String seriesId; | |
| 58 | + | |
| 59 | + Series({ | |
| 60 | + required this.data, | |
| 61 | + required this.seriesId, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Series.fromJson(Map<String, dynamic> json) => Series( | |
| 65 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 66 | + seriesId: json["seriesID"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 71 | + "seriesID": seriesId, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Datum { | |
| 76 | + final List<Footnote> footnotes; | |
| 77 | + final String period; | |
| 78 | + final String periodName; | |
| 79 | + final String value; | |
| 80 | + final String year; | |
| 81 | + | |
| 82 | + Datum({ | |
| 83 | + required this.footnotes, | |
| 84 | + required this.period, | |
| 85 | + required this.periodName, | |
| 86 | + required this.value, | |
| 87 | + required this.year, | |
| 88 | + }); | |
| 89 | + | |
| 90 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 91 | + footnotes: List<Footnote>.from(json["footnotes"].map((x) => Footnote.fromJson(x))), | |
| 92 | + period: json["period"], | |
| 93 | + periodName: json["periodName"], | |
| 94 | + value: json["value"], | |
| 95 | + year: json["year"], | |
| 96 | + ); | |
| 97 | + | |
| 98 | + Map<String, dynamic> toJson() => { | |
| 99 | + "footnotes": List<dynamic>.from(footnotes.map((x) => x.toJson())), | |
| 100 | + "period": period, | |
| 101 | + "periodName": periodName, | |
| 102 | + "value": value, | |
| 103 | + "year": year, | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Footnote { | |
| 108 | + final String? code; | |
| 109 | + final String? text; | |
| 110 | + | |
| 111 | + Footnote({ | |
| 112 | + this.code, | |
| 113 | + this.text, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory Footnote.fromJson(Map<String, dynamic> json) => Footnote( | |
| 117 | + code: json["code"], | |
| 118 | + text: json["text"], | |
| 119 | + ); | |
| 120 | + | |
| 121 | + Map<String, dynamic> toJson() => { | |
| 122 | + "code": code, | |
| 123 | + "text": text, | |
| 124 | + }; | |
| 125 | +} |
Test case
1 generated file · +437 −0test/inputs/json/misc/3f1ce.json
Adartdefault / TopLevel.dart+437 −0
| @@ -0,0 +1,437 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final Text text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: textValues.map[json["text"]]!, | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": textValues.reverse[text], | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +enum Text { | |
| 328 | + THUNDERSTORMS | |
| 329 | +} | |
| 330 | + | |
| 331 | +final textValues = EnumValues({ | |
| 332 | + "Thunderstorms": Text.THUNDERSTORMS | |
| 333 | +}); | |
| 334 | + | |
| 335 | +class Guid { | |
| 336 | + final String isPermaLink; | |
| 337 | + | |
| 338 | + Guid({ | |
| 339 | + required this.isPermaLink, | |
| 340 | + }); | |
| 341 | + | |
| 342 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 343 | + isPermaLink: json["isPermaLink"], | |
| 344 | + ); | |
| 345 | + | |
| 346 | + Map<String, dynamic> toJson() => { | |
| 347 | + "isPermaLink": isPermaLink, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +class Location { | |
| 352 | + final String city; | |
| 353 | + final String country; | |
| 354 | + final String region; | |
| 355 | + | |
| 356 | + Location({ | |
| 357 | + required this.city, | |
| 358 | + required this.country, | |
| 359 | + required this.region, | |
| 360 | + }); | |
| 361 | + | |
| 362 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 363 | + city: json["city"], | |
| 364 | + country: json["country"], | |
| 365 | + region: json["region"], | |
| 366 | + ); | |
| 367 | + | |
| 368 | + Map<String, dynamic> toJson() => { | |
| 369 | + "city": city, | |
| 370 | + "country": country, | |
| 371 | + "region": region, | |
| 372 | + }; | |
| 373 | +} | |
| 374 | + | |
| 375 | +class Units { | |
| 376 | + final String distance; | |
| 377 | + final String pressure; | |
| 378 | + final String speed; | |
| 379 | + final String temperature; | |
| 380 | + | |
| 381 | + Units({ | |
| 382 | + required this.distance, | |
| 383 | + required this.pressure, | |
| 384 | + required this.speed, | |
| 385 | + required this.temperature, | |
| 386 | + }); | |
| 387 | + | |
| 388 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 389 | + distance: json["distance"], | |
| 390 | + pressure: json["pressure"], | |
| 391 | + speed: json["speed"], | |
| 392 | + temperature: json["temperature"], | |
| 393 | + ); | |
| 394 | + | |
| 395 | + Map<String, dynamic> toJson() => { | |
| 396 | + "distance": distance, | |
| 397 | + "pressure": pressure, | |
| 398 | + "speed": speed, | |
| 399 | + "temperature": temperature, | |
| 400 | + }; | |
| 401 | +} | |
| 402 | + | |
| 403 | +class Wind { | |
| 404 | + final String chill; | |
| 405 | + final String direction; | |
| 406 | + final String speed; | |
| 407 | + | |
| 408 | + Wind({ | |
| 409 | + required this.chill, | |
| 410 | + required this.direction, | |
| 411 | + required this.speed, | |
| 412 | + }); | |
| 413 | + | |
| 414 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 415 | + chill: json["chill"], | |
| 416 | + direction: json["direction"], | |
| 417 | + speed: json["speed"], | |
| 418 | + ); | |
| 419 | + | |
| 420 | + Map<String, dynamic> toJson() => { | |
| 421 | + "chill": chill, | |
| 422 | + "direction": direction, | |
| 423 | + "speed": speed, | |
| 424 | + }; | |
| 425 | +} | |
| 426 | + | |
| 427 | +class EnumValues<T> { | |
| 428 | + Map<String, T> map; | |
| 429 | + late Map<T, String> reverseMap; | |
| 430 | + | |
| 431 | + EnumValues(this.map); | |
| 432 | + | |
| 433 | + Map<T, String> get reverse { | |
| 434 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 435 | + return reverseMap; | |
| 436 | + } | |
| 437 | +} |
Test case
1 generated file · +471 −0test/inputs/json/misc/421d4.json
Adartdefault / TopLevel.dart+471 −0
| @@ -0,0 +1,471 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final String attribution; | |
| 49 | + final int averageRating; | |
| 50 | + final String category; | |
| 51 | + final List<Column> columns; | |
| 52 | + final int createdAt; | |
| 53 | + final String description; | |
| 54 | + final String displayType; | |
| 55 | + final int downloadCount; | |
| 56 | + final List<String> flags; | |
| 57 | + final List<Grant> grants; | |
| 58 | + final bool hideFromCatalog; | |
| 59 | + final bool hideFromDataJson; | |
| 60 | + final String id; | |
| 61 | + final int indexUpdatedAt; | |
| 62 | + final License license; | |
| 63 | + final String licenseId; | |
| 64 | + final String locale; | |
| 65 | + final Metadata metadata; | |
| 66 | + final String name; | |
| 67 | + final bool newBackend; | |
| 68 | + final int numberOfComments; | |
| 69 | + final int oid; | |
| 70 | + final Owner owner; | |
| 71 | + final String provenance; | |
| 72 | + final bool publicationAppendEnabled; | |
| 73 | + final int publicationDate; | |
| 74 | + final int publicationGroup; | |
| 75 | + final String publicationStage; | |
| 76 | + final Query query; | |
| 77 | + final List<String> rights; | |
| 78 | + final String rowClass; | |
| 79 | + final int rowsUpdatedAt; | |
| 80 | + final String rowsUpdatedBy; | |
| 81 | + final Owner tableAuthor; | |
| 82 | + final int tableId; | |
| 83 | + final List<String> tags; | |
| 84 | + final int totalTimesRated; | |
| 85 | + final int viewCount; | |
| 86 | + final int viewLastModified; | |
| 87 | + final String viewType; | |
| 88 | + | |
| 89 | + View({ | |
| 90 | + required this.attribution, | |
| 91 | + required this.averageRating, | |
| 92 | + required this.category, | |
| 93 | + required this.columns, | |
| 94 | + required this.createdAt, | |
| 95 | + required this.description, | |
| 96 | + required this.displayType, | |
| 97 | + required this.downloadCount, | |
| 98 | + required this.flags, | |
| 99 | + required this.grants, | |
| 100 | + required this.hideFromCatalog, | |
| 101 | + required this.hideFromDataJson, | |
| 102 | + required this.id, | |
| 103 | + required this.indexUpdatedAt, | |
| 104 | + required this.license, | |
| 105 | + required this.licenseId, | |
| 106 | + required this.locale, | |
| 107 | + required this.metadata, | |
| 108 | + required this.name, | |
| 109 | + required this.newBackend, | |
| 110 | + required this.numberOfComments, | |
| 111 | + required this.oid, | |
| 112 | + required this.owner, | |
| 113 | + required this.provenance, | |
| 114 | + required this.publicationAppendEnabled, | |
| 115 | + required this.publicationDate, | |
| 116 | + required this.publicationGroup, | |
| 117 | + required this.publicationStage, | |
| 118 | + required this.query, | |
| 119 | + required this.rights, | |
| 120 | + required this.rowClass, | |
| 121 | + required this.rowsUpdatedAt, | |
| 122 | + required this.rowsUpdatedBy, | |
| 123 | + required this.tableAuthor, | |
| 124 | + required this.tableId, | |
| 125 | + required this.tags, | |
| 126 | + required this.totalTimesRated, | |
| 127 | + required this.viewCount, | |
| 128 | + required this.viewLastModified, | |
| 129 | + required this.viewType, | |
| 130 | + }); | |
| 131 | + | |
| 132 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 133 | + attribution: json["attribution"], | |
| 134 | + averageRating: json["averageRating"], | |
| 135 | + category: json["category"], | |
| 136 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 137 | + createdAt: json["createdAt"], | |
| 138 | + description: json["description"], | |
| 139 | + displayType: json["displayType"], | |
| 140 | + downloadCount: json["downloadCount"], | |
| 141 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 142 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 143 | + hideFromCatalog: json["hideFromCatalog"], | |
| 144 | + hideFromDataJson: json["hideFromDataJson"], | |
| 145 | + id: json["id"], | |
| 146 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 147 | + license: License.fromJson(json["license"]), | |
| 148 | + licenseId: json["licenseId"], | |
| 149 | + locale: json["locale"], | |
| 150 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 151 | + name: json["name"], | |
| 152 | + newBackend: json["newBackend"], | |
| 153 | + numberOfComments: json["numberOfComments"], | |
| 154 | + oid: json["oid"], | |
| 155 | + owner: Owner.fromJson(json["owner"]), | |
| 156 | + provenance: json["provenance"], | |
| 157 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 158 | + publicationDate: json["publicationDate"], | |
| 159 | + publicationGroup: json["publicationGroup"], | |
| 160 | + publicationStage: json["publicationStage"], | |
| 161 | + query: Query.fromJson(json["query"]), | |
| 162 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 163 | + rowClass: json["rowClass"], | |
| 164 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 165 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 166 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 167 | + tableId: json["tableId"], | |
| 168 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 169 | + totalTimesRated: json["totalTimesRated"], | |
| 170 | + viewCount: json["viewCount"], | |
| 171 | + viewLastModified: json["viewLastModified"], | |
| 172 | + viewType: json["viewType"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "attribution": attribution, | |
| 177 | + "averageRating": averageRating, | |
| 178 | + "category": category, | |
| 179 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 180 | + "createdAt": createdAt, | |
| 181 | + "description": description, | |
| 182 | + "displayType": displayType, | |
| 183 | + "downloadCount": downloadCount, | |
| 184 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 185 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 186 | + "hideFromCatalog": hideFromCatalog, | |
| 187 | + "hideFromDataJson": hideFromDataJson, | |
| 188 | + "id": id, | |
| 189 | + "indexUpdatedAt": indexUpdatedAt, | |
| 190 | + "license": license.toJson(), | |
| 191 | + "licenseId": licenseId, | |
| 192 | + "locale": locale, | |
| 193 | + "metadata": metadata.toJson(), | |
| 194 | + "name": name, | |
| 195 | + "newBackend": newBackend, | |
| 196 | + "numberOfComments": numberOfComments, | |
| 197 | + "oid": oid, | |
| 198 | + "owner": owner.toJson(), | |
| 199 | + "provenance": provenance, | |
| 200 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 201 | + "publicationDate": publicationDate, | |
| 202 | + "publicationGroup": publicationGroup, | |
| 203 | + "publicationStage": publicationStage, | |
| 204 | + "query": query.toJson(), | |
| 205 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 206 | + "rowClass": rowClass, | |
| 207 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 208 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 209 | + "tableAuthor": tableAuthor.toJson(), | |
| 210 | + "tableId": tableId, | |
| 211 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 212 | + "totalTimesRated": totalTimesRated, | |
| 213 | + "viewCount": viewCount, | |
| 214 | + "viewLastModified": viewLastModified, | |
| 215 | + "viewType": viewType, | |
| 216 | + }; | |
| 217 | +} | |
| 218 | + | |
| 219 | +class Column { | |
| 220 | + final CachedContents? cachedContents; | |
| 221 | + final String dataTypeName; | |
| 222 | + final String fieldName; | |
| 223 | + final List<String>? flags; | |
| 224 | + final Query format; | |
| 225 | + final int id; | |
| 226 | + final String name; | |
| 227 | + final int position; | |
| 228 | + final String renderTypeName; | |
| 229 | + final int? tableColumnId; | |
| 230 | + final int? width; | |
| 231 | + | |
| 232 | + Column({ | |
| 233 | + this.cachedContents, | |
| 234 | + required this.dataTypeName, | |
| 235 | + required this.fieldName, | |
| 236 | + this.flags, | |
| 237 | + required this.format, | |
| 238 | + required this.id, | |
| 239 | + required this.name, | |
| 240 | + required this.position, | |
| 241 | + required this.renderTypeName, | |
| 242 | + this.tableColumnId, | |
| 243 | + this.width, | |
| 244 | + }); | |
| 245 | + | |
| 246 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 247 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 248 | + dataTypeName: json["dataTypeName"], | |
| 249 | + fieldName: json["fieldName"], | |
| 250 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 251 | + format: Query.fromJson(json["format"]), | |
| 252 | + id: json["id"], | |
| 253 | + name: json["name"], | |
| 254 | + position: json["position"], | |
| 255 | + renderTypeName: json["renderTypeName"], | |
| 256 | + tableColumnId: json["tableColumnId"], | |
| 257 | + width: json["width"], | |
| 258 | + ); | |
| 259 | + | |
| 260 | + Map<String, dynamic> toJson() => { | |
| 261 | + "cachedContents": cachedContents?.toJson(), | |
| 262 | + "dataTypeName": dataTypeName, | |
| 263 | + "fieldName": fieldName, | |
| 264 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 265 | + "format": format.toJson(), | |
| 266 | + "id": id, | |
| 267 | + "name": name, | |
| 268 | + "position": position, | |
| 269 | + "renderTypeName": renderTypeName, | |
| 270 | + "tableColumnId": tableColumnId, | |
| 271 | + "width": width, | |
| 272 | + }; | |
| 273 | +} | |
| 274 | + | |
| 275 | +class CachedContents { | |
| 276 | + final String? average; | |
| 277 | + final int cachedContentsNull; | |
| 278 | + final String? largest; | |
| 279 | + final int nonNull; | |
| 280 | + final String? smallest; | |
| 281 | + final String? sum; | |
| 282 | + final List<Top>? top; | |
| 283 | + | |
| 284 | + CachedContents({ | |
| 285 | + this.average, | |
| 286 | + required this.cachedContentsNull, | |
| 287 | + this.largest, | |
| 288 | + required this.nonNull, | |
| 289 | + this.smallest, | |
| 290 | + this.sum, | |
| 291 | + this.top, | |
| 292 | + }); | |
| 293 | + | |
| 294 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 295 | + average: json["average"], | |
| 296 | + cachedContentsNull: json["null"], | |
| 297 | + largest: json["largest"], | |
| 298 | + nonNull: json["non_null"], | |
| 299 | + smallest: json["smallest"], | |
| 300 | + sum: json["sum"], | |
| 301 | + top: json["top"] == null ? null : List<Top>.from(json["top"]!.map((x) => Top.fromJson(x))), | |
| 302 | + ); | |
| 303 | + | |
| 304 | + Map<String, dynamic> toJson() => { | |
| 305 | + "average": average, | |
| 306 | + "null": cachedContentsNull, | |
| 307 | + "largest": largest, | |
| 308 | + "non_null": nonNull, | |
| 309 | + "smallest": smallest, | |
| 310 | + "sum": sum, | |
| 311 | + "top": top == null ? null : List<dynamic>.from(top!.map((x) => x.toJson())), | |
| 312 | + }; | |
| 313 | +} | |
| 314 | + | |
| 315 | +class Top { | |
| 316 | + final int count; | |
| 317 | + final String item; | |
| 318 | + | |
| 319 | + Top({ | |
| 320 | + required this.count, | |
| 321 | + required this.item, | |
| 322 | + }); | |
| 323 | + | |
| 324 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 325 | + count: json["count"], | |
| 326 | + item: json["item"], | |
| 327 | + ); | |
| 328 | + | |
| 329 | + Map<String, dynamic> toJson() => { | |
| 330 | + "count": count, | |
| 331 | + "item": item, | |
| 332 | + }; | |
| 333 | +} | |
| 334 | + | |
| 335 | +class Query { | |
| 336 | + Query(); | |
| 337 | + | |
| 338 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 339 | + ); | |
| 340 | + | |
| 341 | + Map<String, dynamic> toJson() => { | |
| 342 | + }; | |
| 343 | +} | |
| 344 | + | |
| 345 | +class Grant { | |
| 346 | + final List<String> flags; | |
| 347 | + final bool inherited; | |
| 348 | + final String type; | |
| 349 | + | |
| 350 | + Grant({ | |
| 351 | + required this.flags, | |
| 352 | + required this.inherited, | |
| 353 | + required this.type, | |
| 354 | + }); | |
| 355 | + | |
| 356 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 357 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 358 | + inherited: json["inherited"], | |
| 359 | + type: json["type"], | |
| 360 | + ); | |
| 361 | + | |
| 362 | + Map<String, dynamic> toJson() => { | |
| 363 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 364 | + "inherited": inherited, | |
| 365 | + "type": type, | |
| 366 | + }; | |
| 367 | +} | |
| 368 | + | |
| 369 | +class License { | |
| 370 | + final String name; | |
| 371 | + | |
| 372 | + License({ | |
| 373 | + required this.name, | |
| 374 | + }); | |
| 375 | + | |
| 376 | + factory License.fromJson(Map<String, dynamic> json) => License( | |
| 377 | + name: json["name"], | |
| 378 | + ); | |
| 379 | + | |
| 380 | + Map<String, dynamic> toJson() => { | |
| 381 | + "name": name, | |
| 382 | + }; | |
| 383 | +} | |
| 384 | + | |
| 385 | +class Metadata { | |
| 386 | + final List<String> availableDisplayTypes; | |
| 387 | + final String rdfClass; | |
| 388 | + final String rdfSubject; | |
| 389 | + final RenderTypeConfig renderTypeConfig; | |
| 390 | + final String rowIdentifier; | |
| 391 | + | |
| 392 | + Metadata({ | |
| 393 | + required this.availableDisplayTypes, | |
| 394 | + required this.rdfClass, | |
| 395 | + required this.rdfSubject, | |
| 396 | + required this.renderTypeConfig, | |
| 397 | + required this.rowIdentifier, | |
| 398 | + }); | |
| 399 | + | |
| 400 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 401 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 402 | + rdfClass: json["rdfClass"], | |
| 403 | + rdfSubject: json["rdfSubject"], | |
| 404 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 405 | + rowIdentifier: json["rowIdentifier"], | |
| 406 | + ); | |
| 407 | + | |
| 408 | + Map<String, dynamic> toJson() => { | |
| 409 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 410 | + "rdfClass": rdfClass, | |
| 411 | + "rdfSubject": rdfSubject, | |
| 412 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 413 | + "rowIdentifier": rowIdentifier, | |
| 414 | + }; | |
| 415 | +} | |
| 416 | + | |
| 417 | +class RenderTypeConfig { | |
| 418 | + final Visible visible; | |
| 419 | + | |
| 420 | + RenderTypeConfig({ | |
| 421 | + required this.visible, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 425 | + visible: Visible.fromJson(json["visible"]), | |
| 426 | + ); | |
| 427 | + | |
| 428 | + Map<String, dynamic> toJson() => { | |
| 429 | + "visible": visible.toJson(), | |
| 430 | + }; | |
| 431 | +} | |
| 432 | + | |
| 433 | +class Visible { | |
| 434 | + final bool table; | |
| 435 | + | |
| 436 | + Visible({ | |
| 437 | + required this.table, | |
| 438 | + }); | |
| 439 | + | |
| 440 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 441 | + table: json["table"], | |
| 442 | + ); | |
| 443 | + | |
| 444 | + Map<String, dynamic> toJson() => { | |
| 445 | + "table": table, | |
| 446 | + }; | |
| 447 | +} | |
| 448 | + | |
| 449 | +class Owner { | |
| 450 | + final String displayName; | |
| 451 | + final String id; | |
| 452 | + final String screenName; | |
| 453 | + | |
| 454 | + Owner({ | |
| 455 | + required this.displayName, | |
| 456 | + required this.id, | |
| 457 | + required this.screenName, | |
| 458 | + }); | |
| 459 | + | |
| 460 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 461 | + displayName: json["displayName"], | |
| 462 | + id: json["id"], | |
| 463 | + screenName: json["screenName"], | |
| 464 | + ); | |
| 465 | + | |
| 466 | + Map<String, dynamic> toJson() => { | |
| 467 | + "displayName": displayName, | |
| 468 | + "id": id, | |
| 469 | + "screenName": screenName, | |
| 470 | + }; | |
| 471 | +} |
Test case
1 generated file · +459 −0test/inputs/json/misc/437e7.json
Adartdefault / TopLevel.dart+459 −0
| @@ -0,0 +1,459 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final String username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: json["username"], | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": username, | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final Looping looping; | |
| 136 | + final FixedHeight original; | |
| 137 | + final DownsizedSmall originalMp4; | |
| 138 | + final Downsized originalStill; | |
| 139 | + final DownsizedSmall preview; | |
| 140 | + final Downsized previewGif; | |
| 141 | + final Downsized previewWebp; | |
| 142 | + | |
| 143 | + Images({ | |
| 144 | + required this.downsized, | |
| 145 | + required this.downsizedLarge, | |
| 146 | + required this.downsizedMedium, | |
| 147 | + required this.downsizedSmall, | |
| 148 | + required this.downsizedStill, | |
| 149 | + required this.fixedHeight, | |
| 150 | + required this.fixedHeightDownsampled, | |
| 151 | + required this.fixedHeightSmall, | |
| 152 | + required this.fixedHeightSmallStill, | |
| 153 | + required this.fixedHeightStill, | |
| 154 | + required this.fixedWidth, | |
| 155 | + required this.fixedWidthDownsampled, | |
| 156 | + required this.fixedWidthSmall, | |
| 157 | + required this.fixedWidthSmallStill, | |
| 158 | + required this.fixedWidthStill, | |
| 159 | + required this.looping, | |
| 160 | + required this.original, | |
| 161 | + required this.originalMp4, | |
| 162 | + required this.originalStill, | |
| 163 | + required this.preview, | |
| 164 | + required this.previewGif, | |
| 165 | + required this.previewWebp, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 169 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 170 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 171 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 172 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 173 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 174 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 175 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 176 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 177 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 178 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 179 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 180 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 181 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 182 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 183 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 184 | + looping: Looping.fromJson(json["looping"]), | |
| 185 | + original: FixedHeight.fromJson(json["original"]), | |
| 186 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 187 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 188 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 189 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 190 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 191 | + ); | |
| 192 | + | |
| 193 | + Map<String, dynamic> toJson() => { | |
| 194 | + "downsized": downsized.toJson(), | |
| 195 | + "downsized_large": downsizedLarge.toJson(), | |
| 196 | + "downsized_medium": downsizedMedium.toJson(), | |
| 197 | + "downsized_small": downsizedSmall.toJson(), | |
| 198 | + "downsized_still": downsizedStill.toJson(), | |
| 199 | + "fixed_height": fixedHeight.toJson(), | |
| 200 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 201 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 202 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 203 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 204 | + "fixed_width": fixedWidth.toJson(), | |
| 205 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 206 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 207 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 208 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 209 | + "looping": looping.toJson(), | |
| 210 | + "original": original.toJson(), | |
| 211 | + "original_mp4": originalMp4.toJson(), | |
| 212 | + "original_still": originalStill.toJson(), | |
| 213 | + "preview": preview.toJson(), | |
| 214 | + "preview_gif": previewGif.toJson(), | |
| 215 | + "preview_webp": previewWebp.toJson(), | |
| 216 | + }; | |
| 217 | +} | |
| 218 | + | |
| 219 | +class Downsized { | |
| 220 | + final String height; | |
| 221 | + final String? size; | |
| 222 | + final String url; | |
| 223 | + final String width; | |
| 224 | + | |
| 225 | + Downsized({ | |
| 226 | + required this.height, | |
| 227 | + this.size, | |
| 228 | + required this.url, | |
| 229 | + required this.width, | |
| 230 | + }); | |
| 231 | + | |
| 232 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 233 | + height: json["height"], | |
| 234 | + size: json["size"], | |
| 235 | + url: json["url"], | |
| 236 | + width: json["width"], | |
| 237 | + ); | |
| 238 | + | |
| 239 | + Map<String, dynamic> toJson() => { | |
| 240 | + "height": height, | |
| 241 | + "size": size, | |
| 242 | + "url": url, | |
| 243 | + "width": width, | |
| 244 | + }; | |
| 245 | +} | |
| 246 | + | |
| 247 | +class DownsizedSmall { | |
| 248 | + final String height; | |
| 249 | + final String mp4; | |
| 250 | + final String mp4Size; | |
| 251 | + final String width; | |
| 252 | + | |
| 253 | + DownsizedSmall({ | |
| 254 | + required this.height, | |
| 255 | + required this.mp4, | |
| 256 | + required this.mp4Size, | |
| 257 | + required this.width, | |
| 258 | + }); | |
| 259 | + | |
| 260 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 261 | + height: json["height"], | |
| 262 | + mp4: json["mp4"], | |
| 263 | + mp4Size: json["mp4_size"], | |
| 264 | + width: json["width"], | |
| 265 | + ); | |
| 266 | + | |
| 267 | + Map<String, dynamic> toJson() => { | |
| 268 | + "height": height, | |
| 269 | + "mp4": mp4, | |
| 270 | + "mp4_size": mp4Size, | |
| 271 | + "width": width, | |
| 272 | + }; | |
| 273 | +} | |
| 274 | + | |
| 275 | +class FixedHeight { | |
| 276 | + final String? frames; | |
| 277 | + final String height; | |
| 278 | + final String? mp4; | |
| 279 | + final String? mp4Size; | |
| 280 | + final String size; | |
| 281 | + final String url; | |
| 282 | + final String webp; | |
| 283 | + final String webpSize; | |
| 284 | + final String width; | |
| 285 | + | |
| 286 | + FixedHeight({ | |
| 287 | + this.frames, | |
| 288 | + required this.height, | |
| 289 | + this.mp4, | |
| 290 | + this.mp4Size, | |
| 291 | + required this.size, | |
| 292 | + required this.url, | |
| 293 | + required this.webp, | |
| 294 | + required this.webpSize, | |
| 295 | + required this.width, | |
| 296 | + }); | |
| 297 | + | |
| 298 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 299 | + frames: json["frames"], | |
| 300 | + height: json["height"], | |
| 301 | + mp4: json["mp4"], | |
| 302 | + mp4Size: json["mp4_size"], | |
| 303 | + size: json["size"], | |
| 304 | + url: json["url"], | |
| 305 | + webp: json["webp"], | |
| 306 | + webpSize: json["webp_size"], | |
| 307 | + width: json["width"], | |
| 308 | + ); | |
| 309 | + | |
| 310 | + Map<String, dynamic> toJson() => { | |
| 311 | + "frames": frames, | |
| 312 | + "height": height, | |
| 313 | + "mp4": mp4, | |
| 314 | + "mp4_size": mp4Size, | |
| 315 | + "size": size, | |
| 316 | + "url": url, | |
| 317 | + "webp": webp, | |
| 318 | + "webp_size": webpSize, | |
| 319 | + "width": width, | |
| 320 | + }; | |
| 321 | +} | |
| 322 | + | |
| 323 | +class Looping { | |
| 324 | + final String mp4; | |
| 325 | + final String mp4Size; | |
| 326 | + | |
| 327 | + Looping({ | |
| 328 | + required this.mp4, | |
| 329 | + required this.mp4Size, | |
| 330 | + }); | |
| 331 | + | |
| 332 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 333 | + mp4: json["mp4"], | |
| 334 | + mp4Size: json["mp4_size"], | |
| 335 | + ); | |
| 336 | + | |
| 337 | + Map<String, dynamic> toJson() => { | |
| 338 | + "mp4": mp4, | |
| 339 | + "mp4_size": mp4Size, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +enum Rating { | |
| 344 | + G, | |
| 345 | + PG, | |
| 346 | + Y, | |
| 347 | + PG_13 | |
| 348 | +} | |
| 349 | + | |
| 350 | +final ratingValues = EnumValues({ | |
| 351 | + "g": Rating.G, | |
| 352 | + "pg": Rating.PG, | |
| 353 | + "y": Rating.Y, | |
| 354 | + "pg-13": Rating.PG_13 | |
| 355 | +}); | |
| 356 | + | |
| 357 | +enum Type { | |
| 358 | + GIF | |
| 359 | +} | |
| 360 | + | |
| 361 | +final typeValues = EnumValues({ | |
| 362 | + "gif": Type.GIF | |
| 363 | +}); | |
| 364 | + | |
| 365 | +class User { | |
| 366 | + final String avatarUrl; | |
| 367 | + final String bannerUrl; | |
| 368 | + final String displayName; | |
| 369 | + final String profileUrl; | |
| 370 | + final String twitter; | |
| 371 | + final String username; | |
| 372 | + | |
| 373 | + User({ | |
| 374 | + required this.avatarUrl, | |
| 375 | + required this.bannerUrl, | |
| 376 | + required this.displayName, | |
| 377 | + required this.profileUrl, | |
| 378 | + required this.twitter, | |
| 379 | + required this.username, | |
| 380 | + }); | |
| 381 | + | |
| 382 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 383 | + avatarUrl: json["avatar_url"], | |
| 384 | + bannerUrl: json["banner_url"], | |
| 385 | + displayName: json["display_name"], | |
| 386 | + profileUrl: json["profile_url"], | |
| 387 | + twitter: json["twitter"], | |
| 388 | + username: json["username"], | |
| 389 | + ); | |
| 390 | + | |
| 391 | + Map<String, dynamic> toJson() => { | |
| 392 | + "avatar_url": avatarUrl, | |
| 393 | + "banner_url": bannerUrl, | |
| 394 | + "display_name": displayName, | |
| 395 | + "profile_url": profileUrl, | |
| 396 | + "twitter": twitter, | |
| 397 | + "username": username, | |
| 398 | + }; | |
| 399 | +} | |
| 400 | + | |
| 401 | +class Meta { | |
| 402 | + final String msg; | |
| 403 | + final String responseId; | |
| 404 | + final int status; | |
| 405 | + | |
| 406 | + Meta({ | |
| 407 | + required this.msg, | |
| 408 | + required this.responseId, | |
| 409 | + required this.status, | |
| 410 | + }); | |
| 411 | + | |
| 412 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 413 | + msg: json["msg"], | |
| 414 | + responseId: json["response_id"], | |
| 415 | + status: json["status"], | |
| 416 | + ); | |
| 417 | + | |
| 418 | + Map<String, dynamic> toJson() => { | |
| 419 | + "msg": msg, | |
| 420 | + "response_id": responseId, | |
| 421 | + "status": status, | |
| 422 | + }; | |
| 423 | +} | |
| 424 | + | |
| 425 | +class Pagination { | |
| 426 | + final int count; | |
| 427 | + final int offset; | |
| 428 | + final int totalCount; | |
| 429 | + | |
| 430 | + Pagination({ | |
| 431 | + required this.count, | |
| 432 | + required this.offset, | |
| 433 | + required this.totalCount, | |
| 434 | + }); | |
| 435 | + | |
| 436 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 437 | + count: json["count"], | |
| 438 | + offset: json["offset"], | |
| 439 | + totalCount: json["total_count"], | |
| 440 | + ); | |
| 441 | + | |
| 442 | + Map<String, dynamic> toJson() => { | |
| 443 | + "count": count, | |
| 444 | + "offset": offset, | |
| 445 | + "total_count": totalCount, | |
| 446 | + }; | |
| 447 | +} | |
| 448 | + | |
| 449 | +class EnumValues<T> { | |
| 450 | + Map<String, T> map; | |
| 451 | + late Map<T, String> reverseMap; | |
| 452 | + | |
| 453 | + EnumValues(this.map); | |
| 454 | + | |
| 455 | + Map<T, String> get reverse { | |
| 456 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 457 | + return reverseMap; | |
| 458 | + } | |
| 459 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/43970.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int id; | |
| 13 | + final String name; | |
| 14 | + final String notes; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.id, | |
| 18 | + required this.name, | |
| 19 | + required this.notes, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + id: json["ID"], | |
| 24 | + name: json["Name"], | |
| 25 | + notes: json["Notes"], | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "ID": id, | |
| 30 | + "Name": name, | |
| 31 | + "Notes": notes, | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/43eaf.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +201 −0test/inputs/json/misc/458db.json
Adartdefault / TopLevel.dart+201 −0
| @@ -0,0 +1,201 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Metadata metadata; | |
| 13 | + final List<Result> results; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.metadata, | |
| 17 | + required this.results, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 22 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "metadata": metadata.toJson(), | |
| 27 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Metadata { | |
| 32 | + final double executionTime; | |
| 33 | + final ResponseInfo responseInfo; | |
| 34 | + final Resultset resultset; | |
| 35 | + | |
| 36 | + Metadata({ | |
| 37 | + required this.executionTime, | |
| 38 | + required this.responseInfo, | |
| 39 | + required this.resultset, | |
| 40 | + }); | |
| 41 | + | |
| 42 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 43 | + executionTime: json["executionTime"]?.toDouble(), | |
| 44 | + responseInfo: ResponseInfo.fromJson(json["responseInfo"]), | |
| 45 | + resultset: Resultset.fromJson(json["resultset"]), | |
| 46 | + ); | |
| 47 | + | |
| 48 | + Map<String, dynamic> toJson() => { | |
| 49 | + "executionTime": executionTime, | |
| 50 | + "responseInfo": responseInfo.toJson(), | |
| 51 | + "resultset": resultset.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class ResponseInfo { | |
| 56 | + final String developerMessage; | |
| 57 | + final int status; | |
| 58 | + | |
| 59 | + ResponseInfo({ | |
| 60 | + required this.developerMessage, | |
| 61 | + required this.status, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory ResponseInfo.fromJson(Map<String, dynamic> json) => ResponseInfo( | |
| 65 | + developerMessage: json["developerMessage"], | |
| 66 | + status: json["status"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "developerMessage": developerMessage, | |
| 71 | + "status": status, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Resultset { | |
| 76 | + final int count; | |
| 77 | + final int page; | |
| 78 | + final int pagesize; | |
| 79 | + | |
| 80 | + Resultset({ | |
| 81 | + required this.count, | |
| 82 | + required this.page, | |
| 83 | + required this.pagesize, | |
| 84 | + }); | |
| 85 | + | |
| 86 | + factory Resultset.fromJson(Map<String, dynamic> json) => Resultset( | |
| 87 | + count: json["count"], | |
| 88 | + page: json["page"], | |
| 89 | + pagesize: json["pagesize"], | |
| 90 | + ); | |
| 91 | + | |
| 92 | + Map<String, dynamic> toJson() => { | |
| 93 | + "count": count, | |
| 94 | + "page": page, | |
| 95 | + "pagesize": pagesize, | |
| 96 | + }; | |
| 97 | +} | |
| 98 | + | |
| 99 | +class Result { | |
| 100 | + final List<dynamic> attachments; | |
| 101 | + final String body; | |
| 102 | + final String changed; | |
| 103 | + final List<Component> component; | |
| 104 | + final String created; | |
| 105 | + final String date; | |
| 106 | + final List<dynamic> image; | |
| 107 | + final List<dynamic> teaser; | |
| 108 | + final String title; | |
| 109 | + final List<dynamic> topic; | |
| 110 | + final String url; | |
| 111 | + final String uuid; | |
| 112 | + final String vuuid; | |
| 113 | + | |
| 114 | + Result({ | |
| 115 | + required this.attachments, | |
| 116 | + required this.body, | |
| 117 | + required this.changed, | |
| 118 | + required this.component, | |
| 119 | + required this.created, | |
| 120 | + required this.date, | |
| 121 | + required this.image, | |
| 122 | + required this.teaser, | |
| 123 | + required this.title, | |
| 124 | + required this.topic, | |
| 125 | + required this.url, | |
| 126 | + required this.uuid, | |
| 127 | + required this.vuuid, | |
| 128 | + }); | |
| 129 | + | |
| 130 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 131 | + attachments: List<dynamic>.from(json["attachments"].map((x) => x)), | |
| 132 | + body: json["body"], | |
| 133 | + changed: json["changed"], | |
| 134 | + component: List<Component>.from(json["component"].map((x) => Component.fromJson(x))), | |
| 135 | + created: json["created"], | |
| 136 | + date: json["date"], | |
| 137 | + image: List<dynamic>.from(json["image"].map((x) => x)), | |
| 138 | + teaser: List<dynamic>.from(json["teaser"].map((x) => x)), | |
| 139 | + title: json["title"], | |
| 140 | + topic: List<dynamic>.from(json["topic"].map((x) => x)), | |
| 141 | + url: json["url"], | |
| 142 | + uuid: json["uuid"], | |
| 143 | + vuuid: json["vuuid"], | |
| 144 | + ); | |
| 145 | + | |
| 146 | + Map<String, dynamic> toJson() => { | |
| 147 | + "attachments": List<dynamic>.from(attachments.map((x) => x)), | |
| 148 | + "body": body, | |
| 149 | + "changed": changed, | |
| 150 | + "component": List<dynamic>.from(component.map((x) => x.toJson())), | |
| 151 | + "created": created, | |
| 152 | + "date": date, | |
| 153 | + "image": List<dynamic>.from(image.map((x) => x)), | |
| 154 | + "teaser": List<dynamic>.from(teaser.map((x) => x)), | |
| 155 | + "title": title, | |
| 156 | + "topic": List<dynamic>.from(topic.map((x) => x)), | |
| 157 | + "url": url, | |
| 158 | + "uuid": uuid, | |
| 159 | + "vuuid": vuuid, | |
| 160 | + }; | |
| 161 | +} | |
| 162 | + | |
| 163 | +class Component { | |
| 164 | + final Name name; | |
| 165 | + final String uuid; | |
| 166 | + | |
| 167 | + Component({ | |
| 168 | + required this.name, | |
| 169 | + required this.uuid, | |
| 170 | + }); | |
| 171 | + | |
| 172 | + factory Component.fromJson(Map<String, dynamic> json) => Component( | |
| 173 | + name: nameValues.map[json["name"]]!, | |
| 174 | + uuid: json["uuid"], | |
| 175 | + ); | |
| 176 | + | |
| 177 | + Map<String, dynamic> toJson() => { | |
| 178 | + "name": nameValues.reverse[name], | |
| 179 | + "uuid": uuid, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +enum Name { | |
| 184 | + OFFICE_ON_VIOLENCE_AGAINST_WOMEN | |
| 185 | +} | |
| 186 | + | |
| 187 | +final nameValues = EnumValues({ | |
| 188 | + "Office on Violence Against Women": Name.OFFICE_ON_VIOLENCE_AGAINST_WOMEN | |
| 189 | +}); | |
| 190 | + | |
| 191 | +class EnumValues<T> { | |
| 192 | + Map<String, T> map; | |
| 193 | + late Map<T, String> reverseMap; | |
| 194 | + | |
| 195 | + EnumValues(this.map); | |
| 196 | + | |
| 197 | + Map<T, String> get reverse { | |
| 198 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 199 | + return reverseMap; | |
| 200 | + } | |
| 201 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/4961a.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/4a0d7.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +197 −0test/inputs/json/misc/4a455.json
Adartdefault / TopLevel.dart+197 −0
| @@ -0,0 +1,197 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Crs crs; | |
| 13 | + final List<Feature> features; | |
| 14 | + final int totalFeatures; | |
| 15 | + final String type; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.crs, | |
| 19 | + required this.features, | |
| 20 | + required this.totalFeatures, | |
| 21 | + required this.type, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + crs: Crs.fromJson(json["crs"]), | |
| 26 | + features: List<Feature>.from(json["features"].map((x) => Feature.fromJson(x))), | |
| 27 | + totalFeatures: json["totalFeatures"], | |
| 28 | + type: json["type"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "crs": crs.toJson(), | |
| 33 | + "features": List<dynamic>.from(features.map((x) => x.toJson())), | |
| 34 | + "totalFeatures": totalFeatures, | |
| 35 | + "type": type, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Crs { | |
| 40 | + final CrsProperties properties; | |
| 41 | + final String type; | |
| 42 | + | |
| 43 | + Crs({ | |
| 44 | + required this.properties, | |
| 45 | + required this.type, | |
| 46 | + }); | |
| 47 | + | |
| 48 | + factory Crs.fromJson(Map<String, dynamic> json) => Crs( | |
| 49 | + properties: CrsProperties.fromJson(json["properties"]), | |
| 50 | + type: json["type"], | |
| 51 | + ); | |
| 52 | + | |
| 53 | + Map<String, dynamic> toJson() => { | |
| 54 | + "properties": properties.toJson(), | |
| 55 | + "type": type, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class CrsProperties { | |
| 60 | + final String name; | |
| 61 | + | |
| 62 | + CrsProperties({ | |
| 63 | + required this.name, | |
| 64 | + }); | |
| 65 | + | |
| 66 | + factory CrsProperties.fromJson(Map<String, dynamic> json) => CrsProperties( | |
| 67 | + name: json["name"], | |
| 68 | + ); | |
| 69 | + | |
| 70 | + Map<String, dynamic> toJson() => { | |
| 71 | + "name": name, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Feature { | |
| 76 | + final Geometry geometry; | |
| 77 | + final GeometryName geometryName; | |
| 78 | + final String id; | |
| 79 | + final FeatureProperties properties; | |
| 80 | + final FeatureType type; | |
| 81 | + | |
| 82 | + Feature({ | |
| 83 | + required this.geometry, | |
| 84 | + required this.geometryName, | |
| 85 | + required this.id, | |
| 86 | + required this.properties, | |
| 87 | + required this.type, | |
| 88 | + }); | |
| 89 | + | |
| 90 | + factory Feature.fromJson(Map<String, dynamic> json) => Feature( | |
| 91 | + geometry: Geometry.fromJson(json["geometry"]), | |
| 92 | + geometryName: geometryNameValues.map[json["geometry_name"]]!, | |
| 93 | + id: json["id"], | |
| 94 | + properties: FeatureProperties.fromJson(json["properties"]), | |
| 95 | + type: featureTypeValues.map[json["type"]]!, | |
| 96 | + ); | |
| 97 | + | |
| 98 | + Map<String, dynamic> toJson() => { | |
| 99 | + "geometry": geometry.toJson(), | |
| 100 | + "geometry_name": geometryNameValues.reverse[geometryName], | |
| 101 | + "id": id, | |
| 102 | + "properties": properties.toJson(), | |
| 103 | + "type": featureTypeValues.reverse[type], | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Geometry { | |
| 108 | + final List<List<double>> coordinates; | |
| 109 | + final GeometryType type; | |
| 110 | + | |
| 111 | + Geometry({ | |
| 112 | + required this.coordinates, | |
| 113 | + required this.type, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory Geometry.fromJson(Map<String, dynamic> json) => Geometry( | |
| 117 | + coordinates: List<List<double>>.from(json["coordinates"].map((x) => List<double>.from(x.map((x) => x?.toDouble())))), | |
| 118 | + type: geometryTypeValues.map[json["type"]]!, | |
| 119 | + ); | |
| 120 | + | |
| 121 | + Map<String, dynamic> toJson() => { | |
| 122 | + "coordinates": List<dynamic>.from(coordinates.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 123 | + "type": geometryTypeValues.reverse[type], | |
| 124 | + }; | |
| 125 | +} | |
| 126 | + | |
| 127 | +enum GeometryType { | |
| 128 | + MULTI_POINT | |
| 129 | +} | |
| 130 | + | |
| 131 | +final geometryTypeValues = EnumValues({ | |
| 132 | + "MultiPoint": GeometryType.MULTI_POINT | |
| 133 | +}); | |
| 134 | + | |
| 135 | +enum GeometryName { | |
| 136 | + GEOM | |
| 137 | +} | |
| 138 | + | |
| 139 | +final geometryNameValues = EnumValues({ | |
| 140 | + "geom": GeometryName.GEOM | |
| 141 | +}); | |
| 142 | + | |
| 143 | +class FeatureProperties { | |
| 144 | + final String facebookaccount; | |
| 145 | + final String frequencyfinderurl; | |
| 146 | + final String name; | |
| 147 | + final String siteurl; | |
| 148 | + final String streetaddress; | |
| 149 | + final String twitteraccount; | |
| 150 | + | |
| 151 | + FeatureProperties({ | |
| 152 | + required this.facebookaccount, | |
| 153 | + required this.frequencyfinderurl, | |
| 154 | + required this.name, | |
| 155 | + required this.siteurl, | |
| 156 | + required this.streetaddress, | |
| 157 | + required this.twitteraccount, | |
| 158 | + }); | |
| 159 | + | |
| 160 | + factory FeatureProperties.fromJson(Map<String, dynamic> json) => FeatureProperties( | |
| 161 | + facebookaccount: json["facebookaccount"], | |
| 162 | + frequencyfinderurl: json["frequencyfinderurl"], | |
| 163 | + name: json["name"], | |
| 164 | + siteurl: json["siteurl"], | |
| 165 | + streetaddress: json["streetaddress"], | |
| 166 | + twitteraccount: json["twitteraccount"], | |
| 167 | + ); | |
| 168 | + | |
| 169 | + Map<String, dynamic> toJson() => { | |
| 170 | + "facebookaccount": facebookaccount, | |
| 171 | + "frequencyfinderurl": frequencyfinderurl, | |
| 172 | + "name": name, | |
| 173 | + "siteurl": siteurl, | |
| 174 | + "streetaddress": streetaddress, | |
| 175 | + "twitteraccount": twitteraccount, | |
| 176 | + }; | |
| 177 | +} | |
| 178 | + | |
| 179 | +enum FeatureType { | |
| 180 | + FEATURE | |
| 181 | +} | |
| 182 | + | |
| 183 | +final featureTypeValues = EnumValues({ | |
| 184 | + "Feature": FeatureType.FEATURE | |
| 185 | +}); | |
| 186 | + | |
| 187 | +class EnumValues<T> { | |
| 188 | + Map<String, T> map; | |
| 189 | + late Map<T, String> reverseMap; | |
| 190 | + | |
| 191 | + EnumValues(this.map); | |
| 192 | + | |
| 193 | + Map<T, String> get reverse { | |
| 194 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 195 | + return reverseMap; | |
| 196 | + } | |
| 197 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/4c547.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +601 −0test/inputs/json/misc/4d6fb.json
Adartdefault / TopLevel.dart+601 −0
| @@ -0,0 +1,601 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final dynamic authorFlairCssClass; | |
| 85 | + final dynamic authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final dynamic distinguished; | |
| 96 | + final String domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final dynamic linkFlairCssClass; | |
| 107 | + final dynamic linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final Media? media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final PostHint? postHint; | |
| 118 | + final Preview? preview; | |
| 119 | + final bool quarantine; | |
| 120 | + final dynamic removalReason; | |
| 121 | + final dynamic reportReasons; | |
| 122 | + final bool saved; | |
| 123 | + final int score; | |
| 124 | + final Media? secureMedia; | |
| 125 | + final MediaEmbed secureMediaEmbed; | |
| 126 | + final String selftext; | |
| 127 | + final dynamic selftextHtml; | |
| 128 | + final bool spoiler; | |
| 129 | + final bool stickied; | |
| 130 | + final Subreddit subreddit; | |
| 131 | + final SubredditId subredditId; | |
| 132 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 133 | + final SubredditType subredditType; | |
| 134 | + final dynamic suggestedSort; | |
| 135 | + final String thumbnail; | |
| 136 | + final int? thumbnailHeight; | |
| 137 | + final int? thumbnailWidth; | |
| 138 | + final String title; | |
| 139 | + final int ups; | |
| 140 | + final String url; | |
| 141 | + final List<dynamic> userReports; | |
| 142 | + final dynamic viewCount; | |
| 143 | + final bool visited; | |
| 144 | + | |
| 145 | + ChildData({ | |
| 146 | + required this.approvedAtUtc, | |
| 147 | + required this.approvedBy, | |
| 148 | + required this.archived, | |
| 149 | + required this.author, | |
| 150 | + required this.authorFlairCssClass, | |
| 151 | + required this.authorFlairText, | |
| 152 | + required this.bannedAtUtc, | |
| 153 | + required this.bannedBy, | |
| 154 | + required this.brandSafe, | |
| 155 | + required this.canGild, | |
| 156 | + required this.canModPost, | |
| 157 | + required this.clicked, | |
| 158 | + required this.contestMode, | |
| 159 | + required this.created, | |
| 160 | + required this.createdUtc, | |
| 161 | + required this.distinguished, | |
| 162 | + required this.domain, | |
| 163 | + required this.downs, | |
| 164 | + required this.edited, | |
| 165 | + required this.gilded, | |
| 166 | + required this.hidden, | |
| 167 | + required this.hideScore, | |
| 168 | + required this.id, | |
| 169 | + required this.isSelf, | |
| 170 | + required this.isVideo, | |
| 171 | + required this.likes, | |
| 172 | + required this.linkFlairCssClass, | |
| 173 | + required this.linkFlairText, | |
| 174 | + required this.locked, | |
| 175 | + required this.media, | |
| 176 | + required this.mediaEmbed, | |
| 177 | + required this.modReports, | |
| 178 | + required this.name, | |
| 179 | + required this.numComments, | |
| 180 | + required this.numReports, | |
| 181 | + required this.over18, | |
| 182 | + required this.permalink, | |
| 183 | + this.postHint, | |
| 184 | + this.preview, | |
| 185 | + required this.quarantine, | |
| 186 | + required this.removalReason, | |
| 187 | + required this.reportReasons, | |
| 188 | + required this.saved, | |
| 189 | + required this.score, | |
| 190 | + required this.secureMedia, | |
| 191 | + required this.secureMediaEmbed, | |
| 192 | + required this.selftext, | |
| 193 | + required this.selftextHtml, | |
| 194 | + required this.spoiler, | |
| 195 | + required this.stickied, | |
| 196 | + required this.subreddit, | |
| 197 | + required this.subredditId, | |
| 198 | + required this.subredditNamePrefixed, | |
| 199 | + required this.subredditType, | |
| 200 | + required this.suggestedSort, | |
| 201 | + required this.thumbnail, | |
| 202 | + required this.thumbnailHeight, | |
| 203 | + required this.thumbnailWidth, | |
| 204 | + required this.title, | |
| 205 | + required this.ups, | |
| 206 | + required this.url, | |
| 207 | + required this.userReports, | |
| 208 | + required this.viewCount, | |
| 209 | + required this.visited, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 213 | + approvedAtUtc: json["approved_at_utc"], | |
| 214 | + approvedBy: json["approved_by"], | |
| 215 | + archived: json["archived"], | |
| 216 | + author: json["author"], | |
| 217 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 218 | + authorFlairText: json["author_flair_text"], | |
| 219 | + bannedAtUtc: json["banned_at_utc"], | |
| 220 | + bannedBy: json["banned_by"], | |
| 221 | + brandSafe: json["brand_safe"], | |
| 222 | + canGild: json["can_gild"], | |
| 223 | + canModPost: json["can_mod_post"], | |
| 224 | + clicked: json["clicked"], | |
| 225 | + contestMode: json["contest_mode"], | |
| 226 | + created: json["created"]?.toDouble(), | |
| 227 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 228 | + distinguished: json["distinguished"], | |
| 229 | + domain: json["domain"], | |
| 230 | + downs: json["downs"], | |
| 231 | + edited: json["edited"], | |
| 232 | + gilded: json["gilded"], | |
| 233 | + hidden: json["hidden"], | |
| 234 | + hideScore: json["hide_score"], | |
| 235 | + id: json["id"], | |
| 236 | + isSelf: json["is_self"], | |
| 237 | + isVideo: json["is_video"], | |
| 238 | + likes: json["likes"], | |
| 239 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 240 | + linkFlairText: json["link_flair_text"], | |
| 241 | + locked: json["locked"], | |
| 242 | + media: json["media"] == null ? null : Media.fromJson(json["media"]), | |
| 243 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 244 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 245 | + name: json["name"], | |
| 246 | + numComments: json["num_comments"], | |
| 247 | + numReports: json["num_reports"], | |
| 248 | + over18: json["over_18"], | |
| 249 | + permalink: json["permalink"], | |
| 250 | + postHint: postHintValues.map[json["post_hint"]], | |
| 251 | + preview: json["preview"] == null ? null : Preview.fromJson(json["preview"]), | |
| 252 | + quarantine: json["quarantine"], | |
| 253 | + removalReason: json["removal_reason"], | |
| 254 | + reportReasons: json["report_reasons"], | |
| 255 | + saved: json["saved"], | |
| 256 | + score: json["score"], | |
| 257 | + secureMedia: json["secure_media"] == null ? null : Media.fromJson(json["secure_media"]), | |
| 258 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 259 | + selftext: json["selftext"], | |
| 260 | + selftextHtml: json["selftext_html"], | |
| 261 | + spoiler: json["spoiler"], | |
| 262 | + stickied: json["stickied"], | |
| 263 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 264 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 265 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 266 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 267 | + suggestedSort: json["suggested_sort"], | |
| 268 | + thumbnail: json["thumbnail"], | |
| 269 | + thumbnailHeight: json["thumbnail_height"], | |
| 270 | + thumbnailWidth: json["thumbnail_width"], | |
| 271 | + title: json["title"], | |
| 272 | + ups: json["ups"], | |
| 273 | + url: json["url"], | |
| 274 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 275 | + viewCount: json["view_count"], | |
| 276 | + visited: json["visited"], | |
| 277 | + ); | |
| 278 | + | |
| 279 | + Map<String, dynamic> toJson() => { | |
| 280 | + "approved_at_utc": approvedAtUtc, | |
| 281 | + "approved_by": approvedBy, | |
| 282 | + "archived": archived, | |
| 283 | + "author": author, | |
| 284 | + "author_flair_css_class": authorFlairCssClass, | |
| 285 | + "author_flair_text": authorFlairText, | |
| 286 | + "banned_at_utc": bannedAtUtc, | |
| 287 | + "banned_by": bannedBy, | |
| 288 | + "brand_safe": brandSafe, | |
| 289 | + "can_gild": canGild, | |
| 290 | + "can_mod_post": canModPost, | |
| 291 | + "clicked": clicked, | |
| 292 | + "contest_mode": contestMode, | |
| 293 | + "created": created, | |
| 294 | + "created_utc": createdUtc, | |
| 295 | + "distinguished": distinguished, | |
| 296 | + "domain": domain, | |
| 297 | + "downs": downs, | |
| 298 | + "edited": edited, | |
| 299 | + "gilded": gilded, | |
| 300 | + "hidden": hidden, | |
| 301 | + "hide_score": hideScore, | |
| 302 | + "id": id, | |
| 303 | + "is_self": isSelf, | |
| 304 | + "is_video": isVideo, | |
| 305 | + "likes": likes, | |
| 306 | + "link_flair_css_class": linkFlairCssClass, | |
| 307 | + "link_flair_text": linkFlairText, | |
| 308 | + "locked": locked, | |
| 309 | + "media": media?.toJson(), | |
| 310 | + "media_embed": mediaEmbed.toJson(), | |
| 311 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 312 | + "name": name, | |
| 313 | + "num_comments": numComments, | |
| 314 | + "num_reports": numReports, | |
| 315 | + "over_18": over18, | |
| 316 | + "permalink": permalink, | |
| 317 | + "post_hint": postHintValues.reverse[postHint], | |
| 318 | + "preview": preview?.toJson(), | |
| 319 | + "quarantine": quarantine, | |
| 320 | + "removal_reason": removalReason, | |
| 321 | + "report_reasons": reportReasons, | |
| 322 | + "saved": saved, | |
| 323 | + "score": score, | |
| 324 | + "secure_media": secureMedia?.toJson(), | |
| 325 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 326 | + "selftext": selftext, | |
| 327 | + "selftext_html": selftextHtml, | |
| 328 | + "spoiler": spoiler, | |
| 329 | + "stickied": stickied, | |
| 330 | + "subreddit": subredditValues.reverse[subreddit], | |
| 331 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 332 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 333 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 334 | + "suggested_sort": suggestedSort, | |
| 335 | + "thumbnail": thumbnail, | |
| 336 | + "thumbnail_height": thumbnailHeight, | |
| 337 | + "thumbnail_width": thumbnailWidth, | |
| 338 | + "title": title, | |
| 339 | + "ups": ups, | |
| 340 | + "url": url, | |
| 341 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 342 | + "view_count": viewCount, | |
| 343 | + "visited": visited, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +class Media { | |
| 348 | + final Oembed oembed; | |
| 349 | + final String type; | |
| 350 | + | |
| 351 | + Media({ | |
| 352 | + required this.oembed, | |
| 353 | + required this.type, | |
| 354 | + }); | |
| 355 | + | |
| 356 | + factory Media.fromJson(Map<String, dynamic> json) => Media( | |
| 357 | + oembed: Oembed.fromJson(json["oembed"]), | |
| 358 | + type: json["type"], | |
| 359 | + ); | |
| 360 | + | |
| 361 | + Map<String, dynamic> toJson() => { | |
| 362 | + "oembed": oembed.toJson(), | |
| 363 | + "type": type, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Oembed { | |
| 368 | + final String authorName; | |
| 369 | + final String authorUrl; | |
| 370 | + final int height; | |
| 371 | + final String html; | |
| 372 | + final String providerName; | |
| 373 | + final String providerUrl; | |
| 374 | + final int thumbnailHeight; | |
| 375 | + final String thumbnailUrl; | |
| 376 | + final int thumbnailWidth; | |
| 377 | + final String title; | |
| 378 | + final String type; | |
| 379 | + final String version; | |
| 380 | + final int width; | |
| 381 | + | |
| 382 | + Oembed({ | |
| 383 | + required this.authorName, | |
| 384 | + required this.authorUrl, | |
| 385 | + required this.height, | |
| 386 | + required this.html, | |
| 387 | + required this.providerName, | |
| 388 | + required this.providerUrl, | |
| 389 | + required this.thumbnailHeight, | |
| 390 | + required this.thumbnailUrl, | |
| 391 | + required this.thumbnailWidth, | |
| 392 | + required this.title, | |
| 393 | + required this.type, | |
| 394 | + required this.version, | |
| 395 | + required this.width, | |
| 396 | + }); | |
| 397 | + | |
| 398 | + factory Oembed.fromJson(Map<String, dynamic> json) => Oembed( | |
| 399 | + authorName: json["author_name"], | |
| 400 | + authorUrl: json["author_url"], | |
| 401 | + height: json["height"], | |
| 402 | + html: json["html"], | |
| 403 | + providerName: json["provider_name"], | |
| 404 | + providerUrl: json["provider_url"], | |
| 405 | + thumbnailHeight: json["thumbnail_height"], | |
| 406 | + thumbnailUrl: json["thumbnail_url"], | |
| 407 | + thumbnailWidth: json["thumbnail_width"], | |
| 408 | + title: json["title"], | |
| 409 | + type: json["type"], | |
| 410 | + version: json["version"], | |
| 411 | + width: json["width"], | |
| 412 | + ); | |
| 413 | + | |
| 414 | + Map<String, dynamic> toJson() => { | |
| 415 | + "author_name": authorName, | |
| 416 | + "author_url": authorUrl, | |
| 417 | + "height": height, | |
| 418 | + "html": html, | |
| 419 | + "provider_name": providerName, | |
| 420 | + "provider_url": providerUrl, | |
| 421 | + "thumbnail_height": thumbnailHeight, | |
| 422 | + "thumbnail_url": thumbnailUrl, | |
| 423 | + "thumbnail_width": thumbnailWidth, | |
| 424 | + "title": title, | |
| 425 | + "type": type, | |
| 426 | + "version": version, | |
| 427 | + "width": width, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class MediaEmbed { | |
| 432 | + final String? content; | |
| 433 | + final int? height; | |
| 434 | + final bool? scrolling; | |
| 435 | + final int? width; | |
| 436 | + | |
| 437 | + MediaEmbed({ | |
| 438 | + this.content, | |
| 439 | + this.height, | |
| 440 | + this.scrolling, | |
| 441 | + this.width, | |
| 442 | + }); | |
| 443 | + | |
| 444 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 445 | + content: json["content"], | |
| 446 | + height: json["height"], | |
| 447 | + scrolling: json["scrolling"], | |
| 448 | + width: json["width"], | |
| 449 | + ); | |
| 450 | + | |
| 451 | + Map<String, dynamic> toJson() => { | |
| 452 | + "content": content, | |
| 453 | + "height": height, | |
| 454 | + "scrolling": scrolling, | |
| 455 | + "width": width, | |
| 456 | + }; | |
| 457 | +} | |
| 458 | + | |
| 459 | +enum PostHint { | |
| 460 | + RICH_VIDEO, | |
| 461 | + LINK | |
| 462 | +} | |
| 463 | + | |
| 464 | +final postHintValues = EnumValues({ | |
| 465 | + "rich:video": PostHint.RICH_VIDEO, | |
| 466 | + "link": PostHint.LINK | |
| 467 | +}); | |
| 468 | + | |
| 469 | +class Preview { | |
| 470 | + final bool enabled; | |
| 471 | + final List<Image> images; | |
| 472 | + | |
| 473 | + Preview({ | |
| 474 | + required this.enabled, | |
| 475 | + required this.images, | |
| 476 | + }); | |
| 477 | + | |
| 478 | + factory Preview.fromJson(Map<String, dynamic> json) => Preview( | |
| 479 | + enabled: json["enabled"], | |
| 480 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 481 | + ); | |
| 482 | + | |
| 483 | + Map<String, dynamic> toJson() => { | |
| 484 | + "enabled": enabled, | |
| 485 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 486 | + }; | |
| 487 | +} | |
| 488 | + | |
| 489 | +class Image { | |
| 490 | + final String id; | |
| 491 | + final List<Source> resolutions; | |
| 492 | + final Source source; | |
| 493 | + final Variants variants; | |
| 494 | + | |
| 495 | + Image({ | |
| 496 | + required this.id, | |
| 497 | + required this.resolutions, | |
| 498 | + required this.source, | |
| 499 | + required this.variants, | |
| 500 | + }); | |
| 501 | + | |
| 502 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 503 | + id: json["id"], | |
| 504 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 505 | + source: Source.fromJson(json["source"]), | |
| 506 | + variants: Variants.fromJson(json["variants"]), | |
| 507 | + ); | |
| 508 | + | |
| 509 | + Map<String, dynamic> toJson() => { | |
| 510 | + "id": id, | |
| 511 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 512 | + "source": source.toJson(), | |
| 513 | + "variants": variants.toJson(), | |
| 514 | + }; | |
| 515 | +} | |
| 516 | + | |
| 517 | +class Source { | |
| 518 | + final int height; | |
| 519 | + final String url; | |
| 520 | + final int width; | |
| 521 | + | |
| 522 | + Source({ | |
| 523 | + required this.height, | |
| 524 | + required this.url, | |
| 525 | + required this.width, | |
| 526 | + }); | |
| 527 | + | |
| 528 | + factory Source.fromJson(Map<String, dynamic> json) => Source( | |
| 529 | + height: json["height"], | |
| 530 | + url: json["url"], | |
| 531 | + width: json["width"], | |
| 532 | + ); | |
| 533 | + | |
| 534 | + Map<String, dynamic> toJson() => { | |
| 535 | + "height": height, | |
| 536 | + "url": url, | |
| 537 | + "width": width, | |
| 538 | + }; | |
| 539 | +} | |
| 540 | + | |
| 541 | +class Variants { | |
| 542 | + Variants(); | |
| 543 | + | |
| 544 | + factory Variants.fromJson(Map<String, dynamic> json) => Variants( | |
| 545 | + ); | |
| 546 | + | |
| 547 | + Map<String, dynamic> toJson() => { | |
| 548 | + }; | |
| 549 | +} | |
| 550 | + | |
| 551 | +enum Subreddit { | |
| 552 | + TODAYILEARNED | |
| 553 | +} | |
| 554 | + | |
| 555 | +final subredditValues = EnumValues({ | |
| 556 | + "todayilearned": Subreddit.TODAYILEARNED | |
| 557 | +}); | |
| 558 | + | |
| 559 | +enum SubredditId { | |
| 560 | + T5_2_QQJC | |
| 561 | +} | |
| 562 | + | |
| 563 | +final subredditIdValues = EnumValues({ | |
| 564 | + "t5_2qqjc": SubredditId.T5_2_QQJC | |
| 565 | +}); | |
| 566 | + | |
| 567 | +enum SubredditNamePrefixed { | |
| 568 | + R_TODAYILEARNED | |
| 569 | +} | |
| 570 | + | |
| 571 | +final subredditNamePrefixedValues = EnumValues({ | |
| 572 | + "r/todayilearned": SubredditNamePrefixed.R_TODAYILEARNED | |
| 573 | +}); | |
| 574 | + | |
| 575 | +enum SubredditType { | |
| 576 | + PUBLIC | |
| 577 | +} | |
| 578 | + | |
| 579 | +final subredditTypeValues = EnumValues({ | |
| 580 | + "public": SubredditType.PUBLIC | |
| 581 | +}); | |
| 582 | + | |
| 583 | +enum Kind { | |
| 584 | + T3 | |
| 585 | +} | |
| 586 | + | |
| 587 | +final kindValues = EnumValues({ | |
| 588 | + "t3": Kind.T3 | |
| 589 | +}); | |
| 590 | + | |
| 591 | +class EnumValues<T> { | |
| 592 | + Map<String, T> map; | |
| 593 | + late Map<T, String> reverseMap; | |
| 594 | + | |
| 595 | + EnumValues(this.map); | |
| 596 | + | |
| 597 | + Map<T, String> get reverse { | |
| 598 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 599 | + return reverseMap; | |
| 600 | + } | |
| 601 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/4e336.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +87 −0test/inputs/json/misc/54147.json
Adartdefault / TopLevel.dart+87 −0
| @@ -0,0 +1,87 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Args args; | |
| 13 | + final String data; | |
| 14 | + final Args files; | |
| 15 | + final Args form; | |
| 16 | + final Headers headers; | |
| 17 | + final String origin; | |
| 18 | + final String url; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.args, | |
| 22 | + required this.data, | |
| 23 | + required this.files, | |
| 24 | + required this.form, | |
| 25 | + required this.headers, | |
| 26 | + required this.origin, | |
| 27 | + required this.url, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + args: Args.fromJson(json["args"]), | |
| 32 | + data: json["data"], | |
| 33 | + files: Args.fromJson(json["files"]), | |
| 34 | + form: Args.fromJson(json["form"]), | |
| 35 | + headers: Headers.fromJson(json["headers"]), | |
| 36 | + origin: json["origin"], | |
| 37 | + url: json["url"], | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "args": args.toJson(), | |
| 42 | + "data": data, | |
| 43 | + "files": files.toJson(), | |
| 44 | + "form": form.toJson(), | |
| 45 | + "headers": headers.toJson(), | |
| 46 | + "origin": origin, | |
| 47 | + "url": url, | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Args { | |
| 52 | + Args(); | |
| 53 | + | |
| 54 | + factory Args.fromJson(Map<String, dynamic> json) => Args( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Headers { | |
| 62 | + final String acceptEncoding; | |
| 63 | + final String connection; | |
| 64 | + final String host; | |
| 65 | + final String userAgent; | |
| 66 | + | |
| 67 | + Headers({ | |
| 68 | + required this.acceptEncoding, | |
| 69 | + required this.connection, | |
| 70 | + required this.host, | |
| 71 | + required this.userAgent, | |
| 72 | + }); | |
| 73 | + | |
| 74 | + factory Headers.fromJson(Map<String, dynamic> json) => Headers( | |
| 75 | + acceptEncoding: json["Accept-Encoding"], | |
| 76 | + connection: json["Connection"], | |
| 77 | + host: json["Host"], | |
| 78 | + userAgent: json["User-Agent"], | |
| 79 | + ); | |
| 80 | + | |
| 81 | + Map<String, dynamic> toJson() => { | |
| 82 | + "Accept-Encoding": acceptEncoding, | |
| 83 | + "Connection": connection, | |
| 84 | + "Host": host, | |
| 85 | + "User-Agent": userAgent, | |
| 86 | + }; | |
| 87 | +} |
Test case
1 generated file · +117 −0test/inputs/json/misc/54d32.json
Adartdefault / TopLevel.dart+117 −0
| @@ -0,0 +1,117 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final String next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final DateTime createdAt; | |
| 63 | + final String id; | |
| 64 | + final String personId; | |
| 65 | + final String representativeId; | |
| 66 | + final Status status; | |
| 67 | + final DateTime updatedAt; | |
| 68 | + | |
| 69 | + Result({ | |
| 70 | + required this.createdAt, | |
| 71 | + required this.id, | |
| 72 | + required this.personId, | |
| 73 | + required this.representativeId, | |
| 74 | + required this.status, | |
| 75 | + required this.updatedAt, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 79 | + createdAt: DateTime.parse(json["created_at"]), | |
| 80 | + id: json["id"], | |
| 81 | + personId: json["person_id"], | |
| 82 | + representativeId: json["representative_id"], | |
| 83 | + status: statusValues.map[json["status"]]!, | |
| 84 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 85 | + ); | |
| 86 | + | |
| 87 | + Map<String, dynamic> toJson() => { | |
| 88 | + "created_at": createdAt.toIso8601String(), | |
| 89 | + "id": id, | |
| 90 | + "person_id": personId, | |
| 91 | + "representative_id": representativeId, | |
| 92 | + "status": statusValues.reverse[status], | |
| 93 | + "updated_at": updatedAt.toIso8601String(), | |
| 94 | + }; | |
| 95 | +} | |
| 96 | + | |
| 97 | +enum Status { | |
| 98 | + INACTIVE, | |
| 99 | + ACTIVE | |
| 100 | +} | |
| 101 | + | |
| 102 | +final statusValues = EnumValues({ | |
| 103 | + "inactive": Status.INACTIVE, | |
| 104 | + "active": Status.ACTIVE | |
| 105 | +}); | |
| 106 | + | |
| 107 | +class EnumValues<T> { | |
| 108 | + Map<String, T> map; | |
| 109 | + late Map<T, String> reverseMap; | |
| 110 | + | |
| 111 | + EnumValues(this.map); | |
| 112 | + | |
| 113 | + Map<T, String> get reverse { | |
| 114 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 115 | + return reverseMap; | |
| 116 | + } | |
| 117 | +} |
Test case
1 generated file · +161 −0test/inputs/json/misc/570ec.json
Adartdefault / TopLevel.dart+161 −0
| @@ -0,0 +1,161 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<String> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<OtherName> otherNames; | |
| 18 | + final dynamic supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<String>.from(json["keywords"].map((x) => x)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<OtherName>.from(json["other_names"].map((x) => OtherName.fromJson(x))), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => x)), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x.toJson())), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + DEP5, | |
| 77 | + SPDX, | |
| 78 | + TROVE | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "DEP5": Scheme.DEP5, | |
| 83 | + "SPDX": Scheme.SPDX, | |
| 84 | + "Trove": Scheme.TROVE | |
| 85 | +}); | |
| 86 | + | |
| 87 | +class Link { | |
| 88 | + final String note; | |
| 89 | + final String url; | |
| 90 | + | |
| 91 | + Link({ | |
| 92 | + required this.note, | |
| 93 | + required this.url, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 97 | + note: json["note"], | |
| 98 | + url: json["url"], | |
| 99 | + ); | |
| 100 | + | |
| 101 | + Map<String, dynamic> toJson() => { | |
| 102 | + "note": note, | |
| 103 | + "url": url, | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class OtherName { | |
| 108 | + final String name; | |
| 109 | + final String? note; | |
| 110 | + | |
| 111 | + OtherName({ | |
| 112 | + required this.name, | |
| 113 | + required this.note, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory OtherName.fromJson(Map<String, dynamic> json) => OtherName( | |
| 117 | + name: json["name"], | |
| 118 | + note: json["note"], | |
| 119 | + ); | |
| 120 | + | |
| 121 | + Map<String, dynamic> toJson() => { | |
| 122 | + "name": name, | |
| 123 | + "note": note, | |
| 124 | + }; | |
| 125 | +} | |
| 126 | + | |
| 127 | +class Text { | |
| 128 | + final String mediaType; | |
| 129 | + final String title; | |
| 130 | + final String url; | |
| 131 | + | |
| 132 | + Text({ | |
| 133 | + required this.mediaType, | |
| 134 | + required this.title, | |
| 135 | + required this.url, | |
| 136 | + }); | |
| 137 | + | |
| 138 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 139 | + mediaType: json["media_type"], | |
| 140 | + title: json["title"], | |
| 141 | + url: json["url"], | |
| 142 | + ); | |
| 143 | + | |
| 144 | + Map<String, dynamic> toJson() => { | |
| 145 | + "media_type": mediaType, | |
| 146 | + "title": title, | |
| 147 | + "url": url, | |
| 148 | + }; | |
| 149 | +} | |
| 150 | + | |
| 151 | +class EnumValues<T> { | |
| 152 | + Map<String, T> map; | |
| 153 | + late Map<T, String> reverseMap; | |
| 154 | + | |
| 155 | + EnumValues(this.map); | |
| 156 | + | |
| 157 | + Map<T, String> get reverse { | |
| 158 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 159 | + return reverseMap; | |
| 160 | + } | |
| 161 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/5dd0d.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +37 −0test/inputs/json/misc/5eae5.json
Adartdefault / TopLevel.dart+37 −0
| @@ -0,0 +1,37 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final DateTime date; | |
| 13 | + final int id; | |
| 14 | + final String sponsor; | |
| 15 | + final String title; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.date, | |
| 19 | + required this.id, | |
| 20 | + required this.sponsor, | |
| 21 | + required this.title, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + date: DateTime.parse(json["Date"]), | |
| 26 | + id: json["ID"], | |
| 27 | + sponsor: json["Sponsor"], | |
| 28 | + title: json["Title"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "Date": date.toIso8601String(), | |
| 33 | + "ID": id, | |
| 34 | + "Sponsor": sponsor, | |
| 35 | + "Title": title, | |
| 36 | + }; | |
| 37 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/5eb20.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/5f3a1.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +773 −0test/inputs/json/misc/5f7fe.json
Adartdefault / TopLevel.dart+773 −0
| @@ -0,0 +1,773 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final String attribution; | |
| 49 | + final String attributionLink; | |
| 50 | + final int averageRating; | |
| 51 | + final String category; | |
| 52 | + final List<Column> columns; | |
| 53 | + final int createdAt; | |
| 54 | + final String description; | |
| 55 | + final String displayType; | |
| 56 | + final int downloadCount; | |
| 57 | + final List<String> flags; | |
| 58 | + final List<Grant> grants; | |
| 59 | + final bool hideFromCatalog; | |
| 60 | + final bool hideFromDataJson; | |
| 61 | + final String id; | |
| 62 | + final int indexUpdatedAt; | |
| 63 | + final String locale; | |
| 64 | + final Metadata metadata; | |
| 65 | + final String name; | |
| 66 | + final bool newBackend; | |
| 67 | + final int numberOfComments; | |
| 68 | + final int oid; | |
| 69 | + final Owner owner; | |
| 70 | + final String provenance; | |
| 71 | + final bool publicationAppendEnabled; | |
| 72 | + final int publicationDate; | |
| 73 | + final int publicationGroup; | |
| 74 | + final String publicationStage; | |
| 75 | + final Query query; | |
| 76 | + final List<String> rights; | |
| 77 | + final int rowsUpdatedAt; | |
| 78 | + final String rowsUpdatedBy; | |
| 79 | + final Owner tableAuthor; | |
| 80 | + final int tableId; | |
| 81 | + final List<String> tags; | |
| 82 | + final int totalTimesRated; | |
| 83 | + final int viewCount; | |
| 84 | + final int viewLastModified; | |
| 85 | + final String viewType; | |
| 86 | + | |
| 87 | + View({ | |
| 88 | + required this.attribution, | |
| 89 | + required this.attributionLink, | |
| 90 | + required this.averageRating, | |
| 91 | + required this.category, | |
| 92 | + required this.columns, | |
| 93 | + required this.createdAt, | |
| 94 | + required this.description, | |
| 95 | + required this.displayType, | |
| 96 | + required this.downloadCount, | |
| 97 | + required this.flags, | |
| 98 | + required this.grants, | |
| 99 | + required this.hideFromCatalog, | |
| 100 | + required this.hideFromDataJson, | |
| 101 | + required this.id, | |
| 102 | + required this.indexUpdatedAt, | |
| 103 | + required this.locale, | |
| 104 | + required this.metadata, | |
| 105 | + required this.name, | |
| 106 | + required this.newBackend, | |
| 107 | + required this.numberOfComments, | |
| 108 | + required this.oid, | |
| 109 | + required this.owner, | |
| 110 | + required this.provenance, | |
| 111 | + required this.publicationAppendEnabled, | |
| 112 | + required this.publicationDate, | |
| 113 | + required this.publicationGroup, | |
| 114 | + required this.publicationStage, | |
| 115 | + required this.query, | |
| 116 | + required this.rights, | |
| 117 | + required this.rowsUpdatedAt, | |
| 118 | + required this.rowsUpdatedBy, | |
| 119 | + required this.tableAuthor, | |
| 120 | + required this.tableId, | |
| 121 | + required this.tags, | |
| 122 | + required this.totalTimesRated, | |
| 123 | + required this.viewCount, | |
| 124 | + required this.viewLastModified, | |
| 125 | + required this.viewType, | |
| 126 | + }); | |
| 127 | + | |
| 128 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 129 | + attribution: json["attribution"], | |
| 130 | + attributionLink: json["attributionLink"], | |
| 131 | + averageRating: json["averageRating"], | |
| 132 | + category: json["category"], | |
| 133 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 134 | + createdAt: json["createdAt"], | |
| 135 | + description: json["description"], | |
| 136 | + displayType: json["displayType"], | |
| 137 | + downloadCount: json["downloadCount"], | |
| 138 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 139 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 140 | + hideFromCatalog: json["hideFromCatalog"], | |
| 141 | + hideFromDataJson: json["hideFromDataJson"], | |
| 142 | + id: json["id"], | |
| 143 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 144 | + locale: json["locale"], | |
| 145 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 146 | + name: json["name"], | |
| 147 | + newBackend: json["newBackend"], | |
| 148 | + numberOfComments: json["numberOfComments"], | |
| 149 | + oid: json["oid"], | |
| 150 | + owner: Owner.fromJson(json["owner"]), | |
| 151 | + provenance: json["provenance"], | |
| 152 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 153 | + publicationDate: json["publicationDate"], | |
| 154 | + publicationGroup: json["publicationGroup"], | |
| 155 | + publicationStage: json["publicationStage"], | |
| 156 | + query: Query.fromJson(json["query"]), | |
| 157 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 158 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 159 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 160 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 161 | + tableId: json["tableId"], | |
| 162 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 163 | + totalTimesRated: json["totalTimesRated"], | |
| 164 | + viewCount: json["viewCount"], | |
| 165 | + viewLastModified: json["viewLastModified"], | |
| 166 | + viewType: json["viewType"], | |
| 167 | + ); | |
| 168 | + | |
| 169 | + Map<String, dynamic> toJson() => { | |
| 170 | + "attribution": attribution, | |
| 171 | + "attributionLink": attributionLink, | |
| 172 | + "averageRating": averageRating, | |
| 173 | + "category": category, | |
| 174 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 175 | + "createdAt": createdAt, | |
| 176 | + "description": description, | |
| 177 | + "displayType": displayType, | |
| 178 | + "downloadCount": downloadCount, | |
| 179 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 180 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 181 | + "hideFromCatalog": hideFromCatalog, | |
| 182 | + "hideFromDataJson": hideFromDataJson, | |
| 183 | + "id": id, | |
| 184 | + "indexUpdatedAt": indexUpdatedAt, | |
| 185 | + "locale": locale, | |
| 186 | + "metadata": metadata.toJson(), | |
| 187 | + "name": name, | |
| 188 | + "newBackend": newBackend, | |
| 189 | + "numberOfComments": numberOfComments, | |
| 190 | + "oid": oid, | |
| 191 | + "owner": owner.toJson(), | |
| 192 | + "provenance": provenance, | |
| 193 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 194 | + "publicationDate": publicationDate, | |
| 195 | + "publicationGroup": publicationGroup, | |
| 196 | + "publicationStage": publicationStage, | |
| 197 | + "query": query.toJson(), | |
| 198 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 199 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 200 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 201 | + "tableAuthor": tableAuthor.toJson(), | |
| 202 | + "tableId": tableId, | |
| 203 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 204 | + "totalTimesRated": totalTimesRated, | |
| 205 | + "viewCount": viewCount, | |
| 206 | + "viewLastModified": viewLastModified, | |
| 207 | + "viewType": viewType, | |
| 208 | + }; | |
| 209 | +} | |
| 210 | + | |
| 211 | +class Column { | |
| 212 | + final CachedContents? cachedContents; | |
| 213 | + final TypeName dataTypeName; | |
| 214 | + final String fieldName; | |
| 215 | + final List<String>? flags; | |
| 216 | + final Format format; | |
| 217 | + final int id; | |
| 218 | + final String name; | |
| 219 | + final int position; | |
| 220 | + final TypeName renderTypeName; | |
| 221 | + final int? tableColumnId; | |
| 222 | + final int? width; | |
| 223 | + | |
| 224 | + Column({ | |
| 225 | + this.cachedContents, | |
| 226 | + required this.dataTypeName, | |
| 227 | + required this.fieldName, | |
| 228 | + this.flags, | |
| 229 | + required this.format, | |
| 230 | + required this.id, | |
| 231 | + required this.name, | |
| 232 | + required this.position, | |
| 233 | + required this.renderTypeName, | |
| 234 | + this.tableColumnId, | |
| 235 | + this.width, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 239 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 240 | + dataTypeName: typeNameValues.map[json["dataTypeName"]]!, | |
| 241 | + fieldName: json["fieldName"], | |
| 242 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 243 | + format: Format.fromJson(json["format"]), | |
| 244 | + id: json["id"], | |
| 245 | + name: json["name"], | |
| 246 | + position: json["position"], | |
| 247 | + renderTypeName: typeNameValues.map[json["renderTypeName"]]!, | |
| 248 | + tableColumnId: json["tableColumnId"], | |
| 249 | + width: json["width"], | |
| 250 | + ); | |
| 251 | + | |
| 252 | + Map<String, dynamic> toJson() => { | |
| 253 | + "cachedContents": cachedContents?.toJson(), | |
| 254 | + "dataTypeName": typeNameValues.reverse[dataTypeName], | |
| 255 | + "fieldName": fieldName, | |
| 256 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 257 | + "format": format.toJson(), | |
| 258 | + "id": id, | |
| 259 | + "name": name, | |
| 260 | + "position": position, | |
| 261 | + "renderTypeName": typeNameValues.reverse[renderTypeName], | |
| 262 | + "tableColumnId": tableColumnId, | |
| 263 | + "width": width, | |
| 264 | + }; | |
| 265 | +} | |
| 266 | + | |
| 267 | +class CachedContents { | |
| 268 | + final int cachedContentsNull; | |
| 269 | + final String largest; | |
| 270 | + final int nonNull; | |
| 271 | + final String smallest; | |
| 272 | + final List<Top> top; | |
| 273 | + | |
| 274 | + CachedContents({ | |
| 275 | + required this.cachedContentsNull, | |
| 276 | + required this.largest, | |
| 277 | + required this.nonNull, | |
| 278 | + required this.smallest, | |
| 279 | + required this.top, | |
| 280 | + }); | |
| 281 | + | |
| 282 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 283 | + cachedContentsNull: json["null"], | |
| 284 | + largest: json["largest"], | |
| 285 | + nonNull: json["non_null"], | |
| 286 | + smallest: json["smallest"], | |
| 287 | + top: List<Top>.from(json["top"].map((x) => Top.fromJson(x))), | |
| 288 | + ); | |
| 289 | + | |
| 290 | + Map<String, dynamic> toJson() => { | |
| 291 | + "null": cachedContentsNull, | |
| 292 | + "largest": largest, | |
| 293 | + "non_null": nonNull, | |
| 294 | + "smallest": smallest, | |
| 295 | + "top": List<dynamic>.from(top.map((x) => x.toJson())), | |
| 296 | + }; | |
| 297 | +} | |
| 298 | + | |
| 299 | +class Top { | |
| 300 | + final int count; | |
| 301 | + final String item; | |
| 302 | + | |
| 303 | + Top({ | |
| 304 | + required this.count, | |
| 305 | + required this.item, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 309 | + count: json["count"], | |
| 310 | + item: json["item"], | |
| 311 | + ); | |
| 312 | + | |
| 313 | + Map<String, dynamic> toJson() => { | |
| 314 | + "count": count, | |
| 315 | + "item": item, | |
| 316 | + }; | |
| 317 | +} | |
| 318 | + | |
| 319 | +enum TypeName { | |
| 320 | + META_DATA, | |
| 321 | + CALENDAR_DATE, | |
| 322 | + TEXT | |
| 323 | +} | |
| 324 | + | |
| 325 | +final typeNameValues = EnumValues({ | |
| 326 | + "meta_data": TypeName.META_DATA, | |
| 327 | + "calendar_date": TypeName.CALENDAR_DATE, | |
| 328 | + "text": TypeName.TEXT | |
| 329 | +}); | |
| 330 | + | |
| 331 | +class Format { | |
| 332 | + final String? align; | |
| 333 | + final String? view; | |
| 334 | + | |
| 335 | + Format({ | |
| 336 | + this.align, | |
| 337 | + this.view, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Format.fromJson(Map<String, dynamic> json) => Format( | |
| 341 | + align: json["align"], | |
| 342 | + view: json["view"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "align": align, | |
| 347 | + "view": view, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +class Grant { | |
| 352 | + final List<String> flags; | |
| 353 | + final bool inherited; | |
| 354 | + final String type; | |
| 355 | + | |
| 356 | + Grant({ | |
| 357 | + required this.flags, | |
| 358 | + required this.inherited, | |
| 359 | + required this.type, | |
| 360 | + }); | |
| 361 | + | |
| 362 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 363 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 364 | + inherited: json["inherited"], | |
| 365 | + type: json["type"], | |
| 366 | + ); | |
| 367 | + | |
| 368 | + Map<String, dynamic> toJson() => { | |
| 369 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 370 | + "inherited": inherited, | |
| 371 | + "type": type, | |
| 372 | + }; | |
| 373 | +} | |
| 374 | + | |
| 375 | +class Metadata { | |
| 376 | + final List<Attachment> attachments; | |
| 377 | + final List<String> availableDisplayTypes; | |
| 378 | + final CustomFields customFields; | |
| 379 | + final JsonQuery jsonQuery; | |
| 380 | + final String rdfSubject; | |
| 381 | + final RenderTypeConfig renderTypeConfig; | |
| 382 | + | |
| 383 | + Metadata({ | |
| 384 | + required this.attachments, | |
| 385 | + required this.availableDisplayTypes, | |
| 386 | + required this.customFields, | |
| 387 | + required this.jsonQuery, | |
| 388 | + required this.rdfSubject, | |
| 389 | + required this.renderTypeConfig, | |
| 390 | + }); | |
| 391 | + | |
| 392 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 393 | + attachments: List<Attachment>.from(json["attachments"].map((x) => Attachment.fromJson(x))), | |
| 394 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 395 | + customFields: CustomFields.fromJson(json["custom_fields"]), | |
| 396 | + jsonQuery: JsonQuery.fromJson(json["jsonQuery"]), | |
| 397 | + rdfSubject: json["rdfSubject"], | |
| 398 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 399 | + ); | |
| 400 | + | |
| 401 | + Map<String, dynamic> toJson() => { | |
| 402 | + "attachments": List<dynamic>.from(attachments.map((x) => x.toJson())), | |
| 403 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 404 | + "custom_fields": customFields.toJson(), | |
| 405 | + "jsonQuery": jsonQuery.toJson(), | |
| 406 | + "rdfSubject": rdfSubject, | |
| 407 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 408 | + }; | |
| 409 | +} | |
| 410 | + | |
| 411 | +class Attachment { | |
| 412 | + final String assetId; | |
| 413 | + final String blobId; | |
| 414 | + final String filename; | |
| 415 | + final String name; | |
| 416 | + | |
| 417 | + Attachment({ | |
| 418 | + required this.assetId, | |
| 419 | + required this.blobId, | |
| 420 | + required this.filename, | |
| 421 | + required this.name, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory Attachment.fromJson(Map<String, dynamic> json) => Attachment( | |
| 425 | + assetId: json["assetId"], | |
| 426 | + blobId: json["blobId"], | |
| 427 | + filename: json["filename"], | |
| 428 | + name: json["name"], | |
| 429 | + ); | |
| 430 | + | |
| 431 | + Map<String, dynamic> toJson() => { | |
| 432 | + "assetId": assetId, | |
| 433 | + "blobId": blobId, | |
| 434 | + "filename": filename, | |
| 435 | + "name": name, | |
| 436 | + }; | |
| 437 | +} | |
| 438 | + | |
| 439 | +class CustomFields { | |
| 440 | + final AdditionalResources additionalResources; | |
| 441 | + final CommonCore commonCore; | |
| 442 | + final DatasetInformation datasetInformation; | |
| 443 | + final DatasetSummary datasetSummary; | |
| 444 | + final Notes notes; | |
| 445 | + | |
| 446 | + CustomFields({ | |
| 447 | + required this.additionalResources, | |
| 448 | + required this.commonCore, | |
| 449 | + required this.datasetInformation, | |
| 450 | + required this.datasetSummary, | |
| 451 | + required this.notes, | |
| 452 | + }); | |
| 453 | + | |
| 454 | + factory CustomFields.fromJson(Map<String, dynamic> json) => CustomFields( | |
| 455 | + additionalResources: AdditionalResources.fromJson(json["Additional Resources"]), | |
| 456 | + commonCore: CommonCore.fromJson(json["Common Core"]), | |
| 457 | + datasetInformation: DatasetInformation.fromJson(json["Dataset Information"]), | |
| 458 | + datasetSummary: DatasetSummary.fromJson(json["Dataset Summary"]), | |
| 459 | + notes: Notes.fromJson(json["Notes"]), | |
| 460 | + ); | |
| 461 | + | |
| 462 | + Map<String, dynamic> toJson() => { | |
| 463 | + "Additional Resources": additionalResources.toJson(), | |
| 464 | + "Common Core": commonCore.toJson(), | |
| 465 | + "Dataset Information": datasetInformation.toJson(), | |
| 466 | + "Dataset Summary": datasetSummary.toJson(), | |
| 467 | + "Notes": notes.toJson(), | |
| 468 | + }; | |
| 469 | +} | |
| 470 | + | |
| 471 | +class AdditionalResources { | |
| 472 | + final String additionalResourcesSeeAlso; | |
| 473 | + final String seeAlso; | |
| 474 | + | |
| 475 | + AdditionalResources({ | |
| 476 | + required this.additionalResourcesSeeAlso, | |
| 477 | + required this.seeAlso, | |
| 478 | + }); | |
| 479 | + | |
| 480 | + factory AdditionalResources.fromJson(Map<String, dynamic> json) => AdditionalResources( | |
| 481 | + additionalResourcesSeeAlso: json["See Also "], | |
| 482 | + seeAlso: json["See Also"], | |
| 483 | + ); | |
| 484 | + | |
| 485 | + Map<String, dynamic> toJson() => { | |
| 486 | + "See Also ": additionalResourcesSeeAlso, | |
| 487 | + "See Also": seeAlso, | |
| 488 | + }; | |
| 489 | +} | |
| 490 | + | |
| 491 | +class CommonCore { | |
| 492 | + final String contactEmail; | |
| 493 | + final String contactName; | |
| 494 | + final String publisher; | |
| 495 | + | |
| 496 | + CommonCore({ | |
| 497 | + required this.contactEmail, | |
| 498 | + required this.contactName, | |
| 499 | + required this.publisher, | |
| 500 | + }); | |
| 501 | + | |
| 502 | + factory CommonCore.fromJson(Map<String, dynamic> json) => CommonCore( | |
| 503 | + contactEmail: json["Contact Email"], | |
| 504 | + contactName: json["Contact Name"], | |
| 505 | + publisher: json["Publisher"], | |
| 506 | + ); | |
| 507 | + | |
| 508 | + Map<String, dynamic> toJson() => { | |
| 509 | + "Contact Email": contactEmail, | |
| 510 | + "Contact Name": contactName, | |
| 511 | + "Publisher": publisher, | |
| 512 | + }; | |
| 513 | +} | |
| 514 | + | |
| 515 | +class DatasetInformation { | |
| 516 | + final String agency; | |
| 517 | + | |
| 518 | + DatasetInformation({ | |
| 519 | + required this.agency, | |
| 520 | + }); | |
| 521 | + | |
| 522 | + factory DatasetInformation.fromJson(Map<String, dynamic> json) => DatasetInformation( | |
| 523 | + agency: json["Agency"], | |
| 524 | + ); | |
| 525 | + | |
| 526 | + Map<String, dynamic> toJson() => { | |
| 527 | + "Agency": agency, | |
| 528 | + }; | |
| 529 | +} | |
| 530 | + | |
| 531 | +class DatasetSummary { | |
| 532 | + final String contactInformation; | |
| 533 | + final String coverage; | |
| 534 | + final String dataFrequency; | |
| 535 | + final String datasetOwner; | |
| 536 | + final String granularity; | |
| 537 | + final String organization; | |
| 538 | + final String postingFrequency; | |
| 539 | + final String timePeriod; | |
| 540 | + final String units; | |
| 541 | + | |
| 542 | + DatasetSummary({ | |
| 543 | + required this.contactInformation, | |
| 544 | + required this.coverage, | |
| 545 | + required this.dataFrequency, | |
| 546 | + required this.datasetOwner, | |
| 547 | + required this.granularity, | |
| 548 | + required this.organization, | |
| 549 | + required this.postingFrequency, | |
| 550 | + required this.timePeriod, | |
| 551 | + required this.units, | |
| 552 | + }); | |
| 553 | + | |
| 554 | + factory DatasetSummary.fromJson(Map<String, dynamic> json) => DatasetSummary( | |
| 555 | + contactInformation: json["Contact Information"], | |
| 556 | + coverage: json["Coverage"], | |
| 557 | + dataFrequency: json["Data Frequency"], | |
| 558 | + datasetOwner: json["Dataset Owner"], | |
| 559 | + granularity: json["Granularity"], | |
| 560 | + organization: json["Organization"], | |
| 561 | + postingFrequency: json["Posting Frequency"], | |
| 562 | + timePeriod: json["Time Period"], | |
| 563 | + units: json["Units"], | |
| 564 | + ); | |
| 565 | + | |
| 566 | + Map<String, dynamic> toJson() => { | |
| 567 | + "Contact Information": contactInformation, | |
| 568 | + "Coverage": coverage, | |
| 569 | + "Data Frequency": dataFrequency, | |
| 570 | + "Dataset Owner": datasetOwner, | |
| 571 | + "Granularity": granularity, | |
| 572 | + "Organization": organization, | |
| 573 | + "Posting Frequency": postingFrequency, | |
| 574 | + "Time Period": timePeriod, | |
| 575 | + "Units": units, | |
| 576 | + }; | |
| 577 | +} | |
| 578 | + | |
| 579 | +class Notes { | |
| 580 | + final String notes; | |
| 581 | + | |
| 582 | + Notes({ | |
| 583 | + required this.notes, | |
| 584 | + }); | |
| 585 | + | |
| 586 | + factory Notes.fromJson(Map<String, dynamic> json) => Notes( | |
| 587 | + notes: json["Notes"], | |
| 588 | + ); | |
| 589 | + | |
| 590 | + Map<String, dynamic> toJson() => { | |
| 591 | + "Notes": notes, | |
| 592 | + }; | |
| 593 | +} | |
| 594 | + | |
| 595 | +class JsonQuery { | |
| 596 | + final List<Order> order; | |
| 597 | + | |
| 598 | + JsonQuery({ | |
| 599 | + required this.order, | |
| 600 | + }); | |
| 601 | + | |
| 602 | + factory JsonQuery.fromJson(Map<String, dynamic> json) => JsonQuery( | |
| 603 | + order: List<Order>.from(json["order"].map((x) => Order.fromJson(x))), | |
| 604 | + ); | |
| 605 | + | |
| 606 | + Map<String, dynamic> toJson() => { | |
| 607 | + "order": List<dynamic>.from(order.map((x) => x.toJson())), | |
| 608 | + }; | |
| 609 | +} | |
| 610 | + | |
| 611 | +class Order { | |
| 612 | + final bool ascending; | |
| 613 | + final String columnFieldName; | |
| 614 | + | |
| 615 | + Order({ | |
| 616 | + required this.ascending, | |
| 617 | + required this.columnFieldName, | |
| 618 | + }); | |
| 619 | + | |
| 620 | + factory Order.fromJson(Map<String, dynamic> json) => Order( | |
| 621 | + ascending: json["ascending"], | |
| 622 | + columnFieldName: json["columnFieldName"], | |
| 623 | + ); | |
| 624 | + | |
| 625 | + Map<String, dynamic> toJson() => { | |
| 626 | + "ascending": ascending, | |
| 627 | + "columnFieldName": columnFieldName, | |
| 628 | + }; | |
| 629 | +} | |
| 630 | + | |
| 631 | +class RenderTypeConfig { | |
| 632 | + final Visible visible; | |
| 633 | + | |
| 634 | + RenderTypeConfig({ | |
| 635 | + required this.visible, | |
| 636 | + }); | |
| 637 | + | |
| 638 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 639 | + visible: Visible.fromJson(json["visible"]), | |
| 640 | + ); | |
| 641 | + | |
| 642 | + Map<String, dynamic> toJson() => { | |
| 643 | + "visible": visible.toJson(), | |
| 644 | + }; | |
| 645 | +} | |
| 646 | + | |
| 647 | +class Visible { | |
| 648 | + final bool table; | |
| 649 | + | |
| 650 | + Visible({ | |
| 651 | + required this.table, | |
| 652 | + }); | |
| 653 | + | |
| 654 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 655 | + table: json["table"], | |
| 656 | + ); | |
| 657 | + | |
| 658 | + Map<String, dynamic> toJson() => { | |
| 659 | + "table": table, | |
| 660 | + }; | |
| 661 | +} | |
| 662 | + | |
| 663 | +class Owner { | |
| 664 | + final String displayName; | |
| 665 | + final String id; | |
| 666 | + final String profileImageUrlLarge; | |
| 667 | + final String profileImageUrlMedium; | |
| 668 | + final String profileImageUrlSmall; | |
| 669 | + final List<String> rights; | |
| 670 | + final String roleName; | |
| 671 | + final String screenName; | |
| 672 | + | |
| 673 | + Owner({ | |
| 674 | + required this.displayName, | |
| 675 | + required this.id, | |
| 676 | + required this.profileImageUrlLarge, | |
| 677 | + required this.profileImageUrlMedium, | |
| 678 | + required this.profileImageUrlSmall, | |
| 679 | + required this.rights, | |
| 680 | + required this.roleName, | |
| 681 | + required this.screenName, | |
| 682 | + }); | |
| 683 | + | |
| 684 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 685 | + displayName: json["displayName"], | |
| 686 | + id: json["id"], | |
| 687 | + profileImageUrlLarge: json["profileImageUrlLarge"], | |
| 688 | + profileImageUrlMedium: json["profileImageUrlMedium"], | |
| 689 | + profileImageUrlSmall: json["profileImageUrlSmall"], | |
| 690 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 691 | + roleName: json["roleName"], | |
| 692 | + screenName: json["screenName"], | |
| 693 | + ); | |
| 694 | + | |
| 695 | + Map<String, dynamic> toJson() => { | |
| 696 | + "displayName": displayName, | |
| 697 | + "id": id, | |
| 698 | + "profileImageUrlLarge": profileImageUrlLarge, | |
| 699 | + "profileImageUrlMedium": profileImageUrlMedium, | |
| 700 | + "profileImageUrlSmall": profileImageUrlSmall, | |
| 701 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 702 | + "roleName": roleName, | |
| 703 | + "screenName": screenName, | |
| 704 | + }; | |
| 705 | +} | |
| 706 | + | |
| 707 | +class Query { | |
| 708 | + final List<OrderBy> orderBys; | |
| 709 | + | |
| 710 | + Query({ | |
| 711 | + required this.orderBys, | |
| 712 | + }); | |
| 713 | + | |
| 714 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 715 | + orderBys: List<OrderBy>.from(json["orderBys"].map((x) => OrderBy.fromJson(x))), | |
| 716 | + ); | |
| 717 | + | |
| 718 | + Map<String, dynamic> toJson() => { | |
| 719 | + "orderBys": List<dynamic>.from(orderBys.map((x) => x.toJson())), | |
| 720 | + }; | |
| 721 | +} | |
| 722 | + | |
| 723 | +class OrderBy { | |
| 724 | + final bool ascending; | |
| 725 | + final Expression expression; | |
| 726 | + | |
| 727 | + OrderBy({ | |
| 728 | + required this.ascending, | |
| 729 | + required this.expression, | |
| 730 | + }); | |
| 731 | + | |
| 732 | + factory OrderBy.fromJson(Map<String, dynamic> json) => OrderBy( | |
| 733 | + ascending: json["ascending"], | |
| 734 | + expression: Expression.fromJson(json["expression"]), | |
| 735 | + ); | |
| 736 | + | |
| 737 | + Map<String, dynamic> toJson() => { | |
| 738 | + "ascending": ascending, | |
| 739 | + "expression": expression.toJson(), | |
| 740 | + }; | |
| 741 | +} | |
| 742 | + | |
| 743 | +class Expression { | |
| 744 | + final int columnId; | |
| 745 | + final String type; | |
| 746 | + | |
| 747 | + Expression({ | |
| 748 | + required this.columnId, | |
| 749 | + required this.type, | |
| 750 | + }); | |
| 751 | + | |
| 752 | + factory Expression.fromJson(Map<String, dynamic> json) => Expression( | |
| 753 | + columnId: json["columnId"], | |
| 754 | + type: json["type"], | |
| 755 | + ); | |
| 756 | + | |
| 757 | + Map<String, dynamic> toJson() => { | |
| 758 | + "columnId": columnId, | |
| 759 | + "type": type, | |
| 760 | + }; | |
| 761 | +} | |
| 762 | + | |
| 763 | +class EnumValues<T> { | |
| 764 | + Map<String, T> map; | |
| 765 | + late Map<T, String> reverseMap; | |
| 766 | + | |
| 767 | + EnumValues(this.map); | |
| 768 | + | |
| 769 | + Map<T, String> get reverse { | |
| 770 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 771 | + return reverseMap; | |
| 772 | + } | |
| 773 | +} |
Test case
1 generated file · +769 −0test/inputs/json/misc/617e8.json
Adartdefault / TopLevel.dart+769 −0
| @@ -0,0 +1,769 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final String attribution; | |
| 49 | + final String attributionLink; | |
| 50 | + final int averageRating; | |
| 51 | + final String category; | |
| 52 | + final List<Column> columns; | |
| 53 | + final int createdAt; | |
| 54 | + final String description; | |
| 55 | + final String displayType; | |
| 56 | + final int downloadCount; | |
| 57 | + final List<String> flags; | |
| 58 | + final List<Grant> grants; | |
| 59 | + final bool hideFromCatalog; | |
| 60 | + final bool hideFromDataJson; | |
| 61 | + final String id; | |
| 62 | + final int indexUpdatedAt; | |
| 63 | + final String locale; | |
| 64 | + final Metadata metadata; | |
| 65 | + final String name; | |
| 66 | + final bool newBackend; | |
| 67 | + final int numberOfComments; | |
| 68 | + final int oid; | |
| 69 | + final Owner owner; | |
| 70 | + final String provenance; | |
| 71 | + final bool publicationAppendEnabled; | |
| 72 | + final int publicationDate; | |
| 73 | + final int publicationGroup; | |
| 74 | + final String publicationStage; | |
| 75 | + final Query query; | |
| 76 | + final List<String> rights; | |
| 77 | + final int rowsUpdatedAt; | |
| 78 | + final String rowsUpdatedBy; | |
| 79 | + final Owner tableAuthor; | |
| 80 | + final int tableId; | |
| 81 | + final List<String> tags; | |
| 82 | + final int totalTimesRated; | |
| 83 | + final int viewCount; | |
| 84 | + final int viewLastModified; | |
| 85 | + final String viewType; | |
| 86 | + | |
| 87 | + View({ | |
| 88 | + required this.attribution, | |
| 89 | + required this.attributionLink, | |
| 90 | + required this.averageRating, | |
| 91 | + required this.category, | |
| 92 | + required this.columns, | |
| 93 | + required this.createdAt, | |
| 94 | + required this.description, | |
| 95 | + required this.displayType, | |
| 96 | + required this.downloadCount, | |
| 97 | + required this.flags, | |
| 98 | + required this.grants, | |
| 99 | + required this.hideFromCatalog, | |
| 100 | + required this.hideFromDataJson, | |
| 101 | + required this.id, | |
| 102 | + required this.indexUpdatedAt, | |
| 103 | + required this.locale, | |
| 104 | + required this.metadata, | |
| 105 | + required this.name, | |
| 106 | + required this.newBackend, | |
| 107 | + required this.numberOfComments, | |
| 108 | + required this.oid, | |
| 109 | + required this.owner, | |
| 110 | + required this.provenance, | |
| 111 | + required this.publicationAppendEnabled, | |
| 112 | + required this.publicationDate, | |
| 113 | + required this.publicationGroup, | |
| 114 | + required this.publicationStage, | |
| 115 | + required this.query, | |
| 116 | + required this.rights, | |
| 117 | + required this.rowsUpdatedAt, | |
| 118 | + required this.rowsUpdatedBy, | |
| 119 | + required this.tableAuthor, | |
| 120 | + required this.tableId, | |
| 121 | + required this.tags, | |
| 122 | + required this.totalTimesRated, | |
| 123 | + required this.viewCount, | |
| 124 | + required this.viewLastModified, | |
| 125 | + required this.viewType, | |
| 126 | + }); | |
| 127 | + | |
| 128 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 129 | + attribution: json["attribution"], | |
| 130 | + attributionLink: json["attributionLink"], | |
| 131 | + averageRating: json["averageRating"], | |
| 132 | + category: json["category"], | |
| 133 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 134 | + createdAt: json["createdAt"], | |
| 135 | + description: json["description"], | |
| 136 | + displayType: json["displayType"], | |
| 137 | + downloadCount: json["downloadCount"], | |
| 138 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 139 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 140 | + hideFromCatalog: json["hideFromCatalog"], | |
| 141 | + hideFromDataJson: json["hideFromDataJson"], | |
| 142 | + id: json["id"], | |
| 143 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 144 | + locale: json["locale"], | |
| 145 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 146 | + name: json["name"], | |
| 147 | + newBackend: json["newBackend"], | |
| 148 | + numberOfComments: json["numberOfComments"], | |
| 149 | + oid: json["oid"], | |
| 150 | + owner: Owner.fromJson(json["owner"]), | |
| 151 | + provenance: json["provenance"], | |
| 152 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 153 | + publicationDate: json["publicationDate"], | |
| 154 | + publicationGroup: json["publicationGroup"], | |
| 155 | + publicationStage: json["publicationStage"], | |
| 156 | + query: Query.fromJson(json["query"]), | |
| 157 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 158 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 159 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 160 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 161 | + tableId: json["tableId"], | |
| 162 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 163 | + totalTimesRated: json["totalTimesRated"], | |
| 164 | + viewCount: json["viewCount"], | |
| 165 | + viewLastModified: json["viewLastModified"], | |
| 166 | + viewType: json["viewType"], | |
| 167 | + ); | |
| 168 | + | |
| 169 | + Map<String, dynamic> toJson() => { | |
| 170 | + "attribution": attribution, | |
| 171 | + "attributionLink": attributionLink, | |
| 172 | + "averageRating": averageRating, | |
| 173 | + "category": category, | |
| 174 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 175 | + "createdAt": createdAt, | |
| 176 | + "description": description, | |
| 177 | + "displayType": displayType, | |
| 178 | + "downloadCount": downloadCount, | |
| 179 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 180 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 181 | + "hideFromCatalog": hideFromCatalog, | |
| 182 | + "hideFromDataJson": hideFromDataJson, | |
| 183 | + "id": id, | |
| 184 | + "indexUpdatedAt": indexUpdatedAt, | |
| 185 | + "locale": locale, | |
| 186 | + "metadata": metadata.toJson(), | |
| 187 | + "name": name, | |
| 188 | + "newBackend": newBackend, | |
| 189 | + "numberOfComments": numberOfComments, | |
| 190 | + "oid": oid, | |
| 191 | + "owner": owner.toJson(), | |
| 192 | + "provenance": provenance, | |
| 193 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 194 | + "publicationDate": publicationDate, | |
| 195 | + "publicationGroup": publicationGroup, | |
| 196 | + "publicationStage": publicationStage, | |
| 197 | + "query": query.toJson(), | |
| 198 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 199 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 200 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 201 | + "tableAuthor": tableAuthor.toJson(), | |
| 202 | + "tableId": tableId, | |
| 203 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 204 | + "totalTimesRated": totalTimesRated, | |
| 205 | + "viewCount": viewCount, | |
| 206 | + "viewLastModified": viewLastModified, | |
| 207 | + "viewType": viewType, | |
| 208 | + }; | |
| 209 | +} | |
| 210 | + | |
| 211 | +class Column { | |
| 212 | + final CachedContents? cachedContents; | |
| 213 | + final TypeName dataTypeName; | |
| 214 | + final String? description; | |
| 215 | + final String fieldName; | |
| 216 | + final List<String>? flags; | |
| 217 | + final Format format; | |
| 218 | + final int id; | |
| 219 | + final String name; | |
| 220 | + final int position; | |
| 221 | + final TypeName renderTypeName; | |
| 222 | + final int? tableColumnId; | |
| 223 | + final int? width; | |
| 224 | + | |
| 225 | + Column({ | |
| 226 | + this.cachedContents, | |
| 227 | + required this.dataTypeName, | |
| 228 | + this.description, | |
| 229 | + required this.fieldName, | |
| 230 | + this.flags, | |
| 231 | + required this.format, | |
| 232 | + required this.id, | |
| 233 | + required this.name, | |
| 234 | + required this.position, | |
| 235 | + required this.renderTypeName, | |
| 236 | + this.tableColumnId, | |
| 237 | + this.width, | |
| 238 | + }); | |
| 239 | + | |
| 240 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 241 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 242 | + dataTypeName: typeNameValues.map[json["dataTypeName"]]!, | |
| 243 | + description: json["description"], | |
| 244 | + fieldName: json["fieldName"], | |
| 245 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 246 | + format: Format.fromJson(json["format"]), | |
| 247 | + id: json["id"], | |
| 248 | + name: json["name"], | |
| 249 | + position: json["position"], | |
| 250 | + renderTypeName: typeNameValues.map[json["renderTypeName"]]!, | |
| 251 | + tableColumnId: json["tableColumnId"], | |
| 252 | + width: json["width"], | |
| 253 | + ); | |
| 254 | + | |
| 255 | + Map<String, dynamic> toJson() => { | |
| 256 | + "cachedContents": cachedContents?.toJson(), | |
| 257 | + "dataTypeName": typeNameValues.reverse[dataTypeName], | |
| 258 | + "description": description, | |
| 259 | + "fieldName": fieldName, | |
| 260 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 261 | + "format": format.toJson(), | |
| 262 | + "id": id, | |
| 263 | + "name": name, | |
| 264 | + "position": position, | |
| 265 | + "renderTypeName": typeNameValues.reverse[renderTypeName], | |
| 266 | + "tableColumnId": tableColumnId, | |
| 267 | + "width": width, | |
| 268 | + }; | |
| 269 | +} | |
| 270 | + | |
| 271 | +class CachedContents { | |
| 272 | + final int cachedContentsNull; | |
| 273 | + final String largest; | |
| 274 | + final int nonNull; | |
| 275 | + final String smallest; | |
| 276 | + final List<Top> top; | |
| 277 | + | |
| 278 | + CachedContents({ | |
| 279 | + required this.cachedContentsNull, | |
| 280 | + required this.largest, | |
| 281 | + required this.nonNull, | |
| 282 | + required this.smallest, | |
| 283 | + required this.top, | |
| 284 | + }); | |
| 285 | + | |
| 286 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 287 | + cachedContentsNull: json["null"], | |
| 288 | + largest: json["largest"], | |
| 289 | + nonNull: json["non_null"], | |
| 290 | + smallest: json["smallest"], | |
| 291 | + top: List<Top>.from(json["top"].map((x) => Top.fromJson(x))), | |
| 292 | + ); | |
| 293 | + | |
| 294 | + Map<String, dynamic> toJson() => { | |
| 295 | + "null": cachedContentsNull, | |
| 296 | + "largest": largest, | |
| 297 | + "non_null": nonNull, | |
| 298 | + "smallest": smallest, | |
| 299 | + "top": List<dynamic>.from(top.map((x) => x.toJson())), | |
| 300 | + }; | |
| 301 | +} | |
| 302 | + | |
| 303 | +class Top { | |
| 304 | + final int count; | |
| 305 | + final String item; | |
| 306 | + | |
| 307 | + Top({ | |
| 308 | + required this.count, | |
| 309 | + required this.item, | |
| 310 | + }); | |
| 311 | + | |
| 312 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 313 | + count: json["count"], | |
| 314 | + item: json["item"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "count": count, | |
| 319 | + "item": item, | |
| 320 | + }; | |
| 321 | +} | |
| 322 | + | |
| 323 | +enum TypeName { | |
| 324 | + META_DATA, | |
| 325 | + CALENDAR_DATE, | |
| 326 | + TEXT | |
| 327 | +} | |
| 328 | + | |
| 329 | +final typeNameValues = EnumValues({ | |
| 330 | + "meta_data": TypeName.META_DATA, | |
| 331 | + "calendar_date": TypeName.CALENDAR_DATE, | |
| 332 | + "text": TypeName.TEXT | |
| 333 | +}); | |
| 334 | + | |
| 335 | +class Format { | |
| 336 | + final String? align; | |
| 337 | + final String? view; | |
| 338 | + | |
| 339 | + Format({ | |
| 340 | + this.align, | |
| 341 | + this.view, | |
| 342 | + }); | |
| 343 | + | |
| 344 | + factory Format.fromJson(Map<String, dynamic> json) => Format( | |
| 345 | + align: json["align"], | |
| 346 | + view: json["view"], | |
| 347 | + ); | |
| 348 | + | |
| 349 | + Map<String, dynamic> toJson() => { | |
| 350 | + "align": align, | |
| 351 | + "view": view, | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +class Grant { | |
| 356 | + final List<String> flags; | |
| 357 | + final bool inherited; | |
| 358 | + final String type; | |
| 359 | + | |
| 360 | + Grant({ | |
| 361 | + required this.flags, | |
| 362 | + required this.inherited, | |
| 363 | + required this.type, | |
| 364 | + }); | |
| 365 | + | |
| 366 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 367 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 368 | + inherited: json["inherited"], | |
| 369 | + type: json["type"], | |
| 370 | + ); | |
| 371 | + | |
| 372 | + Map<String, dynamic> toJson() => { | |
| 373 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 374 | + "inherited": inherited, | |
| 375 | + "type": type, | |
| 376 | + }; | |
| 377 | +} | |
| 378 | + | |
| 379 | +class Metadata { | |
| 380 | + final List<Attachment> attachments; | |
| 381 | + final List<String> availableDisplayTypes; | |
| 382 | + final CustomFields customFields; | |
| 383 | + final JsonQuery jsonQuery; | |
| 384 | + final String rdfSubject; | |
| 385 | + final RenderTypeConfig renderTypeConfig; | |
| 386 | + | |
| 387 | + Metadata({ | |
| 388 | + required this.attachments, | |
| 389 | + required this.availableDisplayTypes, | |
| 390 | + required this.customFields, | |
| 391 | + required this.jsonQuery, | |
| 392 | + required this.rdfSubject, | |
| 393 | + required this.renderTypeConfig, | |
| 394 | + }); | |
| 395 | + | |
| 396 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 397 | + attachments: List<Attachment>.from(json["attachments"].map((x) => Attachment.fromJson(x))), | |
| 398 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 399 | + customFields: CustomFields.fromJson(json["custom_fields"]), | |
| 400 | + jsonQuery: JsonQuery.fromJson(json["jsonQuery"]), | |
| 401 | + rdfSubject: json["rdfSubject"], | |
| 402 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 403 | + ); | |
| 404 | + | |
| 405 | + Map<String, dynamic> toJson() => { | |
| 406 | + "attachments": List<dynamic>.from(attachments.map((x) => x.toJson())), | |
| 407 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 408 | + "custom_fields": customFields.toJson(), | |
| 409 | + "jsonQuery": jsonQuery.toJson(), | |
| 410 | + "rdfSubject": rdfSubject, | |
| 411 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 412 | + }; | |
| 413 | +} | |
| 414 | + | |
| 415 | +class Attachment { | |
| 416 | + final String assetId; | |
| 417 | + final String blobId; | |
| 418 | + final String filename; | |
| 419 | + final String name; | |
| 420 | + | |
| 421 | + Attachment({ | |
| 422 | + required this.assetId, | |
| 423 | + required this.blobId, | |
| 424 | + required this.filename, | |
| 425 | + required this.name, | |
| 426 | + }); | |
| 427 | + | |
| 428 | + factory Attachment.fromJson(Map<String, dynamic> json) => Attachment( | |
| 429 | + assetId: json["assetId"], | |
| 430 | + blobId: json["blobId"], | |
| 431 | + filename: json["filename"], | |
| 432 | + name: json["name"], | |
| 433 | + ); | |
| 434 | + | |
| 435 | + Map<String, dynamic> toJson() => { | |
| 436 | + "assetId": assetId, | |
| 437 | + "blobId": blobId, | |
| 438 | + "filename": filename, | |
| 439 | + "name": name, | |
| 440 | + }; | |
| 441 | +} | |
| 442 | + | |
| 443 | +class CustomFields { | |
| 444 | + final AdditionalResources additionalResources; | |
| 445 | + final CommonCore commonCore; | |
| 446 | + final DatasetInformation datasetInformation; | |
| 447 | + final DatasetSummary datasetSummary; | |
| 448 | + final Notes notes; | |
| 449 | + | |
| 450 | + CustomFields({ | |
| 451 | + required this.additionalResources, | |
| 452 | + required this.commonCore, | |
| 453 | + required this.datasetInformation, | |
| 454 | + required this.datasetSummary, | |
| 455 | + required this.notes, | |
| 456 | + }); | |
| 457 | + | |
| 458 | + factory CustomFields.fromJson(Map<String, dynamic> json) => CustomFields( | |
| 459 | + additionalResources: AdditionalResources.fromJson(json["Additional Resources"]), | |
| 460 | + commonCore: CommonCore.fromJson(json["Common Core"]), | |
| 461 | + datasetInformation: DatasetInformation.fromJson(json["Dataset Information"]), | |
| 462 | + datasetSummary: DatasetSummary.fromJson(json["Dataset Summary"]), | |
| 463 | + notes: Notes.fromJson(json["Notes"]), | |
| 464 | + ); | |
| 465 | + | |
| 466 | + Map<String, dynamic> toJson() => { | |
| 467 | + "Additional Resources": additionalResources.toJson(), | |
| 468 | + "Common Core": commonCore.toJson(), | |
| 469 | + "Dataset Information": datasetInformation.toJson(), | |
| 470 | + "Dataset Summary": datasetSummary.toJson(), | |
| 471 | + "Notes": notes.toJson(), | |
| 472 | + }; | |
| 473 | +} | |
| 474 | + | |
| 475 | +class AdditionalResources { | |
| 476 | + final String seeAlso; | |
| 477 | + | |
| 478 | + AdditionalResources({ | |
| 479 | + required this.seeAlso, | |
| 480 | + }); | |
| 481 | + | |
| 482 | + factory AdditionalResources.fromJson(Map<String, dynamic> json) => AdditionalResources( | |
| 483 | + seeAlso: json["See Also"], | |
| 484 | + ); | |
| 485 | + | |
| 486 | + Map<String, dynamic> toJson() => { | |
| 487 | + "See Also": seeAlso, | |
| 488 | + }; | |
| 489 | +} | |
| 490 | + | |
| 491 | +class CommonCore { | |
| 492 | + final String contactEmail; | |
| 493 | + final String contactName; | |
| 494 | + final String publisher; | |
| 495 | + | |
| 496 | + CommonCore({ | |
| 497 | + required this.contactEmail, | |
| 498 | + required this.contactName, | |
| 499 | + required this.publisher, | |
| 500 | + }); | |
| 501 | + | |
| 502 | + factory CommonCore.fromJson(Map<String, dynamic> json) => CommonCore( | |
| 503 | + contactEmail: json["Contact Email"], | |
| 504 | + contactName: json["Contact Name"], | |
| 505 | + publisher: json["Publisher"], | |
| 506 | + ); | |
| 507 | + | |
| 508 | + Map<String, dynamic> toJson() => { | |
| 509 | + "Contact Email": contactEmail, | |
| 510 | + "Contact Name": contactName, | |
| 511 | + "Publisher": publisher, | |
| 512 | + }; | |
| 513 | +} | |
| 514 | + | |
| 515 | +class DatasetInformation { | |
| 516 | + final String agency; | |
| 517 | + | |
| 518 | + DatasetInformation({ | |
| 519 | + required this.agency, | |
| 520 | + }); | |
| 521 | + | |
| 522 | + factory DatasetInformation.fromJson(Map<String, dynamic> json) => DatasetInformation( | |
| 523 | + agency: json["Agency"], | |
| 524 | + ); | |
| 525 | + | |
| 526 | + Map<String, dynamic> toJson() => { | |
| 527 | + "Agency": agency, | |
| 528 | + }; | |
| 529 | +} | |
| 530 | + | |
| 531 | +class DatasetSummary { | |
| 532 | + final String contactInformation; | |
| 533 | + final String coverage; | |
| 534 | + final String dataFrequency; | |
| 535 | + final String datasetOwner; | |
| 536 | + final String granularity; | |
| 537 | + final String organization; | |
| 538 | + final String postingFrequency; | |
| 539 | + final String timePeriod; | |
| 540 | + | |
| 541 | + DatasetSummary({ | |
| 542 | + required this.contactInformation, | |
| 543 | + required this.coverage, | |
| 544 | + required this.dataFrequency, | |
| 545 | + required this.datasetOwner, | |
| 546 | + required this.granularity, | |
| 547 | + required this.organization, | |
| 548 | + required this.postingFrequency, | |
| 549 | + required this.timePeriod, | |
| 550 | + }); | |
| 551 | + | |
| 552 | + factory DatasetSummary.fromJson(Map<String, dynamic> json) => DatasetSummary( | |
| 553 | + contactInformation: json["Contact Information"], | |
| 554 | + coverage: json["Coverage"], | |
| 555 | + dataFrequency: json["Data Frequency"], | |
| 556 | + datasetOwner: json["Dataset Owner"], | |
| 557 | + granularity: json["Granularity"], | |
| 558 | + organization: json["Organization"], | |
| 559 | + postingFrequency: json["Posting Frequency"], | |
| 560 | + timePeriod: json["Time Period"], | |
| 561 | + ); | |
| 562 | + | |
| 563 | + Map<String, dynamic> toJson() => { | |
| 564 | + "Contact Information": contactInformation, | |
| 565 | + "Coverage": coverage, | |
| 566 | + "Data Frequency": dataFrequency, | |
| 567 | + "Dataset Owner": datasetOwner, | |
| 568 | + "Granularity": granularity, | |
| 569 | + "Organization": organization, | |
| 570 | + "Posting Frequency": postingFrequency, | |
| 571 | + "Time Period": timePeriod, | |
| 572 | + }; | |
| 573 | +} | |
| 574 | + | |
| 575 | +class Notes { | |
| 576 | + final String notes; | |
| 577 | + | |
| 578 | + Notes({ | |
| 579 | + required this.notes, | |
| 580 | + }); | |
| 581 | + | |
| 582 | + factory Notes.fromJson(Map<String, dynamic> json) => Notes( | |
| 583 | + notes: json["Notes"], | |
| 584 | + ); | |
| 585 | + | |
| 586 | + Map<String, dynamic> toJson() => { | |
| 587 | + "Notes": notes, | |
| 588 | + }; | |
| 589 | +} | |
| 590 | + | |
| 591 | +class JsonQuery { | |
| 592 | + final List<Order> order; | |
| 593 | + | |
| 594 | + JsonQuery({ | |
| 595 | + required this.order, | |
| 596 | + }); | |
| 597 | + | |
| 598 | + factory JsonQuery.fromJson(Map<String, dynamic> json) => JsonQuery( | |
| 599 | + order: List<Order>.from(json["order"].map((x) => Order.fromJson(x))), | |
| 600 | + ); | |
| 601 | + | |
| 602 | + Map<String, dynamic> toJson() => { | |
| 603 | + "order": List<dynamic>.from(order.map((x) => x.toJson())), | |
| 604 | + }; | |
| 605 | +} | |
| 606 | + | |
| 607 | +class Order { | |
| 608 | + final bool ascending; | |
| 609 | + final String columnFieldName; | |
| 610 | + | |
| 611 | + Order({ | |
| 612 | + required this.ascending, | |
| 613 | + required this.columnFieldName, | |
| 614 | + }); | |
| 615 | + | |
| 616 | + factory Order.fromJson(Map<String, dynamic> json) => Order( | |
| 617 | + ascending: json["ascending"], | |
| 618 | + columnFieldName: json["columnFieldName"], | |
| 619 | + ); | |
| 620 | + | |
| 621 | + Map<String, dynamic> toJson() => { | |
| 622 | + "ascending": ascending, | |
| 623 | + "columnFieldName": columnFieldName, | |
| 624 | + }; | |
| 625 | +} | |
| 626 | + | |
| 627 | +class RenderTypeConfig { | |
| 628 | + final Visible visible; | |
| 629 | + | |
| 630 | + RenderTypeConfig({ | |
| 631 | + required this.visible, | |
| 632 | + }); | |
| 633 | + | |
| 634 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 635 | + visible: Visible.fromJson(json["visible"]), | |
| 636 | + ); | |
| 637 | + | |
| 638 | + Map<String, dynamic> toJson() => { | |
| 639 | + "visible": visible.toJson(), | |
| 640 | + }; | |
| 641 | +} | |
| 642 | + | |
| 643 | +class Visible { | |
| 644 | + final bool table; | |
| 645 | + | |
| 646 | + Visible({ | |
| 647 | + required this.table, | |
| 648 | + }); | |
| 649 | + | |
| 650 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 651 | + table: json["table"], | |
| 652 | + ); | |
| 653 | + | |
| 654 | + Map<String, dynamic> toJson() => { | |
| 655 | + "table": table, | |
| 656 | + }; | |
| 657 | +} | |
| 658 | + | |
| 659 | +class Owner { | |
| 660 | + final String displayName; | |
| 661 | + final String id; | |
| 662 | + final String profileImageUrlLarge; | |
| 663 | + final String profileImageUrlMedium; | |
| 664 | + final String profileImageUrlSmall; | |
| 665 | + final List<String> rights; | |
| 666 | + final String roleName; | |
| 667 | + final String screenName; | |
| 668 | + | |
| 669 | + Owner({ | |
| 670 | + required this.displayName, | |
| 671 | + required this.id, | |
| 672 | + required this.profileImageUrlLarge, | |
| 673 | + required this.profileImageUrlMedium, | |
| 674 | + required this.profileImageUrlSmall, | |
| 675 | + required this.rights, | |
| 676 | + required this.roleName, | |
| 677 | + required this.screenName, | |
| 678 | + }); | |
| 679 | + | |
| 680 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 681 | + displayName: json["displayName"], | |
| 682 | + id: json["id"], | |
| 683 | + profileImageUrlLarge: json["profileImageUrlLarge"], | |
| 684 | + profileImageUrlMedium: json["profileImageUrlMedium"], | |
| 685 | + profileImageUrlSmall: json["profileImageUrlSmall"], | |
| 686 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 687 | + roleName: json["roleName"], | |
| 688 | + screenName: json["screenName"], | |
| 689 | + ); | |
| 690 | + | |
| 691 | + Map<String, dynamic> toJson() => { | |
| 692 | + "displayName": displayName, | |
| 693 | + "id": id, | |
| 694 | + "profileImageUrlLarge": profileImageUrlLarge, | |
| 695 | + "profileImageUrlMedium": profileImageUrlMedium, | |
| 696 | + "profileImageUrlSmall": profileImageUrlSmall, | |
| 697 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 698 | + "roleName": roleName, | |
| 699 | + "screenName": screenName, | |
| 700 | + }; | |
| 701 | +} | |
| 702 | + | |
| 703 | +class Query { | |
| 704 | + final List<OrderBy> orderBys; | |
| 705 | + | |
| 706 | + Query({ | |
| 707 | + required this.orderBys, | |
| 708 | + }); | |
| 709 | + | |
| 710 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 711 | + orderBys: List<OrderBy>.from(json["orderBys"].map((x) => OrderBy.fromJson(x))), | |
| 712 | + ); | |
| 713 | + | |
| 714 | + Map<String, dynamic> toJson() => { | |
| 715 | + "orderBys": List<dynamic>.from(orderBys.map((x) => x.toJson())), | |
| 716 | + }; | |
| 717 | +} | |
| 718 | + | |
| 719 | +class OrderBy { | |
| 720 | + final bool ascending; | |
| 721 | + final Expression expression; | |
| 722 | + | |
| 723 | + OrderBy({ | |
| 724 | + required this.ascending, | |
| 725 | + required this.expression, | |
| 726 | + }); | |
| 727 | + | |
| 728 | + factory OrderBy.fromJson(Map<String, dynamic> json) => OrderBy( | |
| 729 | + ascending: json["ascending"], | |
| 730 | + expression: Expression.fromJson(json["expression"]), | |
| 731 | + ); | |
| 732 | + | |
| 733 | + Map<String, dynamic> toJson() => { | |
| 734 | + "ascending": ascending, | |
| 735 | + "expression": expression.toJson(), | |
| 736 | + }; | |
| 737 | +} | |
| 738 | + | |
| 739 | +class Expression { | |
| 740 | + final int columnId; | |
| 741 | + final String type; | |
| 742 | + | |
| 743 | + Expression({ | |
| 744 | + required this.columnId, | |
| 745 | + required this.type, | |
| 746 | + }); | |
| 747 | + | |
| 748 | + factory Expression.fromJson(Map<String, dynamic> json) => Expression( | |
| 749 | + columnId: json["columnId"], | |
| 750 | + type: json["type"], | |
| 751 | + ); | |
| 752 | + | |
| 753 | + Map<String, dynamic> toJson() => { | |
| 754 | + "columnId": columnId, | |
| 755 | + "type": type, | |
| 756 | + }; | |
| 757 | +} | |
| 758 | + | |
| 759 | +class EnumValues<T> { | |
| 760 | + Map<String, T> map; | |
| 761 | + late Map<T, String> reverseMap; | |
| 762 | + | |
| 763 | + EnumValues(this.map); | |
| 764 | + | |
| 765 | + Map<T, String> get reverse { | |
| 766 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 767 | + return reverseMap; | |
| 768 | + } | |
| 769 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/61b66.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/6260a.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +325 −0test/inputs/json/misc/65dec.json
Adartdefault / TopLevel.dart+325 −0
| @@ -0,0 +1,325 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<String> booster; | |
| 13 | + final String border; | |
| 14 | + final List<Card> cards; | |
| 15 | + final String code; | |
| 16 | + final String gathererCode; | |
| 17 | + final String magicCardsInfoCode; | |
| 18 | + final int mkmId; | |
| 19 | + final String mkmName; | |
| 20 | + final String name; | |
| 21 | + final DateTime releaseDate; | |
| 22 | + final String type; | |
| 23 | + | |
| 24 | + TopLevel({ | |
| 25 | + required this.booster, | |
| 26 | + required this.border, | |
| 27 | + required this.cards, | |
| 28 | + required this.code, | |
| 29 | + required this.gathererCode, | |
| 30 | + required this.magicCardsInfoCode, | |
| 31 | + required this.mkmId, | |
| 32 | + required this.mkmName, | |
| 33 | + required this.name, | |
| 34 | + required this.releaseDate, | |
| 35 | + required this.type, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 39 | + booster: List<String>.from(json["booster"].map((x) => x)), | |
| 40 | + border: json["border"], | |
| 41 | + cards: List<Card>.from(json["cards"].map((x) => Card.fromJson(x))), | |
| 42 | + code: json["code"], | |
| 43 | + gathererCode: json["gathererCode"], | |
| 44 | + magicCardsInfoCode: json["magicCardsInfoCode"], | |
| 45 | + mkmId: json["mkm_id"], | |
| 46 | + mkmName: json["mkm_name"], | |
| 47 | + name: json["name"], | |
| 48 | + releaseDate: DateTime.parse(json["releaseDate"]), | |
| 49 | + type: json["type"], | |
| 50 | + ); | |
| 51 | + | |
| 52 | + Map<String, dynamic> toJson() => { | |
| 53 | + "booster": List<dynamic>.from(booster.map((x) => x)), | |
| 54 | + "border": border, | |
| 55 | + "cards": List<dynamic>.from(cards.map((x) => x.toJson())), | |
| 56 | + "code": code, | |
| 57 | + "gathererCode": gathererCode, | |
| 58 | + "magicCardsInfoCode": magicCardsInfoCode, | |
| 59 | + "mkm_id": mkmId, | |
| 60 | + "mkm_name": mkmName, | |
| 61 | + "name": name, | |
| 62 | + "releaseDate": "${releaseDate.year.toString().padLeft(4, '0')}-${releaseDate.month.toString().padLeft(2, '0')}-${releaseDate.day.toString().padLeft(2, '0')}", | |
| 63 | + "type": type, | |
| 64 | + }; | |
| 65 | +} | |
| 66 | + | |
| 67 | +class Card { | |
| 68 | + final String artist; | |
| 69 | + final int cmc; | |
| 70 | + final List<ColorIdentity>? colorIdentity; | |
| 71 | + final List<Watermark>? colors; | |
| 72 | + final String? flavor; | |
| 73 | + final String id; | |
| 74 | + final String imageName; | |
| 75 | + final Layout layout; | |
| 76 | + final List<LegalityElement> legalities; | |
| 77 | + final String? manaCost; | |
| 78 | + final String? mciNumber; | |
| 79 | + final int multiverseid; | |
| 80 | + final String name; | |
| 81 | + final String originalText; | |
| 82 | + final String originalType; | |
| 83 | + final String? power; | |
| 84 | + final List<String> printings; | |
| 85 | + final Rarity rarity; | |
| 86 | + final bool? reserved; | |
| 87 | + final List<Ruling>? rulings; | |
| 88 | + final List<String>? subtypes; | |
| 89 | + final List<String>? supertypes; | |
| 90 | + final String? text; | |
| 91 | + final String? toughness; | |
| 92 | + final String type; | |
| 93 | + final List<Type> types; | |
| 94 | + final List<int>? variations; | |
| 95 | + final Watermark? watermark; | |
| 96 | + | |
| 97 | + Card({ | |
| 98 | + required this.artist, | |
| 99 | + required this.cmc, | |
| 100 | + this.colorIdentity, | |
| 101 | + this.colors, | |
| 102 | + this.flavor, | |
| 103 | + required this.id, | |
| 104 | + required this.imageName, | |
| 105 | + required this.layout, | |
| 106 | + required this.legalities, | |
| 107 | + this.manaCost, | |
| 108 | + this.mciNumber, | |
| 109 | + required this.multiverseid, | |
| 110 | + required this.name, | |
| 111 | + required this.originalText, | |
| 112 | + required this.originalType, | |
| 113 | + this.power, | |
| 114 | + required this.printings, | |
| 115 | + required this.rarity, | |
| 116 | + this.reserved, | |
| 117 | + this.rulings, | |
| 118 | + this.subtypes, | |
| 119 | + this.supertypes, | |
| 120 | + this.text, | |
| 121 | + this.toughness, | |
| 122 | + required this.type, | |
| 123 | + required this.types, | |
| 124 | + this.variations, | |
| 125 | + this.watermark, | |
| 126 | + }); | |
| 127 | + | |
| 128 | + factory Card.fromJson(Map<String, dynamic> json) => Card( | |
| 129 | + artist: json["artist"], | |
| 130 | + cmc: json["cmc"], | |
| 131 | + colorIdentity: json["colorIdentity"] == null ? null : List<ColorIdentity>.from(json["colorIdentity"]!.map((x) => colorIdentityValues.map[x]!)), | |
| 132 | + colors: json["colors"] == null ? null : List<Watermark>.from(json["colors"]!.map((x) => watermarkValues.map[x]!)), | |
| 133 | + flavor: json["flavor"], | |
| 134 | + id: json["id"], | |
| 135 | + imageName: json["imageName"], | |
| 136 | + layout: layoutValues.map[json["layout"]]!, | |
| 137 | + legalities: List<LegalityElement>.from(json["legalities"].map((x) => LegalityElement.fromJson(x))), | |
| 138 | + manaCost: json["manaCost"], | |
| 139 | + mciNumber: json["mciNumber"], | |
| 140 | + multiverseid: json["multiverseid"], | |
| 141 | + name: json["name"], | |
| 142 | + originalText: json["originalText"], | |
| 143 | + originalType: json["originalType"], | |
| 144 | + power: json["power"], | |
| 145 | + printings: List<String>.from(json["printings"].map((x) => x)), | |
| 146 | + rarity: rarityValues.map[json["rarity"]]!, | |
| 147 | + reserved: json["reserved"], | |
| 148 | + rulings: json["rulings"] == null ? null : List<Ruling>.from(json["rulings"]!.map((x) => Ruling.fromJson(x))), | |
| 149 | + subtypes: json["subtypes"] == null ? null : List<String>.from(json["subtypes"]!.map((x) => x)), | |
| 150 | + supertypes: json["supertypes"] == null ? null : List<String>.from(json["supertypes"]!.map((x) => x)), | |
| 151 | + text: json["text"], | |
| 152 | + toughness: json["toughness"], | |
| 153 | + type: json["type"], | |
| 154 | + types: List<Type>.from(json["types"].map((x) => typeValues.map[x]!)), | |
| 155 | + variations: json["variations"] == null ? null : List<int>.from(json["variations"]!.map((x) => x)), | |
| 156 | + watermark: watermarkValues.map[json["watermark"]], | |
| 157 | + ); | |
| 158 | + | |
| 159 | + Map<String, dynamic> toJson() => { | |
| 160 | + "artist": artist, | |
| 161 | + "cmc": cmc, | |
| 162 | + "colorIdentity": colorIdentity == null ? null : List<dynamic>.from(colorIdentity!.map((x) => colorIdentityValues.reverse[x])), | |
| 163 | + "colors": colors == null ? null : List<dynamic>.from(colors!.map((x) => watermarkValues.reverse[x])), | |
| 164 | + "flavor": flavor, | |
| 165 | + "id": id, | |
| 166 | + "imageName": imageName, | |
| 167 | + "layout": layoutValues.reverse[layout], | |
| 168 | + "legalities": List<dynamic>.from(legalities.map((x) => x.toJson())), | |
| 169 | + "manaCost": manaCost, | |
| 170 | + "mciNumber": mciNumber, | |
| 171 | + "multiverseid": multiverseid, | |
| 172 | + "name": name, | |
| 173 | + "originalText": originalText, | |
| 174 | + "originalType": originalType, | |
| 175 | + "power": power, | |
| 176 | + "printings": List<dynamic>.from(printings.map((x) => x)), | |
| 177 | + "rarity": rarityValues.reverse[rarity], | |
| 178 | + "reserved": reserved, | |
| 179 | + "rulings": rulings == null ? null : List<dynamic>.from(rulings!.map((x) => x.toJson())), | |
| 180 | + "subtypes": subtypes == null ? null : List<dynamic>.from(subtypes!.map((x) => x)), | |
| 181 | + "supertypes": supertypes == null ? null : List<dynamic>.from(supertypes!.map((x) => x)), | |
| 182 | + "text": text, | |
| 183 | + "toughness": toughness, | |
| 184 | + "type": type, | |
| 185 | + "types": List<dynamic>.from(types.map((x) => typeValues.reverse[x])), | |
| 186 | + "variations": variations == null ? null : List<dynamic>.from(variations!.map((x) => x)), | |
| 187 | + "watermark": watermarkValues.reverse[watermark], | |
| 188 | + }; | |
| 189 | +} | |
| 190 | + | |
| 191 | +enum ColorIdentity { | |
| 192 | + W, | |
| 193 | + R, | |
| 194 | + B, | |
| 195 | + G, | |
| 196 | + U | |
| 197 | +} | |
| 198 | + | |
| 199 | +final colorIdentityValues = EnumValues({ | |
| 200 | + "W": ColorIdentity.W, | |
| 201 | + "R": ColorIdentity.R, | |
| 202 | + "B": ColorIdentity.B, | |
| 203 | + "G": ColorIdentity.G, | |
| 204 | + "U": ColorIdentity.U | |
| 205 | +}); | |
| 206 | + | |
| 207 | +enum Watermark { | |
| 208 | + WHITE, | |
| 209 | + RED, | |
| 210 | + BLACK, | |
| 211 | + GREEN, | |
| 212 | + BLUE | |
| 213 | +} | |
| 214 | + | |
| 215 | +final watermarkValues = EnumValues({ | |
| 216 | + "White": Watermark.WHITE, | |
| 217 | + "Red": Watermark.RED, | |
| 218 | + "Black": Watermark.BLACK, | |
| 219 | + "Green": Watermark.GREEN, | |
| 220 | + "Blue": Watermark.BLUE | |
| 221 | +}); | |
| 222 | + | |
| 223 | +enum Layout { | |
| 224 | + NORMAL | |
| 225 | +} | |
| 226 | + | |
| 227 | +final layoutValues = EnumValues({ | |
| 228 | + "normal": Layout.NORMAL | |
| 229 | +}); | |
| 230 | + | |
| 231 | +class LegalityElement { | |
| 232 | + final String format; | |
| 233 | + final LegalityEnum legality; | |
| 234 | + | |
| 235 | + LegalityElement({ | |
| 236 | + required this.format, | |
| 237 | + required this.legality, | |
| 238 | + }); | |
| 239 | + | |
| 240 | + factory LegalityElement.fromJson(Map<String, dynamic> json) => LegalityElement( | |
| 241 | + format: json["format"], | |
| 242 | + legality: legalityEnumValues.map[json["legality"]]!, | |
| 243 | + ); | |
| 244 | + | |
| 245 | + Map<String, dynamic> toJson() => { | |
| 246 | + "format": format, | |
| 247 | + "legality": legalityEnumValues.reverse[legality], | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +enum LegalityEnum { | |
| 252 | + LEGAL, | |
| 253 | + BANNED, | |
| 254 | + RESTRICTED | |
| 255 | +} | |
| 256 | + | |
| 257 | +final legalityEnumValues = EnumValues({ | |
| 258 | + "Legal": LegalityEnum.LEGAL, | |
| 259 | + "Banned": LegalityEnum.BANNED, | |
| 260 | + "Restricted": LegalityEnum.RESTRICTED | |
| 261 | +}); | |
| 262 | + | |
| 263 | +enum Rarity { | |
| 264 | + UNCOMMON, | |
| 265 | + RARE, | |
| 266 | + COMMON, | |
| 267 | + BASIC_LAND | |
| 268 | +} | |
| 269 | + | |
| 270 | +final rarityValues = EnumValues({ | |
| 271 | + "Uncommon": Rarity.UNCOMMON, | |
| 272 | + "Rare": Rarity.RARE, | |
| 273 | + "Common": Rarity.COMMON, | |
| 274 | + "Basic Land": Rarity.BASIC_LAND | |
| 275 | +}); | |
| 276 | + | |
| 277 | +class Ruling { | |
| 278 | + final DateTime date; | |
| 279 | + final String text; | |
| 280 | + | |
| 281 | + Ruling({ | |
| 282 | + required this.date, | |
| 283 | + required this.text, | |
| 284 | + }); | |
| 285 | + | |
| 286 | + factory Ruling.fromJson(Map<String, dynamic> json) => Ruling( | |
| 287 | + date: DateTime.parse(json["date"]), | |
| 288 | + text: json["text"], | |
| 289 | + ); | |
| 290 | + | |
| 291 | + Map<String, dynamic> toJson() => { | |
| 292 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 293 | + "text": text, | |
| 294 | + }; | |
| 295 | +} | |
| 296 | + | |
| 297 | +enum Type { | |
| 298 | + CREATURE, | |
| 299 | + ARTIFACT, | |
| 300 | + INSTANT, | |
| 301 | + LAND, | |
| 302 | + ENCHANTMENT, | |
| 303 | + SORCERY | |
| 304 | +} | |
| 305 | + | |
| 306 | +final typeValues = EnumValues({ | |
| 307 | + "Creature": Type.CREATURE, | |
| 308 | + "Artifact": Type.ARTIFACT, | |
| 309 | + "Instant": Type.INSTANT, | |
| 310 | + "Land": Type.LAND, | |
| 311 | + "Enchantment": Type.ENCHANTMENT, | |
| 312 | + "Sorcery": Type.SORCERY | |
| 313 | +}); | |
| 314 | + | |
| 315 | +class EnumValues<T> { | |
| 316 | + Map<String, T> map; | |
| 317 | + late Map<T, String> reverseMap; | |
| 318 | + | |
| 319 | + EnumValues(this.map); | |
| 320 | + | |
| 321 | + Map<T, String> get reverse { | |
| 322 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 323 | + return reverseMap; | |
| 324 | + } | |
| 325 | +} |
Test case
1 generated file · +177 −0test/inputs/json/misc/66121.json
Adartdefault / TopLevel.dart+177 −0
| @@ -0,0 +1,177 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final String? supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + SPDX, | |
| 77 | + TROVE, | |
| 78 | + DEP5 | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "SPDX": Scheme.SPDX, | |
| 83 | + "Trove": Scheme.TROVE, | |
| 84 | + "DEP5": Scheme.DEP5 | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + OSI_APPROVED, | |
| 89 | + DISCOURAGED, | |
| 90 | + REDUNDANT | |
| 91 | +} | |
| 92 | + | |
| 93 | +final keywordValues = EnumValues({ | |
| 94 | + "osi-approved": Keyword.OSI_APPROVED, | |
| 95 | + "discouraged": Keyword.DISCOURAGED, | |
| 96 | + "redundant": Keyword.REDUNDANT | |
| 97 | +}); | |
| 98 | + | |
| 99 | +class Link { | |
| 100 | + final Note note; | |
| 101 | + final String url; | |
| 102 | + | |
| 103 | + Link({ | |
| 104 | + required this.note, | |
| 105 | + required this.url, | |
| 106 | + }); | |
| 107 | + | |
| 108 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 109 | + note: noteValues.map[json["note"]]!, | |
| 110 | + url: json["url"], | |
| 111 | + ); | |
| 112 | + | |
| 113 | + Map<String, dynamic> toJson() => { | |
| 114 | + "note": noteValues.reverse[note], | |
| 115 | + "url": url, | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +enum Note { | |
| 120 | + OSI_PAGE | |
| 121 | +} | |
| 122 | + | |
| 123 | +final noteValues = EnumValues({ | |
| 124 | + "OSI Page": Note.OSI_PAGE | |
| 125 | +}); | |
| 126 | + | |
| 127 | +class Text { | |
| 128 | + final MediaType mediaType; | |
| 129 | + final Title title; | |
| 130 | + final String url; | |
| 131 | + | |
| 132 | + Text({ | |
| 133 | + required this.mediaType, | |
| 134 | + required this.title, | |
| 135 | + required this.url, | |
| 136 | + }); | |
| 137 | + | |
| 138 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 139 | + mediaType: mediaTypeValues.map[json["media_type"]]!, | |
| 140 | + title: titleValues.map[json["title"]]!, | |
| 141 | + url: json["url"], | |
| 142 | + ); | |
| 143 | + | |
| 144 | + Map<String, dynamic> toJson() => { | |
| 145 | + "media_type": mediaTypeValues.reverse[mediaType], | |
| 146 | + "title": titleValues.reverse[title], | |
| 147 | + "url": url, | |
| 148 | + }; | |
| 149 | +} | |
| 150 | + | |
| 151 | +enum MediaType { | |
| 152 | + TEXT_HTML | |
| 153 | +} | |
| 154 | + | |
| 155 | +final mediaTypeValues = EnumValues({ | |
| 156 | + "text/html": MediaType.TEXT_HTML | |
| 157 | +}); | |
| 158 | + | |
| 159 | +enum Title { | |
| 160 | + HTML | |
| 161 | +} | |
| 162 | + | |
| 163 | +final titleValues = EnumValues({ | |
| 164 | + "HTML": Title.HTML | |
| 165 | +}); | |
| 166 | + | |
| 167 | +class EnumValues<T> { | |
| 168 | + Map<String, T> map; | |
| 169 | + late Map<T, String> reverseMap; | |
| 170 | + | |
| 171 | + EnumValues(this.map); | |
| 172 | + | |
| 173 | + Map<T, String> get reverse { | |
| 174 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 175 | + return reverseMap; | |
| 176 | + } | |
| 177 | +} |
Test case
1 generated file · +53 −0test/inputs/json/misc/6617c.json
Adartdefault / TopLevel.dart+53 −0
| @@ -0,0 +1,53 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final IssPosition issPosition; | |
| 13 | + final String message; | |
| 14 | + final int timestamp; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.issPosition, | |
| 18 | + required this.message, | |
| 19 | + required this.timestamp, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + issPosition: IssPosition.fromJson(json["iss_position"]), | |
| 24 | + message: json["message"], | |
| 25 | + timestamp: json["timestamp"], | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "iss_position": issPosition.toJson(), | |
| 30 | + "message": message, | |
| 31 | + "timestamp": timestamp, | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class IssPosition { | |
| 36 | + final String latitude; | |
| 37 | + final String longitude; | |
| 38 | + | |
| 39 | + IssPosition({ | |
| 40 | + required this.latitude, | |
| 41 | + required this.longitude, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory IssPosition.fromJson(Map<String, dynamic> json) => IssPosition( | |
| 45 | + latitude: json["latitude"], | |
| 46 | + longitude: json["longitude"], | |
| 47 | + ); | |
| 48 | + | |
| 49 | + Map<String, dynamic> toJson() => { | |
| 50 | + "latitude": latitude, | |
| 51 | + "longitude": longitude, | |
| 52 | + }; | |
| 53 | +} |
Test case
1 generated file · +53 −0test/inputs/json/misc/67c03.json
Adartdefault / TopLevel.dart+53 −0
| @@ -0,0 +1,53 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String message; | |
| 13 | + final int number; | |
| 14 | + final List<Person> people; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.message, | |
| 18 | + required this.number, | |
| 19 | + required this.people, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + message: json["message"], | |
| 24 | + number: json["number"], | |
| 25 | + people: List<Person>.from(json["people"].map((x) => Person.fromJson(x))), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "message": message, | |
| 30 | + "number": number, | |
| 31 | + "people": List<dynamic>.from(people.map((x) => x.toJson())), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Person { | |
| 36 | + final String craft; | |
| 37 | + final String name; | |
| 38 | + | |
| 39 | + Person({ | |
| 40 | + required this.craft, | |
| 41 | + required this.name, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory Person.fromJson(Map<String, dynamic> json) => Person( | |
| 45 | + craft: json["craft"], | |
| 46 | + name: json["name"], | |
| 47 | + ); | |
| 48 | + | |
| 49 | + Map<String, dynamic> toJson() => { | |
| 50 | + "craft": craft, | |
| 51 | + "name": name, | |
| 52 | + }; | |
| 53 | +} |
Test case
1 generated file · +149 −0test/inputs/json/misc/68c30.json
Adartdefault / TopLevel.dart+149 −0
| @@ -0,0 +1,149 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Tx> txs; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.txs, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + txs: List<Tx>.from(json["txs"].map((x) => Tx.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "txs": List<dynamic>.from(txs.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Tx { | |
| 28 | + final bool doubleSpend; | |
| 29 | + final String hash; | |
| 30 | + final List<Input> inputs; | |
| 31 | + final int lockTime; | |
| 32 | + final List<Out> out; | |
| 33 | + final String relayedBy; | |
| 34 | + final int size; | |
| 35 | + final int time; | |
| 36 | + final int txIndex; | |
| 37 | + final int ver; | |
| 38 | + final int vinSz; | |
| 39 | + final int voutSz; | |
| 40 | + | |
| 41 | + Tx({ | |
| 42 | + required this.doubleSpend, | |
| 43 | + required this.hash, | |
| 44 | + required this.inputs, | |
| 45 | + required this.lockTime, | |
| 46 | + required this.out, | |
| 47 | + required this.relayedBy, | |
| 48 | + required this.size, | |
| 49 | + required this.time, | |
| 50 | + required this.txIndex, | |
| 51 | + required this.ver, | |
| 52 | + required this.vinSz, | |
| 53 | + required this.voutSz, | |
| 54 | + }); | |
| 55 | + | |
| 56 | + factory Tx.fromJson(Map<String, dynamic> json) => Tx( | |
| 57 | + doubleSpend: json["double_spend"], | |
| 58 | + hash: json["hash"], | |
| 59 | + inputs: List<Input>.from(json["inputs"].map((x) => Input.fromJson(x))), | |
| 60 | + lockTime: json["lock_time"], | |
| 61 | + out: List<Out>.from(json["out"].map((x) => Out.fromJson(x))), | |
| 62 | + relayedBy: json["relayed_by"], | |
| 63 | + size: json["size"], | |
| 64 | + time: json["time"], | |
| 65 | + txIndex: json["tx_index"], | |
| 66 | + ver: json["ver"], | |
| 67 | + vinSz: json["vin_sz"], | |
| 68 | + voutSz: json["vout_sz"], | |
| 69 | + ); | |
| 70 | + | |
| 71 | + Map<String, dynamic> toJson() => { | |
| 72 | + "double_spend": doubleSpend, | |
| 73 | + "hash": hash, | |
| 74 | + "inputs": List<dynamic>.from(inputs.map((x) => x.toJson())), | |
| 75 | + "lock_time": lockTime, | |
| 76 | + "out": List<dynamic>.from(out.map((x) => x.toJson())), | |
| 77 | + "relayed_by": relayedBy, | |
| 78 | + "size": size, | |
| 79 | + "time": time, | |
| 80 | + "tx_index": txIndex, | |
| 81 | + "ver": ver, | |
| 82 | + "vin_sz": vinSz, | |
| 83 | + "vout_sz": voutSz, | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class Input { | |
| 88 | + final Out prevOut; | |
| 89 | + final String script; | |
| 90 | + final int sequence; | |
| 91 | + | |
| 92 | + Input({ | |
| 93 | + required this.prevOut, | |
| 94 | + required this.script, | |
| 95 | + required this.sequence, | |
| 96 | + }); | |
| 97 | + | |
| 98 | + factory Input.fromJson(Map<String, dynamic> json) => Input( | |
| 99 | + prevOut: Out.fromJson(json["prev_out"]), | |
| 100 | + script: json["script"], | |
| 101 | + sequence: json["sequence"], | |
| 102 | + ); | |
| 103 | + | |
| 104 | + Map<String, dynamic> toJson() => { | |
| 105 | + "prev_out": prevOut.toJson(), | |
| 106 | + "script": script, | |
| 107 | + "sequence": sequence, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class Out { | |
| 112 | + final String addr; | |
| 113 | + final int n; | |
| 114 | + final String script; | |
| 115 | + final bool spent; | |
| 116 | + final int txIndex; | |
| 117 | + final int type; | |
| 118 | + final int value; | |
| 119 | + | |
| 120 | + Out({ | |
| 121 | + required this.addr, | |
| 122 | + required this.n, | |
| 123 | + required this.script, | |
| 124 | + required this.spent, | |
| 125 | + required this.txIndex, | |
| 126 | + required this.type, | |
| 127 | + required this.value, | |
| 128 | + }); | |
| 129 | + | |
| 130 | + factory Out.fromJson(Map<String, dynamic> json) => Out( | |
| 131 | + addr: json["addr"], | |
| 132 | + n: json["n"], | |
| 133 | + script: json["script"], | |
| 134 | + spent: json["spent"], | |
| 135 | + txIndex: json["tx_index"], | |
| 136 | + type: json["type"], | |
| 137 | + value: json["value"], | |
| 138 | + ); | |
| 139 | + | |
| 140 | + Map<String, dynamic> toJson() => { | |
| 141 | + "addr": addr, | |
| 142 | + "n": n, | |
| 143 | + "script": script, | |
| 144 | + "spent": spent, | |
| 145 | + "tx_index": txIndex, | |
| 146 | + "type": type, | |
| 147 | + "value": value, | |
| 148 | + }; | |
| 149 | +} |
Test case
1 generated file · +237 −0test/inputs/json/misc/6c155.json
Adartdefault / TopLevel.dart+237 −0
| @@ -0,0 +1,237 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Metadata metadata; | |
| 13 | + final List<Result> results; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.metadata, | |
| 17 | + required this.results, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 22 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "metadata": metadata.toJson(), | |
| 27 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Metadata { | |
| 32 | + final double executionTime; | |
| 33 | + final ResponseInfo responseInfo; | |
| 34 | + final Resultset resultset; | |
| 35 | + | |
| 36 | + Metadata({ | |
| 37 | + required this.executionTime, | |
| 38 | + required this.responseInfo, | |
| 39 | + required this.resultset, | |
| 40 | + }); | |
| 41 | + | |
| 42 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 43 | + executionTime: json["executionTime"]?.toDouble(), | |
| 44 | + responseInfo: ResponseInfo.fromJson(json["responseInfo"]), | |
| 45 | + resultset: Resultset.fromJson(json["resultset"]), | |
| 46 | + ); | |
| 47 | + | |
| 48 | + Map<String, dynamic> toJson() => { | |
| 49 | + "executionTime": executionTime, | |
| 50 | + "responseInfo": responseInfo.toJson(), | |
| 51 | + "resultset": resultset.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class ResponseInfo { | |
| 56 | + final String developerMessage; | |
| 57 | + final int status; | |
| 58 | + | |
| 59 | + ResponseInfo({ | |
| 60 | + required this.developerMessage, | |
| 61 | + required this.status, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory ResponseInfo.fromJson(Map<String, dynamic> json) => ResponseInfo( | |
| 65 | + developerMessage: json["developerMessage"], | |
| 66 | + status: json["status"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "developerMessage": developerMessage, | |
| 71 | + "status": status, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Resultset { | |
| 76 | + final int count; | |
| 77 | + final int page; | |
| 78 | + final int pagesize; | |
| 79 | + | |
| 80 | + Resultset({ | |
| 81 | + required this.count, | |
| 82 | + required this.page, | |
| 83 | + required this.pagesize, | |
| 84 | + }); | |
| 85 | + | |
| 86 | + factory Resultset.fromJson(Map<String, dynamic> json) => Resultset( | |
| 87 | + count: json["count"], | |
| 88 | + page: json["page"], | |
| 89 | + pagesize: json["pagesize"], | |
| 90 | + ); | |
| 91 | + | |
| 92 | + Map<String, dynamic> toJson() => { | |
| 93 | + "count": count, | |
| 94 | + "page": page, | |
| 95 | + "pagesize": pagesize, | |
| 96 | + }; | |
| 97 | +} | |
| 98 | + | |
| 99 | +class Result { | |
| 100 | + final List<dynamic> attachment; | |
| 101 | + final String body; | |
| 102 | + final String changed; | |
| 103 | + final List<Component> component; | |
| 104 | + final String created; | |
| 105 | + final String date; | |
| 106 | + final List<dynamic> image; | |
| 107 | + final Location location; | |
| 108 | + final dynamic teaser; | |
| 109 | + final String title; | |
| 110 | + final List<dynamic> topic; | |
| 111 | + final String url; | |
| 112 | + final String uuid; | |
| 113 | + final String vuuid; | |
| 114 | + | |
| 115 | + Result({ | |
| 116 | + required this.attachment, | |
| 117 | + required this.body, | |
| 118 | + required this.changed, | |
| 119 | + required this.component, | |
| 120 | + required this.created, | |
| 121 | + required this.date, | |
| 122 | + required this.image, | |
| 123 | + required this.location, | |
| 124 | + required this.teaser, | |
| 125 | + required this.title, | |
| 126 | + required this.topic, | |
| 127 | + required this.url, | |
| 128 | + required this.uuid, | |
| 129 | + required this.vuuid, | |
| 130 | + }); | |
| 131 | + | |
| 132 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 133 | + attachment: List<dynamic>.from(json["attachment"].map((x) => x)), | |
| 134 | + body: json["body"], | |
| 135 | + changed: json["changed"], | |
| 136 | + component: List<Component>.from(json["component"].map((x) => Component.fromJson(x))), | |
| 137 | + created: json["created"], | |
| 138 | + date: json["date"], | |
| 139 | + image: List<dynamic>.from(json["image"].map((x) => x)), | |
| 140 | + location: Location.fromJson(json["location"]), | |
| 141 | + teaser: json["teaser"], | |
| 142 | + title: json["title"], | |
| 143 | + topic: List<dynamic>.from(json["topic"].map((x) => x)), | |
| 144 | + url: json["url"], | |
| 145 | + uuid: json["uuid"], | |
| 146 | + vuuid: json["vuuid"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "attachment": List<dynamic>.from(attachment.map((x) => x)), | |
| 151 | + "body": body, | |
| 152 | + "changed": changed, | |
| 153 | + "component": List<dynamic>.from(component.map((x) => x.toJson())), | |
| 154 | + "created": created, | |
| 155 | + "date": date, | |
| 156 | + "image": List<dynamic>.from(image.map((x) => x)), | |
| 157 | + "location": location.toJson(), | |
| 158 | + "teaser": teaser, | |
| 159 | + "title": title, | |
| 160 | + "topic": List<dynamic>.from(topic.map((x) => x)), | |
| 161 | + "url": url, | |
| 162 | + "uuid": uuid, | |
| 163 | + "vuuid": vuuid, | |
| 164 | + }; | |
| 165 | +} | |
| 166 | + | |
| 167 | +class Component { | |
| 168 | + final String name; | |
| 169 | + final String uuid; | |
| 170 | + | |
| 171 | + Component({ | |
| 172 | + required this.name, | |
| 173 | + required this.uuid, | |
| 174 | + }); | |
| 175 | + | |
| 176 | + factory Component.fromJson(Map<String, dynamic> json) => Component( | |
| 177 | + name: json["name"], | |
| 178 | + uuid: json["uuid"], | |
| 179 | + ); | |
| 180 | + | |
| 181 | + Map<String, dynamic> toJson() => { | |
| 182 | + "name": name, | |
| 183 | + "uuid": uuid, | |
| 184 | + }; | |
| 185 | +} | |
| 186 | + | |
| 187 | +class Location { | |
| 188 | + final String administrativeArea; | |
| 189 | + final String country; | |
| 190 | + final String faxNumber; | |
| 191 | + final String locality; | |
| 192 | + final String mobileNumber; | |
| 193 | + final String phoneNumber; | |
| 194 | + final String phoneNumberExtension; | |
| 195 | + final String postalCode; | |
| 196 | + final dynamic subPremise; | |
| 197 | + final String thoroughfare; | |
| 198 | + | |
| 199 | + Location({ | |
| 200 | + required this.administrativeArea, | |
| 201 | + required this.country, | |
| 202 | + required this.faxNumber, | |
| 203 | + required this.locality, | |
| 204 | + required this.mobileNumber, | |
| 205 | + required this.phoneNumber, | |
| 206 | + required this.phoneNumberExtension, | |
| 207 | + required this.postalCode, | |
| 208 | + required this.subPremise, | |
| 209 | + required this.thoroughfare, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 213 | + administrativeArea: json["administrative_area"], | |
| 214 | + country: json["country"], | |
| 215 | + faxNumber: json["fax_number"], | |
| 216 | + locality: json["locality"], | |
| 217 | + mobileNumber: json["mobile_number"], | |
| 218 | + phoneNumber: json["phone_number"], | |
| 219 | + phoneNumberExtension: json["phone_number_extension"], | |
| 220 | + postalCode: json["postal_code"], | |
| 221 | + subPremise: json["sub_premise"], | |
| 222 | + thoroughfare: json["thoroughfare"], | |
| 223 | + ); | |
| 224 | + | |
| 225 | + Map<String, dynamic> toJson() => { | |
| 226 | + "administrative_area": administrativeArea, | |
| 227 | + "country": country, | |
| 228 | + "fax_number": faxNumber, | |
| 229 | + "locality": locality, | |
| 230 | + "mobile_number": mobileNumber, | |
| 231 | + "phone_number": phoneNumber, | |
| 232 | + "phone_number_extension": phoneNumberExtension, | |
| 233 | + "postal_code": postalCode, | |
| 234 | + "sub_premise": subPremise, | |
| 235 | + "thoroughfare": thoroughfare, | |
| 236 | + }; | |
| 237 | +} |
Test case
1 generated file · +613 −0test/inputs/json/misc/6de06.json
Adartdefault / TopLevel.dart+613 −0
| @@ -0,0 +1,613 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final String? authorFlairCssClass; | |
| 85 | + final String? authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final dynamic distinguished; | |
| 96 | + final String domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final String? linkFlairCssClass; | |
| 107 | + final String? linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final Media? media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final PostHint? postHint; | |
| 118 | + final Preview? preview; | |
| 119 | + final bool quarantine; | |
| 120 | + final dynamic removalReason; | |
| 121 | + final dynamic reportReasons; | |
| 122 | + final bool saved; | |
| 123 | + final int score; | |
| 124 | + final Media? secureMedia; | |
| 125 | + final MediaEmbed secureMediaEmbed; | |
| 126 | + final String selftext; | |
| 127 | + final String? selftextHtml; | |
| 128 | + final bool spoiler; | |
| 129 | + final bool stickied; | |
| 130 | + final String subreddit; | |
| 131 | + final String subredditId; | |
| 132 | + final String subredditNamePrefixed; | |
| 133 | + final SubredditType subredditType; | |
| 134 | + final String? suggestedSort; | |
| 135 | + final String thumbnail; | |
| 136 | + final int? thumbnailHeight; | |
| 137 | + final int? thumbnailWidth; | |
| 138 | + final String title; | |
| 139 | + final int ups; | |
| 140 | + final String url; | |
| 141 | + final List<dynamic> userReports; | |
| 142 | + final dynamic viewCount; | |
| 143 | + final bool visited; | |
| 144 | + | |
| 145 | + ChildData({ | |
| 146 | + required this.approvedAtUtc, | |
| 147 | + required this.approvedBy, | |
| 148 | + required this.archived, | |
| 149 | + required this.author, | |
| 150 | + required this.authorFlairCssClass, | |
| 151 | + required this.authorFlairText, | |
| 152 | + required this.bannedAtUtc, | |
| 153 | + required this.bannedBy, | |
| 154 | + required this.brandSafe, | |
| 155 | + required this.canGild, | |
| 156 | + required this.canModPost, | |
| 157 | + required this.clicked, | |
| 158 | + required this.contestMode, | |
| 159 | + required this.created, | |
| 160 | + required this.createdUtc, | |
| 161 | + required this.distinguished, | |
| 162 | + required this.domain, | |
| 163 | + required this.downs, | |
| 164 | + required this.edited, | |
| 165 | + required this.gilded, | |
| 166 | + required this.hidden, | |
| 167 | + required this.hideScore, | |
| 168 | + required this.id, | |
| 169 | + required this.isSelf, | |
| 170 | + required this.isVideo, | |
| 171 | + required this.likes, | |
| 172 | + required this.linkFlairCssClass, | |
| 173 | + required this.linkFlairText, | |
| 174 | + required this.locked, | |
| 175 | + required this.media, | |
| 176 | + required this.mediaEmbed, | |
| 177 | + required this.modReports, | |
| 178 | + required this.name, | |
| 179 | + required this.numComments, | |
| 180 | + required this.numReports, | |
| 181 | + required this.over18, | |
| 182 | + required this.permalink, | |
| 183 | + this.postHint, | |
| 184 | + this.preview, | |
| 185 | + required this.quarantine, | |
| 186 | + required this.removalReason, | |
| 187 | + required this.reportReasons, | |
| 188 | + required this.saved, | |
| 189 | + required this.score, | |
| 190 | + required this.secureMedia, | |
| 191 | + required this.secureMediaEmbed, | |
| 192 | + required this.selftext, | |
| 193 | + required this.selftextHtml, | |
| 194 | + required this.spoiler, | |
| 195 | + required this.stickied, | |
| 196 | + required this.subreddit, | |
| 197 | + required this.subredditId, | |
| 198 | + required this.subredditNamePrefixed, | |
| 199 | + required this.subredditType, | |
| 200 | + required this.suggestedSort, | |
| 201 | + required this.thumbnail, | |
| 202 | + required this.thumbnailHeight, | |
| 203 | + required this.thumbnailWidth, | |
| 204 | + required this.title, | |
| 205 | + required this.ups, | |
| 206 | + required this.url, | |
| 207 | + required this.userReports, | |
| 208 | + required this.viewCount, | |
| 209 | + required this.visited, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 213 | + approvedAtUtc: json["approved_at_utc"], | |
| 214 | + approvedBy: json["approved_by"], | |
| 215 | + archived: json["archived"], | |
| 216 | + author: json["author"], | |
| 217 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 218 | + authorFlairText: json["author_flair_text"], | |
| 219 | + bannedAtUtc: json["banned_at_utc"], | |
| 220 | + bannedBy: json["banned_by"], | |
| 221 | + brandSafe: json["brand_safe"], | |
| 222 | + canGild: json["can_gild"], | |
| 223 | + canModPost: json["can_mod_post"], | |
| 224 | + clicked: json["clicked"], | |
| 225 | + contestMode: json["contest_mode"], | |
| 226 | + created: json["created"]?.toDouble(), | |
| 227 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 228 | + distinguished: json["distinguished"], | |
| 229 | + domain: json["domain"], | |
| 230 | + downs: json["downs"], | |
| 231 | + edited: json["edited"], | |
| 232 | + gilded: json["gilded"], | |
| 233 | + hidden: json["hidden"], | |
| 234 | + hideScore: json["hide_score"], | |
| 235 | + id: json["id"], | |
| 236 | + isSelf: json["is_self"], | |
| 237 | + isVideo: json["is_video"], | |
| 238 | + likes: json["likes"], | |
| 239 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 240 | + linkFlairText: json["link_flair_text"], | |
| 241 | + locked: json["locked"], | |
| 242 | + media: json["media"] == null ? null : Media.fromJson(json["media"]), | |
| 243 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 244 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 245 | + name: json["name"], | |
| 246 | + numComments: json["num_comments"], | |
| 247 | + numReports: json["num_reports"], | |
| 248 | + over18: json["over_18"], | |
| 249 | + permalink: json["permalink"], | |
| 250 | + postHint: postHintValues.map[json["post_hint"]], | |
| 251 | + preview: json["preview"] == null ? null : Preview.fromJson(json["preview"]), | |
| 252 | + quarantine: json["quarantine"], | |
| 253 | + removalReason: json["removal_reason"], | |
| 254 | + reportReasons: json["report_reasons"], | |
| 255 | + saved: json["saved"], | |
| 256 | + score: json["score"], | |
| 257 | + secureMedia: json["secure_media"] == null ? null : Media.fromJson(json["secure_media"]), | |
| 258 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 259 | + selftext: json["selftext"], | |
| 260 | + selftextHtml: json["selftext_html"], | |
| 261 | + spoiler: json["spoiler"], | |
| 262 | + stickied: json["stickied"], | |
| 263 | + subreddit: json["subreddit"], | |
| 264 | + subredditId: json["subreddit_id"], | |
| 265 | + subredditNamePrefixed: json["subreddit_name_prefixed"], | |
| 266 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 267 | + suggestedSort: json["suggested_sort"], | |
| 268 | + thumbnail: json["thumbnail"], | |
| 269 | + thumbnailHeight: json["thumbnail_height"], | |
| 270 | + thumbnailWidth: json["thumbnail_width"], | |
| 271 | + title: json["title"], | |
| 272 | + ups: json["ups"], | |
| 273 | + url: json["url"], | |
| 274 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 275 | + viewCount: json["view_count"], | |
| 276 | + visited: json["visited"], | |
| 277 | + ); | |
| 278 | + | |
| 279 | + Map<String, dynamic> toJson() => { | |
| 280 | + "approved_at_utc": approvedAtUtc, | |
| 281 | + "approved_by": approvedBy, | |
| 282 | + "archived": archived, | |
| 283 | + "author": author, | |
| 284 | + "author_flair_css_class": authorFlairCssClass, | |
| 285 | + "author_flair_text": authorFlairText, | |
| 286 | + "banned_at_utc": bannedAtUtc, | |
| 287 | + "banned_by": bannedBy, | |
| 288 | + "brand_safe": brandSafe, | |
| 289 | + "can_gild": canGild, | |
| 290 | + "can_mod_post": canModPost, | |
| 291 | + "clicked": clicked, | |
| 292 | + "contest_mode": contestMode, | |
| 293 | + "created": created, | |
| 294 | + "created_utc": createdUtc, | |
| 295 | + "distinguished": distinguished, | |
| 296 | + "domain": domain, | |
| 297 | + "downs": downs, | |
| 298 | + "edited": edited, | |
| 299 | + "gilded": gilded, | |
| 300 | + "hidden": hidden, | |
| 301 | + "hide_score": hideScore, | |
| 302 | + "id": id, | |
| 303 | + "is_self": isSelf, | |
| 304 | + "is_video": isVideo, | |
| 305 | + "likes": likes, | |
| 306 | + "link_flair_css_class": linkFlairCssClass, | |
| 307 | + "link_flair_text": linkFlairText, | |
| 308 | + "locked": locked, | |
| 309 | + "media": media?.toJson(), | |
| 310 | + "media_embed": mediaEmbed.toJson(), | |
| 311 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 312 | + "name": name, | |
| 313 | + "num_comments": numComments, | |
| 314 | + "num_reports": numReports, | |
| 315 | + "over_18": over18, | |
| 316 | + "permalink": permalink, | |
| 317 | + "post_hint": postHintValues.reverse[postHint], | |
| 318 | + "preview": preview?.toJson(), | |
| 319 | + "quarantine": quarantine, | |
| 320 | + "removal_reason": removalReason, | |
| 321 | + "report_reasons": reportReasons, | |
| 322 | + "saved": saved, | |
| 323 | + "score": score, | |
| 324 | + "secure_media": secureMedia?.toJson(), | |
| 325 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 326 | + "selftext": selftext, | |
| 327 | + "selftext_html": selftextHtml, | |
| 328 | + "spoiler": spoiler, | |
| 329 | + "stickied": stickied, | |
| 330 | + "subreddit": subreddit, | |
| 331 | + "subreddit_id": subredditId, | |
| 332 | + "subreddit_name_prefixed": subredditNamePrefixed, | |
| 333 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 334 | + "suggested_sort": suggestedSort, | |
| 335 | + "thumbnail": thumbnail, | |
| 336 | + "thumbnail_height": thumbnailHeight, | |
| 337 | + "thumbnail_width": thumbnailWidth, | |
| 338 | + "title": title, | |
| 339 | + "ups": ups, | |
| 340 | + "url": url, | |
| 341 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 342 | + "view_count": viewCount, | |
| 343 | + "visited": visited, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +class Media { | |
| 348 | + final Oembed oembed; | |
| 349 | + final String type; | |
| 350 | + | |
| 351 | + Media({ | |
| 352 | + required this.oembed, | |
| 353 | + required this.type, | |
| 354 | + }); | |
| 355 | + | |
| 356 | + factory Media.fromJson(Map<String, dynamic> json) => Media( | |
| 357 | + oembed: Oembed.fromJson(json["oembed"]), | |
| 358 | + type: json["type"], | |
| 359 | + ); | |
| 360 | + | |
| 361 | + Map<String, dynamic> toJson() => { | |
| 362 | + "oembed": oembed.toJson(), | |
| 363 | + "type": type, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Oembed { | |
| 368 | + final String description; | |
| 369 | + final int height; | |
| 370 | + final String html; | |
| 371 | + final String providerName; | |
| 372 | + final String providerUrl; | |
| 373 | + final int thumbnailHeight; | |
| 374 | + final String thumbnailUrl; | |
| 375 | + final int thumbnailWidth; | |
| 376 | + final String title; | |
| 377 | + final String type; | |
| 378 | + final String version; | |
| 379 | + final int width; | |
| 380 | + | |
| 381 | + Oembed({ | |
| 382 | + required this.description, | |
| 383 | + required this.height, | |
| 384 | + required this.html, | |
| 385 | + required this.providerName, | |
| 386 | + required this.providerUrl, | |
| 387 | + required this.thumbnailHeight, | |
| 388 | + required this.thumbnailUrl, | |
| 389 | + required this.thumbnailWidth, | |
| 390 | + required this.title, | |
| 391 | + required this.type, | |
| 392 | + required this.version, | |
| 393 | + required this.width, | |
| 394 | + }); | |
| 395 | + | |
| 396 | + factory Oembed.fromJson(Map<String, dynamic> json) => Oembed( | |
| 397 | + description: json["description"], | |
| 398 | + height: json["height"], | |
| 399 | + html: json["html"], | |
| 400 | + providerName: json["provider_name"], | |
| 401 | + providerUrl: json["provider_url"], | |
| 402 | + thumbnailHeight: json["thumbnail_height"], | |
| 403 | + thumbnailUrl: json["thumbnail_url"], | |
| 404 | + thumbnailWidth: json["thumbnail_width"], | |
| 405 | + title: json["title"], | |
| 406 | + type: json["type"], | |
| 407 | + version: json["version"], | |
| 408 | + width: json["width"], | |
| 409 | + ); | |
| 410 | + | |
| 411 | + Map<String, dynamic> toJson() => { | |
| 412 | + "description": description, | |
| 413 | + "height": height, | |
| 414 | + "html": html, | |
| 415 | + "provider_name": providerName, | |
| 416 | + "provider_url": providerUrl, | |
| 417 | + "thumbnail_height": thumbnailHeight, | |
| 418 | + "thumbnail_url": thumbnailUrl, | |
| 419 | + "thumbnail_width": thumbnailWidth, | |
| 420 | + "title": title, | |
| 421 | + "type": type, | |
| 422 | + "version": version, | |
| 423 | + "width": width, | |
| 424 | + }; | |
| 425 | +} | |
| 426 | + | |
| 427 | +class MediaEmbed { | |
| 428 | + final String? content; | |
| 429 | + final int? height; | |
| 430 | + final bool? scrolling; | |
| 431 | + final int? width; | |
| 432 | + | |
| 433 | + MediaEmbed({ | |
| 434 | + this.content, | |
| 435 | + this.height, | |
| 436 | + this.scrolling, | |
| 437 | + this.width, | |
| 438 | + }); | |
| 439 | + | |
| 440 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 441 | + content: json["content"], | |
| 442 | + height: json["height"], | |
| 443 | + scrolling: json["scrolling"], | |
| 444 | + width: json["width"], | |
| 445 | + ); | |
| 446 | + | |
| 447 | + Map<String, dynamic> toJson() => { | |
| 448 | + "content": content, | |
| 449 | + "height": height, | |
| 450 | + "scrolling": scrolling, | |
| 451 | + "width": width, | |
| 452 | + }; | |
| 453 | +} | |
| 454 | + | |
| 455 | +enum PostHint { | |
| 456 | + LINK, | |
| 457 | + IMAGE, | |
| 458 | + RICH_VIDEO | |
| 459 | +} | |
| 460 | + | |
| 461 | +final postHintValues = EnumValues({ | |
| 462 | + "link": PostHint.LINK, | |
| 463 | + "image": PostHint.IMAGE, | |
| 464 | + "rich:video": PostHint.RICH_VIDEO | |
| 465 | +}); | |
| 466 | + | |
| 467 | +class Preview { | |
| 468 | + final bool enabled; | |
| 469 | + final List<Image> images; | |
| 470 | + | |
| 471 | + Preview({ | |
| 472 | + required this.enabled, | |
| 473 | + required this.images, | |
| 474 | + }); | |
| 475 | + | |
| 476 | + factory Preview.fromJson(Map<String, dynamic> json) => Preview( | |
| 477 | + enabled: json["enabled"], | |
| 478 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 479 | + ); | |
| 480 | + | |
| 481 | + Map<String, dynamic> toJson() => { | |
| 482 | + "enabled": enabled, | |
| 483 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 484 | + }; | |
| 485 | +} | |
| 486 | + | |
| 487 | +class Image { | |
| 488 | + final String id; | |
| 489 | + final List<Source> resolutions; | |
| 490 | + final Source source; | |
| 491 | + final Variants variants; | |
| 492 | + | |
| 493 | + Image({ | |
| 494 | + required this.id, | |
| 495 | + required this.resolutions, | |
| 496 | + required this.source, | |
| 497 | + required this.variants, | |
| 498 | + }); | |
| 499 | + | |
| 500 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 501 | + id: json["id"], | |
| 502 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 503 | + source: Source.fromJson(json["source"]), | |
| 504 | + variants: Variants.fromJson(json["variants"]), | |
| 505 | + ); | |
| 506 | + | |
| 507 | + Map<String, dynamic> toJson() => { | |
| 508 | + "id": id, | |
| 509 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 510 | + "source": source.toJson(), | |
| 511 | + "variants": variants.toJson(), | |
| 512 | + }; | |
| 513 | +} | |
| 514 | + | |
| 515 | +class Source { | |
| 516 | + final int height; | |
| 517 | + final String url; | |
| 518 | + final int width; | |
| 519 | + | |
| 520 | + Source({ | |
| 521 | + required this.height, | |
| 522 | + required this.url, | |
| 523 | + required this.width, | |
| 524 | + }); | |
| 525 | + | |
| 526 | + factory Source.fromJson(Map<String, dynamic> json) => Source( | |
| 527 | + height: json["height"], | |
| 528 | + url: json["url"], | |
| 529 | + width: json["width"], | |
| 530 | + ); | |
| 531 | + | |
| 532 | + Map<String, dynamic> toJson() => { | |
| 533 | + "height": height, | |
| 534 | + "url": url, | |
| 535 | + "width": width, | |
| 536 | + }; | |
| 537 | +} | |
| 538 | + | |
| 539 | +class Variants { | |
| 540 | + final Gif? gif; | |
| 541 | + final Gif? mp4; | |
| 542 | + final Gif? nsfw; | |
| 543 | + final Gif? obfuscated; | |
| 544 | + | |
| 545 | + Variants({ | |
| 546 | + this.gif, | |
| 547 | + this.mp4, | |
| 548 | + this.nsfw, | |
| 549 | + this.obfuscated, | |
| 550 | + }); | |
| 551 | + | |
| 552 | + factory Variants.fromJson(Map<String, dynamic> json) => Variants( | |
| 553 | + gif: json["gif"] == null ? null : Gif.fromJson(json["gif"]), | |
| 554 | + mp4: json["mp4"] == null ? null : Gif.fromJson(json["mp4"]), | |
| 555 | + nsfw: json["nsfw"] == null ? null : Gif.fromJson(json["nsfw"]), | |
| 556 | + obfuscated: json["obfuscated"] == null ? null : Gif.fromJson(json["obfuscated"]), | |
| 557 | + ); | |
| 558 | + | |
| 559 | + Map<String, dynamic> toJson() => { | |
| 560 | + "gif": gif?.toJson(), | |
| 561 | + "mp4": mp4?.toJson(), | |
| 562 | + "nsfw": nsfw?.toJson(), | |
| 563 | + "obfuscated": obfuscated?.toJson(), | |
| 564 | + }; | |
| 565 | +} | |
| 566 | + | |
| 567 | +class Gif { | |
| 568 | + final List<Source> resolutions; | |
| 569 | + final Source source; | |
| 570 | + | |
| 571 | + Gif({ | |
| 572 | + required this.resolutions, | |
| 573 | + required this.source, | |
| 574 | + }); | |
| 575 | + | |
| 576 | + factory Gif.fromJson(Map<String, dynamic> json) => Gif( | |
| 577 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 578 | + source: Source.fromJson(json["source"]), | |
| 579 | + ); | |
| 580 | + | |
| 581 | + Map<String, dynamic> toJson() => { | |
| 582 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 583 | + "source": source.toJson(), | |
| 584 | + }; | |
| 585 | +} | |
| 586 | + | |
| 587 | +enum SubredditType { | |
| 588 | + PUBLIC | |
| 589 | +} | |
| 590 | + | |
| 591 | +final subredditTypeValues = EnumValues({ | |
| 592 | + "public": SubredditType.PUBLIC | |
| 593 | +}); | |
| 594 | + | |
| 595 | +enum Kind { | |
| 596 | + T3 | |
| 597 | +} | |
| 598 | + | |
| 599 | +final kindValues = EnumValues({ | |
| 600 | + "t3": Kind.T3 | |
| 601 | +}); | |
| 602 | + | |
| 603 | +class EnumValues<T> { | |
| 604 | + Map<String, T> map; | |
| 605 | + late Map<T, String> reverseMap; | |
| 606 | + | |
| 607 | + EnumValues(this.map); | |
| 608 | + | |
| 609 | + Map<T, String> get reverse { | |
| 610 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 611 | + return reverseMap; | |
| 612 | + } | |
| 613 | +} |
Test case
1 generated file · +441 −0test/inputs/json/misc/6dec6.json
Adartdefault / TopLevel.dart+441 −0
| @@ -0,0 +1,441 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final Text text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: textValues.map[json["text"]]!, | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": textValues.reverse[text], | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +enum Text { | |
| 328 | + SHOWERS, | |
| 329 | + MOSTLY_SUNNY, | |
| 330 | + PARTLY_CLOUDY | |
| 331 | +} | |
| 332 | + | |
| 333 | +final textValues = EnumValues({ | |
| 334 | + "Showers": Text.SHOWERS, | |
| 335 | + "Mostly Sunny": Text.MOSTLY_SUNNY, | |
| 336 | + "Partly Cloudy": Text.PARTLY_CLOUDY | |
| 337 | +}); | |
| 338 | + | |
| 339 | +class Guid { | |
| 340 | + final String isPermaLink; | |
| 341 | + | |
| 342 | + Guid({ | |
| 343 | + required this.isPermaLink, | |
| 344 | + }); | |
| 345 | + | |
| 346 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 347 | + isPermaLink: json["isPermaLink"], | |
| 348 | + ); | |
| 349 | + | |
| 350 | + Map<String, dynamic> toJson() => { | |
| 351 | + "isPermaLink": isPermaLink, | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +class Location { | |
| 356 | + final String city; | |
| 357 | + final String country; | |
| 358 | + final String region; | |
| 359 | + | |
| 360 | + Location({ | |
| 361 | + required this.city, | |
| 362 | + required this.country, | |
| 363 | + required this.region, | |
| 364 | + }); | |
| 365 | + | |
| 366 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 367 | + city: json["city"], | |
| 368 | + country: json["country"], | |
| 369 | + region: json["region"], | |
| 370 | + ); | |
| 371 | + | |
| 372 | + Map<String, dynamic> toJson() => { | |
| 373 | + "city": city, | |
| 374 | + "country": country, | |
| 375 | + "region": region, | |
| 376 | + }; | |
| 377 | +} | |
| 378 | + | |
| 379 | +class Units { | |
| 380 | + final String distance; | |
| 381 | + final String pressure; | |
| 382 | + final String speed; | |
| 383 | + final String temperature; | |
| 384 | + | |
| 385 | + Units({ | |
| 386 | + required this.distance, | |
| 387 | + required this.pressure, | |
| 388 | + required this.speed, | |
| 389 | + required this.temperature, | |
| 390 | + }); | |
| 391 | + | |
| 392 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 393 | + distance: json["distance"], | |
| 394 | + pressure: json["pressure"], | |
| 395 | + speed: json["speed"], | |
| 396 | + temperature: json["temperature"], | |
| 397 | + ); | |
| 398 | + | |
| 399 | + Map<String, dynamic> toJson() => { | |
| 400 | + "distance": distance, | |
| 401 | + "pressure": pressure, | |
| 402 | + "speed": speed, | |
| 403 | + "temperature": temperature, | |
| 404 | + }; | |
| 405 | +} | |
| 406 | + | |
| 407 | +class Wind { | |
| 408 | + final String chill; | |
| 409 | + final String direction; | |
| 410 | + final String speed; | |
| 411 | + | |
| 412 | + Wind({ | |
| 413 | + required this.chill, | |
| 414 | + required this.direction, | |
| 415 | + required this.speed, | |
| 416 | + }); | |
| 417 | + | |
| 418 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 419 | + chill: json["chill"], | |
| 420 | + direction: json["direction"], | |
| 421 | + speed: json["speed"], | |
| 422 | + ); | |
| 423 | + | |
| 424 | + Map<String, dynamic> toJson() => { | |
| 425 | + "chill": chill, | |
| 426 | + "direction": direction, | |
| 427 | + "speed": speed, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class EnumValues<T> { | |
| 432 | + Map<String, T> map; | |
| 433 | + late Map<T, String> reverseMap; | |
| 434 | + | |
| 435 | + EnumValues(this.map); | |
| 436 | + | |
| 437 | + Map<T, String> get reverse { | |
| 438 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 439 | + return reverseMap; | |
| 440 | + } | |
| 441 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/6eb00.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int directorateId; | |
| 13 | + final int id; | |
| 14 | + final String name; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.directorateId, | |
| 18 | + required this.id, | |
| 19 | + required this.name, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + directorateId: json["DirectorateID"], | |
| 24 | + id: json["Id"], | |
| 25 | + name: json["Name"], | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "DirectorateID": directorateId, | |
| 30 | + "Id": id, | |
| 31 | + "Name": name, | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/70c77.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +325 −0test/inputs/json/misc/734ad.json
Adartdefault / TopLevel.dart+325 −0
| @@ -0,0 +1,325 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final String next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final String? acronym; | |
| 63 | + final String activityConsultCommittees; | |
| 64 | + final String activityEuLegislative; | |
| 65 | + final String activityExpertGroups; | |
| 66 | + final String activityHighLevelGroups; | |
| 67 | + final String activityIndustryForums; | |
| 68 | + final String activityInterGroups; | |
| 69 | + final String? activityOther; | |
| 70 | + final String activityRelevantComm; | |
| 71 | + final String? beOfficeCountry; | |
| 72 | + final double? beOfficeLat; | |
| 73 | + final double? beOfficeLon; | |
| 74 | + final String? beOfficePhone; | |
| 75 | + final String? beOfficePostCode; | |
| 76 | + final String? beOfficePostbox; | |
| 77 | + final String? beOfficeStreet; | |
| 78 | + final String? beOfficeTown; | |
| 79 | + final String codeOfConduct; | |
| 80 | + final int contactCountry; | |
| 81 | + final DateTime createdAt; | |
| 82 | + final String entity; | |
| 83 | + final String goals; | |
| 84 | + final String head; | |
| 85 | + final String headOfficeCountry; | |
| 86 | + final double? headOfficeLat; | |
| 87 | + final double? headOfficeLon; | |
| 88 | + final String headOfficePhone; | |
| 89 | + final String? headOfficePostCode; | |
| 90 | + final String? headOfficePostbox; | |
| 91 | + final String headOfficeStreet; | |
| 92 | + final String headOfficeTown; | |
| 93 | + final String id; | |
| 94 | + final String identificationCode; | |
| 95 | + final String infoMembers; | |
| 96 | + final DateTime lastUpdateDate; | |
| 97 | + final String legal; | |
| 98 | + final String legalStatus; | |
| 99 | + final int mainCategory; | |
| 100 | + final String mainCategoryTitle; | |
| 101 | + final int members; | |
| 102 | + final int? members100; | |
| 103 | + final int? members25; | |
| 104 | + final int? members50; | |
| 105 | + final int? members75; | |
| 106 | + final double membersFte; | |
| 107 | + final String name; | |
| 108 | + final dynamic nativeName; | |
| 109 | + final String? networking; | |
| 110 | + final int? numberOfNaturalPersons; | |
| 111 | + final String? otherCodeOfConduct; | |
| 112 | + final DateTime registrationDate; | |
| 113 | + final Status status; | |
| 114 | + final String structureMembers; | |
| 115 | + final int subCategory; | |
| 116 | + final String subCategoryTitle; | |
| 117 | + final DateTime updatedAt; | |
| 118 | + final String uri; | |
| 119 | + final String? webSiteUrl; | |
| 120 | + | |
| 121 | + Result({ | |
| 122 | + required this.acronym, | |
| 123 | + required this.activityConsultCommittees, | |
| 124 | + required this.activityEuLegislative, | |
| 125 | + required this.activityExpertGroups, | |
| 126 | + required this.activityHighLevelGroups, | |
| 127 | + required this.activityIndustryForums, | |
| 128 | + required this.activityInterGroups, | |
| 129 | + required this.activityOther, | |
| 130 | + required this.activityRelevantComm, | |
| 131 | + this.beOfficeCountry, | |
| 132 | + this.beOfficeLat, | |
| 133 | + this.beOfficeLon, | |
| 134 | + this.beOfficePhone, | |
| 135 | + this.beOfficePostCode, | |
| 136 | + this.beOfficePostbox, | |
| 137 | + this.beOfficeStreet, | |
| 138 | + this.beOfficeTown, | |
| 139 | + required this.codeOfConduct, | |
| 140 | + required this.contactCountry, | |
| 141 | + required this.createdAt, | |
| 142 | + required this.entity, | |
| 143 | + required this.goals, | |
| 144 | + required this.head, | |
| 145 | + required this.headOfficeCountry, | |
| 146 | + required this.headOfficeLat, | |
| 147 | + required this.headOfficeLon, | |
| 148 | + required this.headOfficePhone, | |
| 149 | + required this.headOfficePostCode, | |
| 150 | + required this.headOfficePostbox, | |
| 151 | + required this.headOfficeStreet, | |
| 152 | + required this.headOfficeTown, | |
| 153 | + required this.id, | |
| 154 | + required this.identificationCode, | |
| 155 | + required this.infoMembers, | |
| 156 | + required this.lastUpdateDate, | |
| 157 | + required this.legal, | |
| 158 | + required this.legalStatus, | |
| 159 | + required this.mainCategory, | |
| 160 | + required this.mainCategoryTitle, | |
| 161 | + required this.members, | |
| 162 | + required this.members100, | |
| 163 | + required this.members25, | |
| 164 | + required this.members50, | |
| 165 | + required this.members75, | |
| 166 | + required this.membersFte, | |
| 167 | + required this.name, | |
| 168 | + required this.nativeName, | |
| 169 | + required this.networking, | |
| 170 | + required this.numberOfNaturalPersons, | |
| 171 | + required this.otherCodeOfConduct, | |
| 172 | + required this.registrationDate, | |
| 173 | + required this.status, | |
| 174 | + required this.structureMembers, | |
| 175 | + required this.subCategory, | |
| 176 | + required this.subCategoryTitle, | |
| 177 | + required this.updatedAt, | |
| 178 | + required this.uri, | |
| 179 | + required this.webSiteUrl, | |
| 180 | + }); | |
| 181 | + | |
| 182 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 183 | + acronym: json["acronym"], | |
| 184 | + activityConsultCommittees: json["activity_consult_committees"], | |
| 185 | + activityEuLegislative: json["activity_eu_legislative"], | |
| 186 | + activityExpertGroups: json["activity_expert_groups"], | |
| 187 | + activityHighLevelGroups: json["activity_high_level_groups"], | |
| 188 | + activityIndustryForums: json["activity_industry_forums"], | |
| 189 | + activityInterGroups: json["activity_inter_groups"], | |
| 190 | + activityOther: json["activity_other"], | |
| 191 | + activityRelevantComm: json["activity_relevant_comm"], | |
| 192 | + beOfficeCountry: json["be_office_country"], | |
| 193 | + beOfficeLat: json["be_office_lat"]?.toDouble(), | |
| 194 | + beOfficeLon: json["be_office_lon"]?.toDouble(), | |
| 195 | + beOfficePhone: json["be_office_phone"], | |
| 196 | + beOfficePostCode: json["be_office_post_code"], | |
| 197 | + beOfficePostbox: json["be_office_postbox"], | |
| 198 | + beOfficeStreet: json["be_office_street"], | |
| 199 | + beOfficeTown: json["be_office_town"], | |
| 200 | + codeOfConduct: json["code_of_conduct"], | |
| 201 | + contactCountry: json["contact_country"], | |
| 202 | + createdAt: DateTime.parse(json["created_at"]), | |
| 203 | + entity: json["entity"], | |
| 204 | + goals: json["goals"], | |
| 205 | + head: json["head"], | |
| 206 | + headOfficeCountry: json["head_office_country"], | |
| 207 | + headOfficeLat: json["head_office_lat"]?.toDouble(), | |
| 208 | + headOfficeLon: json["head_office_lon"]?.toDouble(), | |
| 209 | + headOfficePhone: json["head_office_phone"], | |
| 210 | + headOfficePostCode: json["head_office_post_code"], | |
| 211 | + headOfficePostbox: json["head_office_postbox"], | |
| 212 | + headOfficeStreet: json["head_office_street"], | |
| 213 | + headOfficeTown: json["head_office_town"], | |
| 214 | + id: json["id"], | |
| 215 | + identificationCode: json["identification_code"], | |
| 216 | + infoMembers: json["info_members"], | |
| 217 | + lastUpdateDate: DateTime.parse(json["last_update_date"]), | |
| 218 | + legal: json["legal"], | |
| 219 | + legalStatus: json["legal_status"], | |
| 220 | + mainCategory: json["main_category"], | |
| 221 | + mainCategoryTitle: json["main_category_title"], | |
| 222 | + members: json["members"], | |
| 223 | + members100: json["members_100"], | |
| 224 | + members25: json["members_25"], | |
| 225 | + members50: json["members_50"], | |
| 226 | + members75: json["members_75"], | |
| 227 | + membersFte: json["members_fte"]?.toDouble(), | |
| 228 | + name: json["name"], | |
| 229 | + nativeName: json["native_name"], | |
| 230 | + networking: json["networking"], | |
| 231 | + numberOfNaturalPersons: json["number_of_natural_persons"], | |
| 232 | + otherCodeOfConduct: json["other_code_of_conduct"], | |
| 233 | + registrationDate: DateTime.parse(json["registration_date"]), | |
| 234 | + status: statusValues.map[json["status"]]!, | |
| 235 | + structureMembers: json["structure_members"], | |
| 236 | + subCategory: json["sub_category"], | |
| 237 | + subCategoryTitle: json["sub_category_title"], | |
| 238 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 239 | + uri: json["uri"], | |
| 240 | + webSiteUrl: json["web_site_url"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "acronym": acronym, | |
| 245 | + "activity_consult_committees": activityConsultCommittees, | |
| 246 | + "activity_eu_legislative": activityEuLegislative, | |
| 247 | + "activity_expert_groups": activityExpertGroups, | |
| 248 | + "activity_high_level_groups": activityHighLevelGroups, | |
| 249 | + "activity_industry_forums": activityIndustryForums, | |
| 250 | + "activity_inter_groups": activityInterGroups, | |
| 251 | + "activity_other": activityOther, | |
| 252 | + "activity_relevant_comm": activityRelevantComm, | |
| 253 | + "be_office_country": beOfficeCountry, | |
| 254 | + "be_office_lat": beOfficeLat, | |
| 255 | + "be_office_lon": beOfficeLon, | |
| 256 | + "be_office_phone": beOfficePhone, | |
| 257 | + "be_office_post_code": beOfficePostCode, | |
| 258 | + "be_office_postbox": beOfficePostbox, | |
| 259 | + "be_office_street": beOfficeStreet, | |
| 260 | + "be_office_town": beOfficeTown, | |
| 261 | + "code_of_conduct": codeOfConduct, | |
| 262 | + "contact_country": contactCountry, | |
| 263 | + "created_at": createdAt.toIso8601String(), | |
| 264 | + "entity": entity, | |
| 265 | + "goals": goals, | |
| 266 | + "head": head, | |
| 267 | + "head_office_country": headOfficeCountry, | |
| 268 | + "head_office_lat": headOfficeLat, | |
| 269 | + "head_office_lon": headOfficeLon, | |
| 270 | + "head_office_phone": headOfficePhone, | |
| 271 | + "head_office_post_code": headOfficePostCode, | |
| 272 | + "head_office_postbox": headOfficePostbox, | |
| 273 | + "head_office_street": headOfficeStreet, | |
| 274 | + "head_office_town": headOfficeTown, | |
| 275 | + "id": id, | |
| 276 | + "identification_code": identificationCode, | |
| 277 | + "info_members": infoMembers, | |
| 278 | + "last_update_date": lastUpdateDate.toIso8601String(), | |
| 279 | + "legal": legal, | |
| 280 | + "legal_status": legalStatus, | |
| 281 | + "main_category": mainCategory, | |
| 282 | + "main_category_title": mainCategoryTitle, | |
| 283 | + "members": members, | |
| 284 | + "members_100": members100, | |
| 285 | + "members_25": members25, | |
| 286 | + "members_50": members50, | |
| 287 | + "members_75": members75, | |
| 288 | + "members_fte": membersFte, | |
| 289 | + "name": name, | |
| 290 | + "native_name": nativeName, | |
| 291 | + "networking": networking, | |
| 292 | + "number_of_natural_persons": numberOfNaturalPersons, | |
| 293 | + "other_code_of_conduct": otherCodeOfConduct, | |
| 294 | + "registration_date": registrationDate.toIso8601String(), | |
| 295 | + "status": statusValues.reverse[status], | |
| 296 | + "structure_members": structureMembers, | |
| 297 | + "sub_category": subCategory, | |
| 298 | + "sub_category_title": subCategoryTitle, | |
| 299 | + "updated_at": updatedAt.toIso8601String(), | |
| 300 | + "uri": uri, | |
| 301 | + "web_site_url": webSiteUrl, | |
| 302 | + }; | |
| 303 | +} | |
| 304 | + | |
| 305 | +enum Status { | |
| 306 | + ACTIVE, | |
| 307 | + INACTIVE | |
| 308 | +} | |
| 309 | + | |
| 310 | +final statusValues = EnumValues({ | |
| 311 | + "active": Status.ACTIVE, | |
| 312 | + "inactive": Status.INACTIVE | |
| 313 | +}); | |
| 314 | + | |
| 315 | +class EnumValues<T> { | |
| 316 | + Map<String, T> map; | |
| 317 | + late Map<T, String> reverseMap; | |
| 318 | + | |
| 319 | + EnumValues(this.map); | |
| 320 | + | |
| 321 | + Map<T, String> get reverse { | |
| 322 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 323 | + return reverseMap; | |
| 324 | + } | |
| 325 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/75912.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +479 −0test/inputs/json/misc/7681c.json
Adartdefault / TopLevel.dart+479 −0
| @@ -0,0 +1,479 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final Username username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: usernameValues.map[json["username"]]!, | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": usernameValues.reverse[username], | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final Looping looping; | |
| 136 | + final FixedHeight original; | |
| 137 | + final DownsizedSmall originalMp4; | |
| 138 | + final Downsized originalStill; | |
| 139 | + final DownsizedSmall preview; | |
| 140 | + final Downsized previewGif; | |
| 141 | + final Downsized previewWebp; | |
| 142 | + final Downsized? the480WStill; | |
| 143 | + | |
| 144 | + Images({ | |
| 145 | + required this.downsized, | |
| 146 | + required this.downsizedLarge, | |
| 147 | + required this.downsizedMedium, | |
| 148 | + required this.downsizedSmall, | |
| 149 | + required this.downsizedStill, | |
| 150 | + required this.fixedHeight, | |
| 151 | + required this.fixedHeightDownsampled, | |
| 152 | + required this.fixedHeightSmall, | |
| 153 | + required this.fixedHeightSmallStill, | |
| 154 | + required this.fixedHeightStill, | |
| 155 | + required this.fixedWidth, | |
| 156 | + required this.fixedWidthDownsampled, | |
| 157 | + required this.fixedWidthSmall, | |
| 158 | + required this.fixedWidthSmallStill, | |
| 159 | + required this.fixedWidthStill, | |
| 160 | + required this.looping, | |
| 161 | + required this.original, | |
| 162 | + required this.originalMp4, | |
| 163 | + required this.originalStill, | |
| 164 | + required this.preview, | |
| 165 | + required this.previewGif, | |
| 166 | + required this.previewWebp, | |
| 167 | + this.the480WStill, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 171 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 172 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 173 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 174 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 175 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 176 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 177 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 178 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 179 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 180 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 181 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 182 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 183 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 184 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 185 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 186 | + looping: Looping.fromJson(json["looping"]), | |
| 187 | + original: FixedHeight.fromJson(json["original"]), | |
| 188 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 189 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 190 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 191 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 192 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 193 | + the480WStill: json["480w_still"] == null ? null : Downsized.fromJson(json["480w_still"]), | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "downsized": downsized.toJson(), | |
| 198 | + "downsized_large": downsizedLarge.toJson(), | |
| 199 | + "downsized_medium": downsizedMedium.toJson(), | |
| 200 | + "downsized_small": downsizedSmall.toJson(), | |
| 201 | + "downsized_still": downsizedStill.toJson(), | |
| 202 | + "fixed_height": fixedHeight.toJson(), | |
| 203 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 204 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 205 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 206 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 207 | + "fixed_width": fixedWidth.toJson(), | |
| 208 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 209 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 210 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 211 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 212 | + "looping": looping.toJson(), | |
| 213 | + "original": original.toJson(), | |
| 214 | + "original_mp4": originalMp4.toJson(), | |
| 215 | + "original_still": originalStill.toJson(), | |
| 216 | + "preview": preview.toJson(), | |
| 217 | + "preview_gif": previewGif.toJson(), | |
| 218 | + "preview_webp": previewWebp.toJson(), | |
| 219 | + "480w_still": the480WStill?.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Downsized { | |
| 224 | + final String height; | |
| 225 | + final String? size; | |
| 226 | + final String url; | |
| 227 | + final String width; | |
| 228 | + | |
| 229 | + Downsized({ | |
| 230 | + required this.height, | |
| 231 | + this.size, | |
| 232 | + required this.url, | |
| 233 | + required this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 237 | + height: json["height"], | |
| 238 | + size: json["size"], | |
| 239 | + url: json["url"], | |
| 240 | + width: json["width"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "height": height, | |
| 245 | + "size": size, | |
| 246 | + "url": url, | |
| 247 | + "width": width, | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +class DownsizedSmall { | |
| 252 | + final String height; | |
| 253 | + final String mp4; | |
| 254 | + final String mp4Size; | |
| 255 | + final String width; | |
| 256 | + | |
| 257 | + DownsizedSmall({ | |
| 258 | + required this.height, | |
| 259 | + required this.mp4, | |
| 260 | + required this.mp4Size, | |
| 261 | + required this.width, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 265 | + height: json["height"], | |
| 266 | + mp4: json["mp4"], | |
| 267 | + mp4Size: json["mp4_size"], | |
| 268 | + width: json["width"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "height": height, | |
| 273 | + "mp4": mp4, | |
| 274 | + "mp4_size": mp4Size, | |
| 275 | + "width": width, | |
| 276 | + }; | |
| 277 | +} | |
| 278 | + | |
| 279 | +class FixedHeight { | |
| 280 | + final String? frames; | |
| 281 | + final String? hash; | |
| 282 | + final String height; | |
| 283 | + final String? mp4; | |
| 284 | + final String? mp4Size; | |
| 285 | + final String size; | |
| 286 | + final String url; | |
| 287 | + final String webp; | |
| 288 | + final String webpSize; | |
| 289 | + final String width; | |
| 290 | + | |
| 291 | + FixedHeight({ | |
| 292 | + this.frames, | |
| 293 | + this.hash, | |
| 294 | + required this.height, | |
| 295 | + this.mp4, | |
| 296 | + this.mp4Size, | |
| 297 | + required this.size, | |
| 298 | + required this.url, | |
| 299 | + required this.webp, | |
| 300 | + required this.webpSize, | |
| 301 | + required this.width, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 305 | + frames: json["frames"], | |
| 306 | + hash: json["hash"], | |
| 307 | + height: json["height"], | |
| 308 | + mp4: json["mp4"], | |
| 309 | + mp4Size: json["mp4_size"], | |
| 310 | + size: json["size"], | |
| 311 | + url: json["url"], | |
| 312 | + webp: json["webp"], | |
| 313 | + webpSize: json["webp_size"], | |
| 314 | + width: json["width"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "frames": frames, | |
| 319 | + "hash": hash, | |
| 320 | + "height": height, | |
| 321 | + "mp4": mp4, | |
| 322 | + "mp4_size": mp4Size, | |
| 323 | + "size": size, | |
| 324 | + "url": url, | |
| 325 | + "webp": webp, | |
| 326 | + "webp_size": webpSize, | |
| 327 | + "width": width, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class Looping { | |
| 332 | + final String mp4; | |
| 333 | + final String mp4Size; | |
| 334 | + | |
| 335 | + Looping({ | |
| 336 | + required this.mp4, | |
| 337 | + required this.mp4Size, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 341 | + mp4: json["mp4"], | |
| 342 | + mp4Size: json["mp4_size"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "mp4": mp4, | |
| 347 | + "mp4_size": mp4Size, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +enum Rating { | |
| 352 | + G, | |
| 353 | + PG, | |
| 354 | + PG_13 | |
| 355 | +} | |
| 356 | + | |
| 357 | +final ratingValues = EnumValues({ | |
| 358 | + "g": Rating.G, | |
| 359 | + "pg": Rating.PG, | |
| 360 | + "pg-13": Rating.PG_13 | |
| 361 | +}); | |
| 362 | + | |
| 363 | +enum Type { | |
| 364 | + GIF | |
| 365 | +} | |
| 366 | + | |
| 367 | +final typeValues = EnumValues({ | |
| 368 | + "gif": Type.GIF | |
| 369 | +}); | |
| 370 | + | |
| 371 | +class User { | |
| 372 | + final String avatarUrl; | |
| 373 | + final String bannerUrl; | |
| 374 | + final String displayName; | |
| 375 | + final String profileUrl; | |
| 376 | + final String? twitter; | |
| 377 | + final String username; | |
| 378 | + | |
| 379 | + User({ | |
| 380 | + required this.avatarUrl, | |
| 381 | + required this.bannerUrl, | |
| 382 | + required this.displayName, | |
| 383 | + required this.profileUrl, | |
| 384 | + this.twitter, | |
| 385 | + required this.username, | |
| 386 | + }); | |
| 387 | + | |
| 388 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 389 | + avatarUrl: json["avatar_url"], | |
| 390 | + bannerUrl: json["banner_url"], | |
| 391 | + displayName: json["display_name"], | |
| 392 | + profileUrl: json["profile_url"], | |
| 393 | + twitter: json["twitter"], | |
| 394 | + username: json["username"], | |
| 395 | + ); | |
| 396 | + | |
| 397 | + Map<String, dynamic> toJson() => { | |
| 398 | + "avatar_url": avatarUrl, | |
| 399 | + "banner_url": bannerUrl, | |
| 400 | + "display_name": displayName, | |
| 401 | + "profile_url": profileUrl, | |
| 402 | + "twitter": twitter, | |
| 403 | + "username": username, | |
| 404 | + }; | |
| 405 | +} | |
| 406 | + | |
| 407 | +enum Username { | |
| 408 | + EMPTY, | |
| 409 | + MASHABLE, | |
| 410 | + NBA, | |
| 411 | + ORIGINALS | |
| 412 | +} | |
| 413 | + | |
| 414 | +final usernameValues = EnumValues({ | |
| 415 | + "": Username.EMPTY, | |
| 416 | + "mashable": Username.MASHABLE, | |
| 417 | + "nba": Username.NBA, | |
| 418 | + "Originals": Username.ORIGINALS | |
| 419 | +}); | |
| 420 | + | |
| 421 | +class Meta { | |
| 422 | + final String msg; | |
| 423 | + final String responseId; | |
| 424 | + final int status; | |
| 425 | + | |
| 426 | + Meta({ | |
| 427 | + required this.msg, | |
| 428 | + required this.responseId, | |
| 429 | + required this.status, | |
| 430 | + }); | |
| 431 | + | |
| 432 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 433 | + msg: json["msg"], | |
| 434 | + responseId: json["response_id"], | |
| 435 | + status: json["status"], | |
| 436 | + ); | |
| 437 | + | |
| 438 | + Map<String, dynamic> toJson() => { | |
| 439 | + "msg": msg, | |
| 440 | + "response_id": responseId, | |
| 441 | + "status": status, | |
| 442 | + }; | |
| 443 | +} | |
| 444 | + | |
| 445 | +class Pagination { | |
| 446 | + final int count; | |
| 447 | + final int offset; | |
| 448 | + final int totalCount; | |
| 449 | + | |
| 450 | + Pagination({ | |
| 451 | + required this.count, | |
| 452 | + required this.offset, | |
| 453 | + required this.totalCount, | |
| 454 | + }); | |
| 455 | + | |
| 456 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 457 | + count: json["count"], | |
| 458 | + offset: json["offset"], | |
| 459 | + totalCount: json["total_count"], | |
| 460 | + ); | |
| 461 | + | |
| 462 | + Map<String, dynamic> toJson() => { | |
| 463 | + "count": count, | |
| 464 | + "offset": offset, | |
| 465 | + "total_count": totalCount, | |
| 466 | + }; | |
| 467 | +} | |
| 468 | + | |
| 469 | +class EnumValues<T> { | |
| 470 | + Map<String, T> map; | |
| 471 | + late Map<T, String> reverseMap; | |
| 472 | + | |
| 473 | + EnumValues(this.map); | |
| 474 | + | |
| 475 | + Map<T, String> get reverse { | |
| 476 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 477 | + return reverseMap; | |
| 478 | + } | |
| 479 | +} |
Test case
1 generated file · +761 −0test/inputs/json/misc/76ae1.json
Adartdefault / TopLevel.dart+761 −0
| @@ -0,0 +1,761 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String basePath; | |
| 13 | + final Definitions definitions; | |
| 14 | + final String host; | |
| 15 | + final Info info; | |
| 16 | + final Paths paths; | |
| 17 | + final List<String> produces; | |
| 18 | + final List<String> schemes; | |
| 19 | + final String swagger; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.basePath, | |
| 23 | + required this.definitions, | |
| 24 | + required this.host, | |
| 25 | + required this.info, | |
| 26 | + required this.paths, | |
| 27 | + required this.produces, | |
| 28 | + required this.schemes, | |
| 29 | + required this.swagger, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + basePath: json["basePath"], | |
| 34 | + definitions: Definitions.fromJson(json["definitions"]), | |
| 35 | + host: json["host"], | |
| 36 | + info: Info.fromJson(json["info"]), | |
| 37 | + paths: Paths.fromJson(json["paths"]), | |
| 38 | + produces: List<String>.from(json["produces"].map((x) => x)), | |
| 39 | + schemes: List<String>.from(json["schemes"].map((x) => x)), | |
| 40 | + swagger: json["swagger"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "basePath": basePath, | |
| 45 | + "definitions": definitions.toJson(), | |
| 46 | + "host": host, | |
| 47 | + "info": info.toJson(), | |
| 48 | + "paths": paths.toJson(), | |
| 49 | + "produces": List<dynamic>.from(produces.map((x) => x)), | |
| 50 | + "schemes": List<dynamic>.from(schemes.map((x) => x)), | |
| 51 | + "swagger": swagger, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Definitions { | |
| 56 | + final Article article; | |
| 57 | + final Article center; | |
| 58 | + final DeMinimis deMinimis; | |
| 59 | + final Article event; | |
| 60 | + final Faq faq; | |
| 61 | + final Article lead; | |
| 62 | + final Article list; | |
| 63 | + final Article marketIntelligence; | |
| 64 | + final Article office; | |
| 65 | + final Article provider; | |
| 66 | + final Article rate; | |
| 67 | + final Report report; | |
| 68 | + final Taxonomy taxonomy; | |
| 69 | + | |
| 70 | + Definitions({ | |
| 71 | + required this.article, | |
| 72 | + required this.center, | |
| 73 | + required this.deMinimis, | |
| 74 | + required this.event, | |
| 75 | + required this.faq, | |
| 76 | + required this.lead, | |
| 77 | + required this.list, | |
| 78 | + required this.marketIntelligence, | |
| 79 | + required this.office, | |
| 80 | + required this.provider, | |
| 81 | + required this.rate, | |
| 82 | + required this.report, | |
| 83 | + required this.taxonomy, | |
| 84 | + }); | |
| 85 | + | |
| 86 | + factory Definitions.fromJson(Map<String, dynamic> json) => Definitions( | |
| 87 | + article: Article.fromJson(json["Article"]), | |
| 88 | + center: Article.fromJson(json["Center"]), | |
| 89 | + deMinimis: DeMinimis.fromJson(json["DeMinimis"]), | |
| 90 | + event: Article.fromJson(json["Event"]), | |
| 91 | + faq: Faq.fromJson(json["FAQ"]), | |
| 92 | + lead: Article.fromJson(json["Lead"]), | |
| 93 | + list: Article.fromJson(json["List"]), | |
| 94 | + marketIntelligence: Article.fromJson(json["MarketIntelligence"]), | |
| 95 | + office: Article.fromJson(json["Office"]), | |
| 96 | + provider: Article.fromJson(json["Provider"]), | |
| 97 | + rate: Article.fromJson(json["Rate"]), | |
| 98 | + report: Report.fromJson(json["Report"]), | |
| 99 | + taxonomy: Taxonomy.fromJson(json["Taxonomy"]), | |
| 100 | + ); | |
| 101 | + | |
| 102 | + Map<String, dynamic> toJson() => { | |
| 103 | + "Article": article.toJson(), | |
| 104 | + "Center": center.toJson(), | |
| 105 | + "DeMinimis": deMinimis.toJson(), | |
| 106 | + "Event": event.toJson(), | |
| 107 | + "FAQ": faq.toJson(), | |
| 108 | + "Lead": lead.toJson(), | |
| 109 | + "List": list.toJson(), | |
| 110 | + "MarketIntelligence": marketIntelligence.toJson(), | |
| 111 | + "Office": office.toJson(), | |
| 112 | + "Provider": provider.toJson(), | |
| 113 | + "Rate": rate.toJson(), | |
| 114 | + "Report": report.toJson(), | |
| 115 | + "Taxonomy": taxonomy.toJson(), | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Article { | |
| 120 | + final Map<String, Property> properties; | |
| 121 | + | |
| 122 | + Article({ | |
| 123 | + required this.properties, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory Article.fromJson(Map<String, dynamic> json) => Article( | |
| 127 | + properties: Map.from(json["properties"]).map((k, v) => MapEntry<String, Property>(k, Property.fromJson(v))), | |
| 128 | + ); | |
| 129 | + | |
| 130 | + Map<String, dynamic> toJson() => { | |
| 131 | + "properties": Map.from(properties).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Property { | |
| 136 | + final String description; | |
| 137 | + final FormatEnum type; | |
| 138 | + | |
| 139 | + Property({ | |
| 140 | + required this.description, | |
| 141 | + required this.type, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Property.fromJson(Map<String, dynamic> json) => Property( | |
| 145 | + description: json["description"], | |
| 146 | + type: formatEnumValues.map[json["type"]]!, | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "description": description, | |
| 151 | + "type": formatEnumValues.reverse[type], | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +enum FormatEnum { | |
| 156 | + STRING | |
| 157 | +} | |
| 158 | + | |
| 159 | +final formatEnumValues = EnumValues({ | |
| 160 | + "string": FormatEnum.STRING | |
| 161 | +}); | |
| 162 | + | |
| 163 | +class DeMinimis { | |
| 164 | + final DeMinimisProperties properties; | |
| 165 | + | |
| 166 | + DeMinimis({ | |
| 167 | + required this.properties, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory DeMinimis.fromJson(Map<String, dynamic> json) => DeMinimis( | |
| 171 | + properties: DeMinimisProperties.fromJson(json["properties"]), | |
| 172 | + ); | |
| 173 | + | |
| 174 | + Map<String, dynamic> toJson() => { | |
| 175 | + "properties": properties.toJson(), | |
| 176 | + }; | |
| 177 | +} | |
| 178 | + | |
| 179 | +class DeMinimisProperties { | |
| 180 | + final Property countries; | |
| 181 | + final Property country; | |
| 182 | + final Property deMinimisCurrency; | |
| 183 | + final Property deMinimisValue; | |
| 184 | + final Property notes; | |
| 185 | + final Property vatAmount; | |
| 186 | + final Property vatCurrency; | |
| 187 | + | |
| 188 | + DeMinimisProperties({ | |
| 189 | + required this.countries, | |
| 190 | + required this.country, | |
| 191 | + required this.deMinimisCurrency, | |
| 192 | + required this.deMinimisValue, | |
| 193 | + required this.notes, | |
| 194 | + required this.vatAmount, | |
| 195 | + required this.vatCurrency, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory DeMinimisProperties.fromJson(Map<String, dynamic> json) => DeMinimisProperties( | |
| 199 | + countries: Property.fromJson(json["countries"]), | |
| 200 | + country: Property.fromJson(json["country"]), | |
| 201 | + deMinimisCurrency: Property.fromJson(json["de_minimis_currency"]), | |
| 202 | + deMinimisValue: Property.fromJson(json["de_minimis_value"]), | |
| 203 | + notes: Property.fromJson(json["notes"]), | |
| 204 | + vatAmount: Property.fromJson(json["vat_amount"]), | |
| 205 | + vatCurrency: Property.fromJson(json["vat_currency"]), | |
| 206 | + ); | |
| 207 | + | |
| 208 | + Map<String, dynamic> toJson() => { | |
| 209 | + "countries": countries.toJson(), | |
| 210 | + "country": country.toJson(), | |
| 211 | + "de_minimis_currency": deMinimisCurrency.toJson(), | |
| 212 | + "de_minimis_value": deMinimisValue.toJson(), | |
| 213 | + "notes": notes.toJson(), | |
| 214 | + "vat_amount": vatAmount.toJson(), | |
| 215 | + "vat_currency": vatCurrency.toJson(), | |
| 216 | + }; | |
| 217 | +} | |
| 218 | + | |
| 219 | +class Faq { | |
| 220 | + final FaqProperties properties; | |
| 221 | + | |
| 222 | + Faq({ | |
| 223 | + required this.properties, | |
| 224 | + }); | |
| 225 | + | |
| 226 | + factory Faq.fromJson(Map<String, dynamic> json) => Faq( | |
| 227 | + properties: FaqProperties.fromJson(json["properties"]), | |
| 228 | + ); | |
| 229 | + | |
| 230 | + Map<String, dynamic> toJson() => { | |
| 231 | + "properties": properties.toJson(), | |
| 232 | + }; | |
| 233 | +} | |
| 234 | + | |
| 235 | +class FaqProperties { | |
| 236 | + final Property answer; | |
| 237 | + final Property countries; | |
| 238 | + final Property firstPublishedDate; | |
| 239 | + final Property id; | |
| 240 | + final Property industries; | |
| 241 | + final Property lastPublishedDate; | |
| 242 | + final Property question; | |
| 243 | + final Property topics; | |
| 244 | + final Property tradeRegions; | |
| 245 | + final Property url; | |
| 246 | + final Property worldRegions; | |
| 247 | + | |
| 248 | + FaqProperties({ | |
| 249 | + required this.answer, | |
| 250 | + required this.countries, | |
| 251 | + required this.firstPublishedDate, | |
| 252 | + required this.id, | |
| 253 | + required this.industries, | |
| 254 | + required this.lastPublishedDate, | |
| 255 | + required this.question, | |
| 256 | + required this.topics, | |
| 257 | + required this.tradeRegions, | |
| 258 | + required this.url, | |
| 259 | + required this.worldRegions, | |
| 260 | + }); | |
| 261 | + | |
| 262 | + factory FaqProperties.fromJson(Map<String, dynamic> json) => FaqProperties( | |
| 263 | + answer: Property.fromJson(json["answer"]), | |
| 264 | + countries: Property.fromJson(json["countries"]), | |
| 265 | + firstPublishedDate: Property.fromJson(json["first_published_date"]), | |
| 266 | + id: Property.fromJson(json["id"]), | |
| 267 | + industries: Property.fromJson(json["industries"]), | |
| 268 | + lastPublishedDate: Property.fromJson(json["last_published_date"]), | |
| 269 | + question: Property.fromJson(json["question"]), | |
| 270 | + topics: Property.fromJson(json["topics"]), | |
| 271 | + tradeRegions: Property.fromJson(json["trade_regions"]), | |
| 272 | + url: Property.fromJson(json["url"]), | |
| 273 | + worldRegions: Property.fromJson(json["world_regions"]), | |
| 274 | + ); | |
| 275 | + | |
| 276 | + Map<String, dynamic> toJson() => { | |
| 277 | + "answer": answer.toJson(), | |
| 278 | + "countries": countries.toJson(), | |
| 279 | + "first_published_date": firstPublishedDate.toJson(), | |
| 280 | + "id": id.toJson(), | |
| 281 | + "industries": industries.toJson(), | |
| 282 | + "last_published_date": lastPublishedDate.toJson(), | |
| 283 | + "question": question.toJson(), | |
| 284 | + "topics": topics.toJson(), | |
| 285 | + "trade_regions": tradeRegions.toJson(), | |
| 286 | + "url": url.toJson(), | |
| 287 | + "world_regions": worldRegions.toJson(), | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Report { | |
| 292 | + final ReportProperties properties; | |
| 293 | + | |
| 294 | + Report({ | |
| 295 | + required this.properties, | |
| 296 | + }); | |
| 297 | + | |
| 298 | + factory Report.fromJson(Map<String, dynamic> json) => Report( | |
| 299 | + properties: ReportProperties.fromJson(json["properties"]), | |
| 300 | + ); | |
| 301 | + | |
| 302 | + Map<String, dynamic> toJson() => { | |
| 303 | + "properties": properties.toJson(), | |
| 304 | + }; | |
| 305 | +} | |
| 306 | + | |
| 307 | +class ReportProperties { | |
| 308 | + final Property countries; | |
| 309 | + final Property description; | |
| 310 | + final Property expirationDate; | |
| 311 | + final Property id; | |
| 312 | + final Property industries; | |
| 313 | + final Property itaIndustries; | |
| 314 | + final Property reportType; | |
| 315 | + final Property title; | |
| 316 | + final Property url; | |
| 317 | + | |
| 318 | + ReportProperties({ | |
| 319 | + required this.countries, | |
| 320 | + required this.description, | |
| 321 | + required this.expirationDate, | |
| 322 | + required this.id, | |
| 323 | + required this.industries, | |
| 324 | + required this.itaIndustries, | |
| 325 | + required this.reportType, | |
| 326 | + required this.title, | |
| 327 | + required this.url, | |
| 328 | + }); | |
| 329 | + | |
| 330 | + factory ReportProperties.fromJson(Map<String, dynamic> json) => ReportProperties( | |
| 331 | + countries: Property.fromJson(json["countries"]), | |
| 332 | + description: Property.fromJson(json["description"]), | |
| 333 | + expirationDate: Property.fromJson(json["expiration_date"]), | |
| 334 | + id: Property.fromJson(json["id"]), | |
| 335 | + industries: Property.fromJson(json["industries"]), | |
| 336 | + itaIndustries: Property.fromJson(json["ita_industries"]), | |
| 337 | + reportType: Property.fromJson(json["report_type"]), | |
| 338 | + title: Property.fromJson(json["title"]), | |
| 339 | + url: Property.fromJson(json["url"]), | |
| 340 | + ); | |
| 341 | + | |
| 342 | + Map<String, dynamic> toJson() => { | |
| 343 | + "countries": countries.toJson(), | |
| 344 | + "description": description.toJson(), | |
| 345 | + "expiration_date": expirationDate.toJson(), | |
| 346 | + "id": id.toJson(), | |
| 347 | + "industries": industries.toJson(), | |
| 348 | + "ita_industries": itaIndustries.toJson(), | |
| 349 | + "report_type": reportType.toJson(), | |
| 350 | + "title": title.toJson(), | |
| 351 | + "url": url.toJson(), | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +class Taxonomy { | |
| 356 | + final TaxonomyProperties properties; | |
| 357 | + | |
| 358 | + Taxonomy({ | |
| 359 | + required this.properties, | |
| 360 | + }); | |
| 361 | + | |
| 362 | + factory Taxonomy.fromJson(Map<String, dynamic> json) => Taxonomy( | |
| 363 | + properties: TaxonomyProperties.fromJson(json["properties"]), | |
| 364 | + ); | |
| 365 | + | |
| 366 | + Map<String, dynamic> toJson() => { | |
| 367 | + "properties": properties.toJson(), | |
| 368 | + }; | |
| 369 | +} | |
| 370 | + | |
| 371 | +class TaxonomyProperties { | |
| 372 | + final Property annotations; | |
| 373 | + final Property datatypeProperties; | |
| 374 | + final Property id; | |
| 375 | + final Property label; | |
| 376 | + final Property subClassOf; | |
| 377 | + final Property type; | |
| 378 | + | |
| 379 | + TaxonomyProperties({ | |
| 380 | + required this.annotations, | |
| 381 | + required this.datatypeProperties, | |
| 382 | + required this.id, | |
| 383 | + required this.label, | |
| 384 | + required this.subClassOf, | |
| 385 | + required this.type, | |
| 386 | + }); | |
| 387 | + | |
| 388 | + factory TaxonomyProperties.fromJson(Map<String, dynamic> json) => TaxonomyProperties( | |
| 389 | + annotations: Property.fromJson(json["annotations"]), | |
| 390 | + datatypeProperties: Property.fromJson(json["datatype_properties"]), | |
| 391 | + id: Property.fromJson(json["id"]), | |
| 392 | + label: Property.fromJson(json["label"]), | |
| 393 | + subClassOf: Property.fromJson(json["sub_class_of"]), | |
| 394 | + type: Property.fromJson(json["type"]), | |
| 395 | + ); | |
| 396 | + | |
| 397 | + Map<String, dynamic> toJson() => { | |
| 398 | + "annotations": annotations.toJson(), | |
| 399 | + "datatype_properties": datatypeProperties.toJson(), | |
| 400 | + "id": id.toJson(), | |
| 401 | + "label": label.toJson(), | |
| 402 | + "sub_class_of": subClassOf.toJson(), | |
| 403 | + "type": type.toJson(), | |
| 404 | + }; | |
| 405 | +} | |
| 406 | + | |
| 407 | +class Info { | |
| 408 | + final String description; | |
| 409 | + final String title; | |
| 410 | + final String version; | |
| 411 | + | |
| 412 | + Info({ | |
| 413 | + required this.description, | |
| 414 | + required this.title, | |
| 415 | + required this.version, | |
| 416 | + }); | |
| 417 | + | |
| 418 | + factory Info.fromJson(Map<String, dynamic> json) => Info( | |
| 419 | + description: json["description"], | |
| 420 | + title: json["title"], | |
| 421 | + version: json["version"], | |
| 422 | + ); | |
| 423 | + | |
| 424 | + Map<String, dynamic> toJson() => { | |
| 425 | + "description": description, | |
| 426 | + "title": title, | |
| 427 | + "version": version, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class Paths { | |
| 432 | + final BusinessServiceProvidersSearchClass businessServiceProvidersSearch; | |
| 433 | + final ConsolidatedScreeningListSearchClass consolidatedScreeningListSearch; | |
| 434 | + final ConsolidatedScreeningListSearchClass deMinimisSearch; | |
| 435 | + final ConsolidatedScreeningListSearchClass itaFaqsSearch; | |
| 436 | + final ConsolidatedScreeningListSearchClass itaOfficeLocationsSearch; | |
| 437 | + final BusinessServiceProvidersSearchClass itaTaxonomiesSearch; | |
| 438 | + final BusinessServiceProvidersSearchClass itaZipcodeToPostSearch; | |
| 439 | + final ConsolidatedScreeningListSearchClass marketIntelligenceSearch; | |
| 440 | + final ConsolidatedScreeningListSearchClass marketResearchLibrarySearch; | |
| 441 | + final ConsolidatedScreeningListSearchClass tariffRatesSearch; | |
| 442 | + final ConsolidatedScreeningListSearchClass tradeArticlesSearch; | |
| 443 | + final ConsolidatedScreeningListSearchClass tradeEventsSearch; | |
| 444 | + final ConsolidatedScreeningListSearchClass tradeLeadsSearch; | |
| 445 | + | |
| 446 | + Paths({ | |
| 447 | + required this.businessServiceProvidersSearch, | |
| 448 | + required this.consolidatedScreeningListSearch, | |
| 449 | + required this.deMinimisSearch, | |
| 450 | + required this.itaFaqsSearch, | |
| 451 | + required this.itaOfficeLocationsSearch, | |
| 452 | + required this.itaTaxonomiesSearch, | |
| 453 | + required this.itaZipcodeToPostSearch, | |
| 454 | + required this.marketIntelligenceSearch, | |
| 455 | + required this.marketResearchLibrarySearch, | |
| 456 | + required this.tariffRatesSearch, | |
| 457 | + required this.tradeArticlesSearch, | |
| 458 | + required this.tradeEventsSearch, | |
| 459 | + required this.tradeLeadsSearch, | |
| 460 | + }); | |
| 461 | + | |
| 462 | + factory Paths.fromJson(Map<String, dynamic> json) => Paths( | |
| 463 | + businessServiceProvidersSearch: BusinessServiceProvidersSearchClass.fromJson(json["/business_service_providers/search"]), | |
| 464 | + consolidatedScreeningListSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/consolidated_screening_list/search"]), | |
| 465 | + deMinimisSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/de_minimis/search"]), | |
| 466 | + itaFaqsSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/ita_faqs/search"]), | |
| 467 | + itaOfficeLocationsSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/ita_office_locations/search"]), | |
| 468 | + itaTaxonomiesSearch: BusinessServiceProvidersSearchClass.fromJson(json["/ita_taxonomies/search"]), | |
| 469 | + itaZipcodeToPostSearch: BusinessServiceProvidersSearchClass.fromJson(json["/ita_zipcode_to_post/search"]), | |
| 470 | + marketIntelligenceSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/market_intelligence/search"]), | |
| 471 | + marketResearchLibrarySearch: ConsolidatedScreeningListSearchClass.fromJson(json["/market_research_library/search"]), | |
| 472 | + tariffRatesSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/tariff_rates/search"]), | |
| 473 | + tradeArticlesSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/trade_articles/search"]), | |
| 474 | + tradeEventsSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/trade_events/search"]), | |
| 475 | + tradeLeadsSearch: ConsolidatedScreeningListSearchClass.fromJson(json["/trade_leads/search"]), | |
| 476 | + ); | |
| 477 | + | |
| 478 | + Map<String, dynamic> toJson() => { | |
| 479 | + "/business_service_providers/search": businessServiceProvidersSearch.toJson(), | |
| 480 | + "/consolidated_screening_list/search": consolidatedScreeningListSearch.toJson(), | |
| 481 | + "/de_minimis/search": deMinimisSearch.toJson(), | |
| 482 | + "/ita_faqs/search": itaFaqsSearch.toJson(), | |
| 483 | + "/ita_office_locations/search": itaOfficeLocationsSearch.toJson(), | |
| 484 | + "/ita_taxonomies/search": itaTaxonomiesSearch.toJson(), | |
| 485 | + "/ita_zipcode_to_post/search": itaZipcodeToPostSearch.toJson(), | |
| 486 | + "/market_intelligence/search": marketIntelligenceSearch.toJson(), | |
| 487 | + "/market_research_library/search": marketResearchLibrarySearch.toJson(), | |
| 488 | + "/tariff_rates/search": tariffRatesSearch.toJson(), | |
| 489 | + "/trade_articles/search": tradeArticlesSearch.toJson(), | |
| 490 | + "/trade_events/search": tradeEventsSearch.toJson(), | |
| 491 | + "/trade_leads/search": tradeLeadsSearch.toJson(), | |
| 492 | + }; | |
| 493 | +} | |
| 494 | + | |
| 495 | +class BusinessServiceProvidersSearchClass { | |
| 496 | + final BusinessServiceProvidersSearchGet searchGet; | |
| 497 | + | |
| 498 | + BusinessServiceProvidersSearchClass({ | |
| 499 | + required this.searchGet, | |
| 500 | + }); | |
| 501 | + | |
| 502 | + factory BusinessServiceProvidersSearchClass.fromJson(Map<String, dynamic> json) => BusinessServiceProvidersSearchClass( | |
| 503 | + searchGet: BusinessServiceProvidersSearchGet.fromJson(json["get"]), | |
| 504 | + ); | |
| 505 | + | |
| 506 | + Map<String, dynamic> toJson() => { | |
| 507 | + "get": searchGet.toJson(), | |
| 508 | + }; | |
| 509 | +} | |
| 510 | + | |
| 511 | +class BusinessServiceProvidersSearchGet { | |
| 512 | + final String description; | |
| 513 | + final List<Parameter> parameters; | |
| 514 | + final PurpleResponses responses; | |
| 515 | + final String summary; | |
| 516 | + final List<String> tags; | |
| 517 | + | |
| 518 | + BusinessServiceProvidersSearchGet({ | |
| 519 | + required this.description, | |
| 520 | + required this.parameters, | |
| 521 | + required this.responses, | |
| 522 | + required this.summary, | |
| 523 | + required this.tags, | |
| 524 | + }); | |
| 525 | + | |
| 526 | + factory BusinessServiceProvidersSearchGet.fromJson(Map<String, dynamic> json) => BusinessServiceProvidersSearchGet( | |
| 527 | + description: json["description"], | |
| 528 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 529 | + responses: PurpleResponses.fromJson(json["responses"]), | |
| 530 | + summary: json["summary"], | |
| 531 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 532 | + ); | |
| 533 | + | |
| 534 | + Map<String, dynamic> toJson() => { | |
| 535 | + "description": description, | |
| 536 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 537 | + "responses": responses.toJson(), | |
| 538 | + "summary": summary, | |
| 539 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 540 | + }; | |
| 541 | +} | |
| 542 | + | |
| 543 | +class Parameter { | |
| 544 | + final String description; | |
| 545 | + final FormatEnum format; | |
| 546 | + final String name; | |
| 547 | + final In parameterIn; | |
| 548 | + final bool required; | |
| 549 | + final FormatEnum type; | |
| 550 | + | |
| 551 | + Parameter({ | |
| 552 | + required this.description, | |
| 553 | + required this.format, | |
| 554 | + required this.name, | |
| 555 | + required this.parameterIn, | |
| 556 | + required this.required, | |
| 557 | + required this.type, | |
| 558 | + }); | |
| 559 | + | |
| 560 | + factory Parameter.fromJson(Map<String, dynamic> json) => Parameter( | |
| 561 | + description: json["description"], | |
| 562 | + format: formatEnumValues.map[json["format"]]!, | |
| 563 | + name: json["name"], | |
| 564 | + parameterIn: inValues.map[json["in"]]!, | |
| 565 | + required: json["required"], | |
| 566 | + type: formatEnumValues.map[json["type"]]!, | |
| 567 | + ); | |
| 568 | + | |
| 569 | + Map<String, dynamic> toJson() => { | |
| 570 | + "description": description, | |
| 571 | + "format": formatEnumValues.reverse[format], | |
| 572 | + "name": name, | |
| 573 | + "in": inValues.reverse[parameterIn], | |
| 574 | + "required": required, | |
| 575 | + "type": formatEnumValues.reverse[type], | |
| 576 | + }; | |
| 577 | +} | |
| 578 | + | |
| 579 | +enum In { | |
| 580 | + QUERY | |
| 581 | +} | |
| 582 | + | |
| 583 | +final inValues = EnumValues({ | |
| 584 | + "query": In.QUERY | |
| 585 | +}); | |
| 586 | + | |
| 587 | +class PurpleResponses { | |
| 588 | + final Purple200 the200; | |
| 589 | + | |
| 590 | + PurpleResponses({ | |
| 591 | + required this.the200, | |
| 592 | + }); | |
| 593 | + | |
| 594 | + factory PurpleResponses.fromJson(Map<String, dynamic> json) => PurpleResponses( | |
| 595 | + the200: Purple200.fromJson(json["200"]), | |
| 596 | + ); | |
| 597 | + | |
| 598 | + Map<String, dynamic> toJson() => { | |
| 599 | + "200": the200.toJson(), | |
| 600 | + }; | |
| 601 | +} | |
| 602 | + | |
| 603 | +class Purple200 { | |
| 604 | + final String description; | |
| 605 | + final ItemsClass schema; | |
| 606 | + | |
| 607 | + Purple200({ | |
| 608 | + required this.description, | |
| 609 | + required this.schema, | |
| 610 | + }); | |
| 611 | + | |
| 612 | + factory Purple200.fromJson(Map<String, dynamic> json) => Purple200( | |
| 613 | + description: json["description"], | |
| 614 | + schema: ItemsClass.fromJson(json["schema"]), | |
| 615 | + ); | |
| 616 | + | |
| 617 | + Map<String, dynamic> toJson() => { | |
| 618 | + "description": description, | |
| 619 | + "schema": schema.toJson(), | |
| 620 | + }; | |
| 621 | +} | |
| 622 | + | |
| 623 | +class ItemsClass { | |
| 624 | + final String ref; | |
| 625 | + | |
| 626 | + ItemsClass({ | |
| 627 | + required this.ref, | |
| 628 | + }); | |
| 629 | + | |
| 630 | + factory ItemsClass.fromJson(Map<String, dynamic> json) => ItemsClass( | |
| 631 | + ref: json["\u0024ref"], | |
| 632 | + ); | |
| 633 | + | |
| 634 | + Map<String, dynamic> toJson() => { | |
| 635 | + "\u0024ref": ref, | |
| 636 | + }; | |
| 637 | +} | |
| 638 | + | |
| 639 | +class ConsolidatedScreeningListSearchClass { | |
| 640 | + final ConsolidatedScreeningListSearchGet searchGet; | |
| 641 | + | |
| 642 | + ConsolidatedScreeningListSearchClass({ | |
| 643 | + required this.searchGet, | |
| 644 | + }); | |
| 645 | + | |
| 646 | + factory ConsolidatedScreeningListSearchClass.fromJson(Map<String, dynamic> json) => ConsolidatedScreeningListSearchClass( | |
| 647 | + searchGet: ConsolidatedScreeningListSearchGet.fromJson(json["get"]), | |
| 648 | + ); | |
| 649 | + | |
| 650 | + Map<String, dynamic> toJson() => { | |
| 651 | + "get": searchGet.toJson(), | |
| 652 | + }; | |
| 653 | +} | |
| 654 | + | |
| 655 | +class ConsolidatedScreeningListSearchGet { | |
| 656 | + final String description; | |
| 657 | + final List<Parameter> parameters; | |
| 658 | + final FluffyResponses responses; | |
| 659 | + final String summary; | |
| 660 | + final List<String> tags; | |
| 661 | + | |
| 662 | + ConsolidatedScreeningListSearchGet({ | |
| 663 | + required this.description, | |
| 664 | + required this.parameters, | |
| 665 | + required this.responses, | |
| 666 | + required this.summary, | |
| 667 | + required this.tags, | |
| 668 | + }); | |
| 669 | + | |
| 670 | + factory ConsolidatedScreeningListSearchGet.fromJson(Map<String, dynamic> json) => ConsolidatedScreeningListSearchGet( | |
| 671 | + description: json["description"], | |
| 672 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 673 | + responses: FluffyResponses.fromJson(json["responses"]), | |
| 674 | + summary: json["summary"], | |
| 675 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 676 | + ); | |
| 677 | + | |
| 678 | + Map<String, dynamic> toJson() => { | |
| 679 | + "description": description, | |
| 680 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 681 | + "responses": responses.toJson(), | |
| 682 | + "summary": summary, | |
| 683 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 684 | + }; | |
| 685 | +} | |
| 686 | + | |
| 687 | +class FluffyResponses { | |
| 688 | + final Fluffy200 the200; | |
| 689 | + | |
| 690 | + FluffyResponses({ | |
| 691 | + required this.the200, | |
| 692 | + }); | |
| 693 | + | |
| 694 | + factory FluffyResponses.fromJson(Map<String, dynamic> json) => FluffyResponses( | |
| 695 | + the200: Fluffy200.fromJson(json["200"]), | |
| 696 | + ); | |
| 697 | + | |
| 698 | + Map<String, dynamic> toJson() => { | |
| 699 | + "200": the200.toJson(), | |
| 700 | + }; | |
| 701 | +} | |
| 702 | + | |
| 703 | +class Fluffy200 { | |
| 704 | + final String description; | |
| 705 | + final PurpleSchema schema; | |
| 706 | + | |
| 707 | + Fluffy200({ | |
| 708 | + required this.description, | |
| 709 | + required this.schema, | |
| 710 | + }); | |
| 711 | + | |
| 712 | + factory Fluffy200.fromJson(Map<String, dynamic> json) => Fluffy200( | |
| 713 | + description: json["description"], | |
| 714 | + schema: PurpleSchema.fromJson(json["schema"]), | |
| 715 | + ); | |
| 716 | + | |
| 717 | + Map<String, dynamic> toJson() => { | |
| 718 | + "description": description, | |
| 719 | + "schema": schema.toJson(), | |
| 720 | + }; | |
| 721 | +} | |
| 722 | + | |
| 723 | +class PurpleSchema { | |
| 724 | + final ItemsClass items; | |
| 725 | + final SchemaType type; | |
| 726 | + | |
| 727 | + PurpleSchema({ | |
| 728 | + required this.items, | |
| 729 | + required this.type, | |
| 730 | + }); | |
| 731 | + | |
| 732 | + factory PurpleSchema.fromJson(Map<String, dynamic> json) => PurpleSchema( | |
| 733 | + items: ItemsClass.fromJson(json["items"]), | |
| 734 | + type: schemaTypeValues.map[json["type"]]!, | |
| 735 | + ); | |
| 736 | + | |
| 737 | + Map<String, dynamic> toJson() => { | |
| 738 | + "items": items.toJson(), | |
| 739 | + "type": schemaTypeValues.reverse[type], | |
| 740 | + }; | |
| 741 | +} | |
| 742 | + | |
| 743 | +enum SchemaType { | |
| 744 | + ARRAY | |
| 745 | +} | |
| 746 | + | |
| 747 | +final schemaTypeValues = EnumValues({ | |
| 748 | + "array": SchemaType.ARRAY | |
| 749 | +}); | |
| 750 | + | |
| 751 | +class EnumValues<T> { | |
| 752 | + Map<String, T> map; | |
| 753 | + late Map<T, String> reverseMap; | |
| 754 | + | |
| 755 | + EnumValues(this.map); | |
| 756 | + | |
| 757 | + Map<T, String> get reverse { | |
| 758 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 759 | + return reverseMap; | |
| 760 | + } | |
| 761 | +} |
Test case
1 generated file · +109 −0test/inputs/json/misc/77392.json
Adartdefault / TopLevel.dart+109 −0
| @@ -0,0 +1,109 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String designation; | |
| 13 | + final DateTime discoveryDate; | |
| 14 | + final String? hMag; | |
| 15 | + final String iDeg; | |
| 16 | + final String moidAu; | |
| 17 | + final OrbitClass orbitClass; | |
| 18 | + final String? periodYr; | |
| 19 | + final Pha pha; | |
| 20 | + final String qAu1; | |
| 21 | + final String? qAu2; | |
| 22 | + | |
| 23 | + TopLevel({ | |
| 24 | + required this.designation, | |
| 25 | + required this.discoveryDate, | |
| 26 | + this.hMag, | |
| 27 | + required this.iDeg, | |
| 28 | + required this.moidAu, | |
| 29 | + required this.orbitClass, | |
| 30 | + this.periodYr, | |
| 31 | + required this.pha, | |
| 32 | + required this.qAu1, | |
| 33 | + this.qAu2, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 37 | + designation: json["designation"], | |
| 38 | + discoveryDate: DateTime.parse(json["discovery_date"]), | |
| 39 | + hMag: json["h_mag"], | |
| 40 | + iDeg: json["i_deg"], | |
| 41 | + moidAu: json["moid_au"], | |
| 42 | + orbitClass: orbitClassValues.map[json["orbit_class"]]!, | |
| 43 | + periodYr: json["period_yr"], | |
| 44 | + pha: phaValues.map[json["pha"]]!, | |
| 45 | + qAu1: json["q_au_1"], | |
| 46 | + qAu2: json["q_au_2"], | |
| 47 | + ); | |
| 48 | + | |
| 49 | + Map<String, dynamic> toJson() => { | |
| 50 | + "designation": designation, | |
| 51 | + "discovery_date": discoveryDate.toIso8601String(), | |
| 52 | + "h_mag": hMag, | |
| 53 | + "i_deg": iDeg, | |
| 54 | + "moid_au": moidAu, | |
| 55 | + "orbit_class": orbitClassValues.reverse[orbitClass], | |
| 56 | + "period_yr": periodYr, | |
| 57 | + "pha": phaValues.reverse[pha], | |
| 58 | + "q_au_1": qAu1, | |
| 59 | + "q_au_2": qAu2, | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +enum OrbitClass { | |
| 64 | + APOLLO, | |
| 65 | + AMOR, | |
| 66 | + ATEN, | |
| 67 | + COMET, | |
| 68 | + JUPITER_FAMILY_COMET, | |
| 69 | + HALLEY_TYPE_COMET, | |
| 70 | + PARABOLIC_COMET, | |
| 71 | + ORBIT_CLASS_JUPITER_FAMILY_COMET, | |
| 72 | + ENCKE_TYPE_COMET | |
| 73 | +} | |
| 74 | + | |
| 75 | +final orbitClassValues = EnumValues({ | |
| 76 | + "Apollo": OrbitClass.APOLLO, | |
| 77 | + "Amor": OrbitClass.AMOR, | |
| 78 | + "Aten": OrbitClass.ATEN, | |
| 79 | + "Comet": OrbitClass.COMET, | |
| 80 | + "Jupiter-family Comet": OrbitClass.JUPITER_FAMILY_COMET, | |
| 81 | + "Halley-type Comet*": OrbitClass.HALLEY_TYPE_COMET, | |
| 82 | + "Parabolic Comet": OrbitClass.PARABOLIC_COMET, | |
| 83 | + "Jupiter-family Comet*": OrbitClass.ORBIT_CLASS_JUPITER_FAMILY_COMET, | |
| 84 | + "Encke-type Comet": OrbitClass.ENCKE_TYPE_COMET | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Pha { | |
| 88 | + Y, | |
| 89 | + N, | |
| 90 | + N_A | |
| 91 | +} | |
| 92 | + | |
| 93 | +final phaValues = EnumValues({ | |
| 94 | + "Y": Pha.Y, | |
| 95 | + "N": Pha.N, | |
| 96 | + "n/a": Pha.N_A | |
| 97 | +}); | |
| 98 | + | |
| 99 | +class EnumValues<T> { | |
| 100 | + Map<String, T> map; | |
| 101 | + late Map<T, String> reverseMap; | |
| 102 | + | |
| 103 | + EnumValues(this.map); | |
| 104 | + | |
| 105 | + Map<T, String> get reverse { | |
| 106 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 107 | + return reverseMap; | |
| 108 | + } | |
| 109 | +} |
Test case
1 generated file · +329 −0test/inputs/json/misc/7d397.json
Adartdefault / TopLevel.dart+329 −0
| @@ -0,0 +1,329 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String basePath; | |
| 13 | + final Definitions definitions; | |
| 14 | + final String host; | |
| 15 | + final Info info; | |
| 16 | + final Paths paths; | |
| 17 | + final List<String> produces; | |
| 18 | + final List<String> schemes; | |
| 19 | + final String swagger; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.basePath, | |
| 23 | + required this.definitions, | |
| 24 | + required this.host, | |
| 25 | + required this.info, | |
| 26 | + required this.paths, | |
| 27 | + required this.produces, | |
| 28 | + required this.schemes, | |
| 29 | + required this.swagger, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + basePath: json["basePath"], | |
| 34 | + definitions: Definitions.fromJson(json["definitions"]), | |
| 35 | + host: json["host"], | |
| 36 | + info: Info.fromJson(json["info"]), | |
| 37 | + paths: Paths.fromJson(json["paths"]), | |
| 38 | + produces: List<String>.from(json["produces"].map((x) => x)), | |
| 39 | + schemes: List<String>.from(json["schemes"].map((x) => x)), | |
| 40 | + swagger: json["swagger"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "basePath": basePath, | |
| 45 | + "definitions": definitions.toJson(), | |
| 46 | + "host": host, | |
| 47 | + "info": info.toJson(), | |
| 48 | + "paths": paths.toJson(), | |
| 49 | + "produces": List<dynamic>.from(produces.map((x) => x)), | |
| 50 | + "schemes": List<dynamic>.from(schemes.map((x) => x)), | |
| 51 | + "swagger": swagger, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Definitions { | |
| 56 | + final ListClass list; | |
| 57 | + | |
| 58 | + Definitions({ | |
| 59 | + required this.list, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Definitions.fromJson(Map<String, dynamic> json) => Definitions( | |
| 63 | + list: ListClass.fromJson(json["List"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "List": list.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class ListClass { | |
| 72 | + final Map<String, Property> properties; | |
| 73 | + | |
| 74 | + ListClass({ | |
| 75 | + required this.properties, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory ListClass.fromJson(Map<String, dynamic> json) => ListClass( | |
| 79 | + properties: Map.from(json["properties"]).map((k, v) => MapEntry<String, Property>(k, Property.fromJson(v))), | |
| 80 | + ); | |
| 81 | + | |
| 82 | + Map<String, dynamic> toJson() => { | |
| 83 | + "properties": Map.from(properties).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class Property { | |
| 88 | + final String description; | |
| 89 | + final Type type; | |
| 90 | + | |
| 91 | + Property({ | |
| 92 | + required this.description, | |
| 93 | + required this.type, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory Property.fromJson(Map<String, dynamic> json) => Property( | |
| 97 | + description: json["description"], | |
| 98 | + type: typeValues.map[json["type"]]!, | |
| 99 | + ); | |
| 100 | + | |
| 101 | + Map<String, dynamic> toJson() => { | |
| 102 | + "description": description, | |
| 103 | + "type": typeValues.reverse[type], | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +enum Type { | |
| 108 | + STRING | |
| 109 | +} | |
| 110 | + | |
| 111 | +final typeValues = EnumValues({ | |
| 112 | + "string": Type.STRING | |
| 113 | +}); | |
| 114 | + | |
| 115 | +class Info { | |
| 116 | + final String description; | |
| 117 | + final String title; | |
| 118 | + final String version; | |
| 119 | + | |
| 120 | + Info({ | |
| 121 | + required this.description, | |
| 122 | + required this.title, | |
| 123 | + required this.version, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory Info.fromJson(Map<String, dynamic> json) => Info( | |
| 127 | + description: json["description"], | |
| 128 | + title: json["title"], | |
| 129 | + version: json["version"], | |
| 130 | + ); | |
| 131 | + | |
| 132 | + Map<String, dynamic> toJson() => { | |
| 133 | + "description": description, | |
| 134 | + "title": title, | |
| 135 | + "version": version, | |
| 136 | + }; | |
| 137 | +} | |
| 138 | + | |
| 139 | +class Paths { | |
| 140 | + final ConsolidatedScreeningListSearch consolidatedScreeningListSearch; | |
| 141 | + | |
| 142 | + Paths({ | |
| 143 | + required this.consolidatedScreeningListSearch, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Paths.fromJson(Map<String, dynamic> json) => Paths( | |
| 147 | + consolidatedScreeningListSearch: ConsolidatedScreeningListSearch.fromJson(json["/consolidated_screening_list/search"]), | |
| 148 | + ); | |
| 149 | + | |
| 150 | + Map<String, dynamic> toJson() => { | |
| 151 | + "/consolidated_screening_list/search": consolidatedScreeningListSearch.toJson(), | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class ConsolidatedScreeningListSearch { | |
| 156 | + final Get consolidatedScreeningListSearchGet; | |
| 157 | + | |
| 158 | + ConsolidatedScreeningListSearch({ | |
| 159 | + required this.consolidatedScreeningListSearchGet, | |
| 160 | + }); | |
| 161 | + | |
| 162 | + factory ConsolidatedScreeningListSearch.fromJson(Map<String, dynamic> json) => ConsolidatedScreeningListSearch( | |
| 163 | + consolidatedScreeningListSearchGet: Get.fromJson(json["get"]), | |
| 164 | + ); | |
| 165 | + | |
| 166 | + Map<String, dynamic> toJson() => { | |
| 167 | + "get": consolidatedScreeningListSearchGet.toJson(), | |
| 168 | + }; | |
| 169 | +} | |
| 170 | + | |
| 171 | +class Get { | |
| 172 | + final String description; | |
| 173 | + final List<Parameter> parameters; | |
| 174 | + final Responses responses; | |
| 175 | + final String summary; | |
| 176 | + final List<String> tags; | |
| 177 | + | |
| 178 | + Get({ | |
| 179 | + required this.description, | |
| 180 | + required this.parameters, | |
| 181 | + required this.responses, | |
| 182 | + required this.summary, | |
| 183 | + required this.tags, | |
| 184 | + }); | |
| 185 | + | |
| 186 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 187 | + description: json["description"], | |
| 188 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 189 | + responses: Responses.fromJson(json["responses"]), | |
| 190 | + summary: json["summary"], | |
| 191 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 192 | + ); | |
| 193 | + | |
| 194 | + Map<String, dynamic> toJson() => { | |
| 195 | + "description": description, | |
| 196 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 197 | + "responses": responses.toJson(), | |
| 198 | + "summary": summary, | |
| 199 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 200 | + }; | |
| 201 | +} | |
| 202 | + | |
| 203 | +class Parameter { | |
| 204 | + final String description; | |
| 205 | + final Type format; | |
| 206 | + final String name; | |
| 207 | + final In parameterIn; | |
| 208 | + final bool required; | |
| 209 | + final Type type; | |
| 210 | + | |
| 211 | + Parameter({ | |
| 212 | + required this.description, | |
| 213 | + required this.format, | |
| 214 | + required this.name, | |
| 215 | + required this.parameterIn, | |
| 216 | + required this.required, | |
| 217 | + required this.type, | |
| 218 | + }); | |
| 219 | + | |
| 220 | + factory Parameter.fromJson(Map<String, dynamic> json) => Parameter( | |
| 221 | + description: json["description"], | |
| 222 | + format: typeValues.map[json["format"]]!, | |
| 223 | + name: json["name"], | |
| 224 | + parameterIn: inValues.map[json["in"]]!, | |
| 225 | + required: json["required"], | |
| 226 | + type: typeValues.map[json["type"]]!, | |
| 227 | + ); | |
| 228 | + | |
| 229 | + Map<String, dynamic> toJson() => { | |
| 230 | + "description": description, | |
| 231 | + "format": typeValues.reverse[format], | |
| 232 | + "name": name, | |
| 233 | + "in": inValues.reverse[parameterIn], | |
| 234 | + "required": required, | |
| 235 | + "type": typeValues.reverse[type], | |
| 236 | + }; | |
| 237 | +} | |
| 238 | + | |
| 239 | +enum In { | |
| 240 | + QUERY | |
| 241 | +} | |
| 242 | + | |
| 243 | +final inValues = EnumValues({ | |
| 244 | + "query": In.QUERY | |
| 245 | +}); | |
| 246 | + | |
| 247 | +class Responses { | |
| 248 | + final The200 the200; | |
| 249 | + | |
| 250 | + Responses({ | |
| 251 | + required this.the200, | |
| 252 | + }); | |
| 253 | + | |
| 254 | + factory Responses.fromJson(Map<String, dynamic> json) => Responses( | |
| 255 | + the200: The200.fromJson(json["200"]), | |
| 256 | + ); | |
| 257 | + | |
| 258 | + Map<String, dynamic> toJson() => { | |
| 259 | + "200": the200.toJson(), | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class The200 { | |
| 264 | + final String description; | |
| 265 | + final Schema schema; | |
| 266 | + | |
| 267 | + The200({ | |
| 268 | + required this.description, | |
| 269 | + required this.schema, | |
| 270 | + }); | |
| 271 | + | |
| 272 | + factory The200.fromJson(Map<String, dynamic> json) => The200( | |
| 273 | + description: json["description"], | |
| 274 | + schema: Schema.fromJson(json["schema"]), | |
| 275 | + ); | |
| 276 | + | |
| 277 | + Map<String, dynamic> toJson() => { | |
| 278 | + "description": description, | |
| 279 | + "schema": schema.toJson(), | |
| 280 | + }; | |
| 281 | +} | |
| 282 | + | |
| 283 | +class Schema { | |
| 284 | + final Items items; | |
| 285 | + final String type; | |
| 286 | + | |
| 287 | + Schema({ | |
| 288 | + required this.items, | |
| 289 | + required this.type, | |
| 290 | + }); | |
| 291 | + | |
| 292 | + factory Schema.fromJson(Map<String, dynamic> json) => Schema( | |
| 293 | + items: Items.fromJson(json["items"]), | |
| 294 | + type: json["type"], | |
| 295 | + ); | |
| 296 | + | |
| 297 | + Map<String, dynamic> toJson() => { | |
| 298 | + "items": items.toJson(), | |
| 299 | + "type": type, | |
| 300 | + }; | |
| 301 | +} | |
| 302 | + | |
| 303 | +class Items { | |
| 304 | + final String ref; | |
| 305 | + | |
| 306 | + Items({ | |
| 307 | + required this.ref, | |
| 308 | + }); | |
| 309 | + | |
| 310 | + factory Items.fromJson(Map<String, dynamic> json) => Items( | |
| 311 | + ref: json["\u0024ref"], | |
| 312 | + ); | |
| 313 | + | |
| 314 | + Map<String, dynamic> toJson() => { | |
| 315 | + "\u0024ref": ref, | |
| 316 | + }; | |
| 317 | +} | |
| 318 | + | |
| 319 | +class EnumValues<T> { | |
| 320 | + Map<String, T> map; | |
| 321 | + late Map<T, String> reverseMap; | |
| 322 | + | |
| 323 | + EnumValues(this.map); | |
| 324 | + | |
| 325 | + Map<T, String> get reverse { | |
| 326 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 327 | + return reverseMap; | |
| 328 | + } | |
| 329 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/7d722.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/7df41.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Pc pc; | |
| 13 | + final Pc ps3; | |
| 14 | + final Pc ps4; | |
| 15 | + final Pc xbox; | |
| 16 | + final Pc xone; | |
| 17 | + | |
| 18 | + TopLevel({ | |
| 19 | + required this.pc, | |
| 20 | + required this.ps3, | |
| 21 | + required this.ps4, | |
| 22 | + required this.xbox, | |
| 23 | + required this.xone, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 27 | + pc: Pc.fromJson(json["pc"]), | |
| 28 | + ps3: Pc.fromJson(json["ps3"]), | |
| 29 | + ps4: Pc.fromJson(json["ps4"]), | |
| 30 | + xbox: Pc.fromJson(json["xbox"]), | |
| 31 | + xone: Pc.fromJson(json["xone"]), | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "pc": pc.toJson(), | |
| 36 | + "ps3": ps3.toJson(), | |
| 37 | + "ps4": ps4.toJson(), | |
| 38 | + "xbox": xbox.toJson(), | |
| 39 | + "xone": xone.toJson(), | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class Pc { | |
| 44 | + final int count; | |
| 45 | + final String label; | |
| 46 | + final int peak24; | |
| 47 | + | |
| 48 | + Pc({ | |
| 49 | + required this.count, | |
| 50 | + required this.label, | |
| 51 | + required this.peak24, | |
| 52 | + }); | |
| 53 | + | |
| 54 | + factory Pc.fromJson(Map<String, dynamic> json) => Pc( | |
| 55 | + count: json["count"], | |
| 56 | + label: json["label"], | |
| 57 | + peak24: json["peak24"], | |
| 58 | + ); | |
| 59 | + | |
| 60 | + Map<String, dynamic> toJson() => { | |
| 61 | + "count": count, | |
| 62 | + "label": label, | |
| 63 | + "peak24": peak24, | |
| 64 | + }; | |
| 65 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/7dfa6.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +189 −0test/inputs/json/misc/7eb30.json
Adartdefault / TopLevel.dart+189 −0
| @@ -0,0 +1,189 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final String next; | |
| 14 | + final dynamic previous; | |
| 15 | + final List<Result> results; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.count, | |
| 19 | + required this.next, | |
| 20 | + required this.previous, | |
| 21 | + required this.results, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + count: json["count"], | |
| 26 | + next: json["next"], | |
| 27 | + previous: json["previous"], | |
| 28 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "count": count, | |
| 33 | + "next": next, | |
| 34 | + "previous": previous, | |
| 35 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Result { | |
| 40 | + final String code; | |
| 41 | + final String english; | |
| 42 | + final bool fav; | |
| 43 | + final Group group; | |
| 44 | + final Location location; | |
| 45 | + final int minScreens; | |
| 46 | + final int numViews; | |
| 47 | + final String showtimes; | |
| 48 | + final int stars; | |
| 49 | + final Tel tel; | |
| 50 | + final String thai; | |
| 51 | + final int todayScreens; | |
| 52 | + final String url; | |
| 53 | + final String website; | |
| 54 | + | |
| 55 | + Result({ | |
| 56 | + required this.code, | |
| 57 | + required this.english, | |
| 58 | + required this.fav, | |
| 59 | + required this.group, | |
| 60 | + required this.location, | |
| 61 | + required this.minScreens, | |
| 62 | + required this.numViews, | |
| 63 | + required this.showtimes, | |
| 64 | + required this.stars, | |
| 65 | + required this.tel, | |
| 66 | + required this.thai, | |
| 67 | + required this.todayScreens, | |
| 68 | + required this.url, | |
| 69 | + required this.website, | |
| 70 | + }); | |
| 71 | + | |
| 72 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 73 | + code: json["code"], | |
| 74 | + english: json["english"], | |
| 75 | + fav: json["fav"], | |
| 76 | + group: Group.fromJson(json["group"]), | |
| 77 | + location: locationValues.map[json["location"]]!, | |
| 78 | + minScreens: json["min_screens"], | |
| 79 | + numViews: json["num_views"], | |
| 80 | + showtimes: json["showtimes"], | |
| 81 | + stars: json["stars"], | |
| 82 | + tel: telValues.map[json["tel"]]!, | |
| 83 | + thai: json["thai"], | |
| 84 | + todayScreens: json["today_screens"], | |
| 85 | + url: json["url"], | |
| 86 | + website: json["website"], | |
| 87 | + ); | |
| 88 | + | |
| 89 | + Map<String, dynamic> toJson() => { | |
| 90 | + "code": code, | |
| 91 | + "english": english, | |
| 92 | + "fav": fav, | |
| 93 | + "group": group.toJson(), | |
| 94 | + "location": locationValues.reverse[location], | |
| 95 | + "min_screens": minScreens, | |
| 96 | + "num_views": numViews, | |
| 97 | + "showtimes": showtimes, | |
| 98 | + "stars": stars, | |
| 99 | + "tel": telValues.reverse[tel], | |
| 100 | + "thai": thai, | |
| 101 | + "today_screens": todayScreens, | |
| 102 | + "url": url, | |
| 103 | + "website": website, | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Group { | |
| 108 | + final Code code; | |
| 109 | + final English english; | |
| 110 | + final Thai thai; | |
| 111 | + final String website; | |
| 112 | + | |
| 113 | + Group({ | |
| 114 | + required this.code, | |
| 115 | + required this.english, | |
| 116 | + required this.thai, | |
| 117 | + required this.website, | |
| 118 | + }); | |
| 119 | + | |
| 120 | + factory Group.fromJson(Map<String, dynamic> json) => Group( | |
| 121 | + code: codeValues.map[json["code"]]!, | |
| 122 | + english: englishValues.map[json["english"]]!, | |
| 123 | + thai: thaiValues.map[json["thai"]]!, | |
| 124 | + website: json["website"], | |
| 125 | + ); | |
| 126 | + | |
| 127 | + Map<String, dynamic> toJson() => { | |
| 128 | + "code": codeValues.reverse[code], | |
| 129 | + "english": englishValues.reverse[english], | |
| 130 | + "thai": thaiValues.reverse[thai], | |
| 131 | + "website": website, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +enum Code { | |
| 136 | + SF | |
| 137 | +} | |
| 138 | + | |
| 139 | +final codeValues = EnumValues({ | |
| 140 | + "sf": Code.SF | |
| 141 | +}); | |
| 142 | + | |
| 143 | +enum English { | |
| 144 | + SF | |
| 145 | +} | |
| 146 | + | |
| 147 | +final englishValues = EnumValues({ | |
| 148 | + "SF": English.SF | |
| 149 | +}); | |
| 150 | + | |
| 151 | +enum Thai { | |
| 152 | + EMPTY | |
| 153 | +} | |
| 154 | + | |
| 155 | +final thaiValues = EnumValues({ | |
| 156 | + "เอสเอฟ": Thai.EMPTY | |
| 157 | +}); | |
| 158 | + | |
| 159 | +enum Location { | |
| 160 | + EMPTY, | |
| 161 | + THE_5_TH_FL_EMPORIUM | |
| 162 | +} | |
| 163 | + | |
| 164 | +final locationValues = EnumValues({ | |
| 165 | + "": Location.EMPTY, | |
| 166 | + "5th Fl. Emporium": Location.THE_5_TH_FL_EMPORIUM | |
| 167 | +}); | |
| 168 | + | |
| 169 | +enum Tel { | |
| 170 | + EMPTY, | |
| 171 | + THE_022688899 | |
| 172 | +} | |
| 173 | + | |
| 174 | +final telValues = EnumValues({ | |
| 175 | + "": Tel.EMPTY, | |
| 176 | + "02-268-8899": Tel.THE_022688899 | |
| 177 | +}); | |
| 178 | + | |
| 179 | +class EnumValues<T> { | |
| 180 | + Map<String, T> map; | |
| 181 | + late Map<T, String> reverseMap; | |
| 182 | + | |
| 183 | + EnumValues(this.map); | |
| 184 | + | |
| 185 | + Map<T, String> get reverse { | |
| 186 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 187 | + return reverseMap; | |
| 188 | + } | |
| 189 | +} |
Test case
1 generated file · +145 −0test/inputs/json/misc/7f568.json
Adartdefault / TopLevel.dart+145 −0
| @@ -0,0 +1,145 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int comments; | |
| 13 | + final String commentsUrl; | |
| 14 | + final String commitsUrl; | |
| 15 | + final DateTime createdAt; | |
| 16 | + final String? description; | |
| 17 | + final Map<String, FileValue> files; | |
| 18 | + final String forksUrl; | |
| 19 | + final String gitPullUrl; | |
| 20 | + final String gitPushUrl; | |
| 21 | + final String htmlUrl; | |
| 22 | + final String id; | |
| 23 | + final bool public; | |
| 24 | + final bool truncated; | |
| 25 | + final DateTime updatedAt; | |
| 26 | + final String url; | |
| 27 | + final dynamic user; | |
| 28 | + | |
| 29 | + TopLevel({ | |
| 30 | + required this.comments, | |
| 31 | + required this.commentsUrl, | |
| 32 | + required this.commitsUrl, | |
| 33 | + required this.createdAt, | |
| 34 | + required this.description, | |
| 35 | + required this.files, | |
| 36 | + required this.forksUrl, | |
| 37 | + required this.gitPullUrl, | |
| 38 | + required this.gitPushUrl, | |
| 39 | + required this.htmlUrl, | |
| 40 | + required this.id, | |
| 41 | + required this.public, | |
| 42 | + required this.truncated, | |
| 43 | + required this.updatedAt, | |
| 44 | + required this.url, | |
| 45 | + required this.user, | |
| 46 | + }); | |
| 47 | + | |
| 48 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 49 | + comments: json["comments"], | |
| 50 | + commentsUrl: json["comments_url"], | |
| 51 | + commitsUrl: json["commits_url"], | |
| 52 | + createdAt: DateTime.parse(json["created_at"]), | |
| 53 | + description: json["description"], | |
| 54 | + files: Map.from(json["files"]).map((k, v) => MapEntry<String, FileValue>(k, FileValue.fromJson(v))), | |
| 55 | + forksUrl: json["forks_url"], | |
| 56 | + gitPullUrl: json["git_pull_url"], | |
| 57 | + gitPushUrl: json["git_push_url"], | |
| 58 | + htmlUrl: json["html_url"], | |
| 59 | + id: json["id"], | |
| 60 | + public: json["public"], | |
| 61 | + truncated: json["truncated"], | |
| 62 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 63 | + url: json["url"], | |
| 64 | + user: json["user"], | |
| 65 | + ); | |
| 66 | + | |
| 67 | + Map<String, dynamic> toJson() => { | |
| 68 | + "comments": comments, | |
| 69 | + "comments_url": commentsUrl, | |
| 70 | + "commits_url": commitsUrl, | |
| 71 | + "created_at": createdAt.toIso8601String(), | |
| 72 | + "description": description, | |
| 73 | + "files": Map.from(files).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 74 | + "forks_url": forksUrl, | |
| 75 | + "git_pull_url": gitPullUrl, | |
| 76 | + "git_push_url": gitPushUrl, | |
| 77 | + "html_url": htmlUrl, | |
| 78 | + "id": id, | |
| 79 | + "public": public, | |
| 80 | + "truncated": truncated, | |
| 81 | + "updated_at": updatedAt.toIso8601String(), | |
| 82 | + "url": url, | |
| 83 | + "user": user, | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class FileValue { | |
| 88 | + final String filename; | |
| 89 | + final Language? language; | |
| 90 | + final String rawUrl; | |
| 91 | + final int size; | |
| 92 | + final Type type; | |
| 93 | + | |
| 94 | + FileValue({ | |
| 95 | + required this.filename, | |
| 96 | + required this.language, | |
| 97 | + required this.rawUrl, | |
| 98 | + required this.size, | |
| 99 | + required this.type, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory FileValue.fromJson(Map<String, dynamic> json) => FileValue( | |
| 103 | + filename: json["filename"], | |
| 104 | + language: languageValues.map[json["language"]], | |
| 105 | + rawUrl: json["raw_url"], | |
| 106 | + size: json["size"], | |
| 107 | + type: typeValues.map[json["type"]]!, | |
| 108 | + ); | |
| 109 | + | |
| 110 | + Map<String, dynamic> toJson() => { | |
| 111 | + "filename": filename, | |
| 112 | + "language": languageValues.reverse[language], | |
| 113 | + "raw_url": rawUrl, | |
| 114 | + "size": size, | |
| 115 | + "type": typeValues.reverse[type], | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +enum Language { | |
| 120 | + MARKDOWN | |
| 121 | +} | |
| 122 | + | |
| 123 | +final languageValues = EnumValues({ | |
| 124 | + "Markdown": Language.MARKDOWN | |
| 125 | +}); | |
| 126 | + | |
| 127 | +enum Type { | |
| 128 | + TEXT_PLAIN | |
| 129 | +} | |
| 130 | + | |
| 131 | +final typeValues = EnumValues({ | |
| 132 | + "text/plain": Type.TEXT_PLAIN | |
| 133 | +}); | |
| 134 | + | |
| 135 | +class EnumValues<T> { | |
| 136 | + Map<String, T> map; | |
| 137 | + late Map<T, String> reverseMap; | |
| 138 | + | |
| 139 | + EnumValues(this.map); | |
| 140 | + | |
| 141 | + Map<T, String> get reverse { | |
| 142 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 143 | + return reverseMap; | |
| 144 | + } | |
| 145 | +} |
Test case
1 generated file · +121 −0test/inputs/json/misc/7fbfb.json
Adartdefault / TopLevel.dart+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<dynamic> topLevelFromJson(String str) => List<dynamic>.from(json.decode(str).map((x) => x)); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<dynamic> data) => json.encode(List<dynamic>.from(data.map((x) => x))); | |
| 10 | + | |
| 11 | +class TopLevelElement { | |
| 12 | + final Country country; | |
| 13 | + final String date; | |
| 14 | + final String decimal; | |
| 15 | + final Country indicator; | |
| 16 | + final String value; | |
| 17 | + | |
| 18 | + TopLevelElement({ | |
| 19 | + required this.country, | |
| 20 | + required this.date, | |
| 21 | + required this.decimal, | |
| 22 | + required this.indicator, | |
| 23 | + required this.value, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevelElement.fromJson(Map<String, dynamic> json) => TopLevelElement( | |
| 27 | + country: Country.fromJson(json["country"]), | |
| 28 | + date: json["date"], | |
| 29 | + decimal: json["decimal"], | |
| 30 | + indicator: Country.fromJson(json["indicator"]), | |
| 31 | + value: json["value"], | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "country": country.toJson(), | |
| 36 | + "date": date, | |
| 37 | + "decimal": decimal, | |
| 38 | + "indicator": indicator.toJson(), | |
| 39 | + "value": value, | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class Country { | |
| 44 | + final Id id; | |
| 45 | + final Value value; | |
| 46 | + | |
| 47 | + Country({ | |
| 48 | + required this.id, | |
| 49 | + required this.value, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory Country.fromJson(Map<String, dynamic> json) => Country( | |
| 53 | + id: idValues.map[json["id"]]!, | |
| 54 | + value: valueValues.map[json["value"]]!, | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + "id": idValues.reverse[id], | |
| 59 | + "value": valueValues.reverse[value], | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +enum Id { | |
| 64 | + CN, | |
| 65 | + NY_GDP_MKTP_CD | |
| 66 | +} | |
| 67 | + | |
| 68 | +final idValues = EnumValues({ | |
| 69 | + "CN": Id.CN, | |
| 70 | + "NY.GDP.MKTP.CD": Id.NY_GDP_MKTP_CD | |
| 71 | +}); | |
| 72 | + | |
| 73 | +enum Value { | |
| 74 | + CHINA, | |
| 75 | + GDP_CURRENT_US | |
| 76 | +} | |
| 77 | + | |
| 78 | +final valueValues = EnumValues({ | |
| 79 | + "China": Value.CHINA, | |
| 80 | + "GDP (current US\u0024)": Value.GDP_CURRENT_US | |
| 81 | +}); | |
| 82 | + | |
| 83 | +class PurpleTopLevel { | |
| 84 | + final int page; | |
| 85 | + final int pages; | |
| 86 | + final String perPage; | |
| 87 | + final int total; | |
| 88 | + | |
| 89 | + PurpleTopLevel({ | |
| 90 | + required this.page, | |
| 91 | + required this.pages, | |
| 92 | + required this.perPage, | |
| 93 | + required this.total, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory PurpleTopLevel.fromJson(Map<String, dynamic> json) => PurpleTopLevel( | |
| 97 | + page: json["page"], | |
| 98 | + pages: json["pages"], | |
| 99 | + perPage: json["per_page"], | |
| 100 | + total: json["total"], | |
| 101 | + ); | |
| 102 | + | |
| 103 | + Map<String, dynamic> toJson() => { | |
| 104 | + "page": page, | |
| 105 | + "pages": pages, | |
| 106 | + "per_page": perPage, | |
| 107 | + "total": total, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class EnumValues<T> { | |
| 112 | + Map<String, T> map; | |
| 113 | + late Map<T, String> reverseMap; | |
| 114 | + | |
| 115 | + EnumValues(this.map); | |
| 116 | + | |
| 117 | + Map<T, String> get reverse { | |
| 118 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 119 | + return reverseMap; | |
| 120 | + } | |
| 121 | +} |
Test case
1 generated file · +99 −0test/inputs/json/misc/80aff.json
Adartdefault / TopLevel.dart+99 −0
| @@ -0,0 +1,99 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final bool next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final DateTime createdAt; | |
| 63 | + final int id; | |
| 64 | + final int items; | |
| 65 | + final String name; | |
| 66 | + final int? parent; | |
| 67 | + final DateTime updatedAt; | |
| 68 | + final String uri; | |
| 69 | + | |
| 70 | + Result({ | |
| 71 | + required this.createdAt, | |
| 72 | + required this.id, | |
| 73 | + required this.items, | |
| 74 | + required this.name, | |
| 75 | + required this.parent, | |
| 76 | + required this.updatedAt, | |
| 77 | + required this.uri, | |
| 78 | + }); | |
| 79 | + | |
| 80 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 81 | + createdAt: DateTime.parse(json["created_at"]), | |
| 82 | + id: json["id"], | |
| 83 | + items: json["items"], | |
| 84 | + name: json["name"], | |
| 85 | + parent: json["parent"], | |
| 86 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 87 | + uri: json["uri"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "created_at": createdAt.toIso8601String(), | |
| 92 | + "id": id, | |
| 93 | + "items": items, | |
| 94 | + "name": name, | |
| 95 | + "parent": parent, | |
| 96 | + "updated_at": updatedAt.toIso8601String(), | |
| 97 | + "uri": uri, | |
| 98 | + }; | |
| 99 | +} |
Test case
1 generated file · +25 −0test/inputs/json/misc/82509.json
Adartdefault / TopLevel.dart+25 −0
| @@ -0,0 +1,25 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String origin; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.origin, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + origin: json["origin"], | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "origin": origin, | |
| 24 | + }; | |
| 25 | +} |
Test case
1 generated file · +497 −0test/inputs/json/misc/8592b.json
Adartdefault / TopLevel.dart+497 −0
| @@ -0,0 +1,497 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final String? authorFlairCssClass; | |
| 85 | + final String? authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final dynamic distinguished; | |
| 96 | + final String domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final String linkFlairCssClass; | |
| 107 | + final String linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final dynamic media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final PostHint? postHint; | |
| 118 | + final Preview? preview; | |
| 119 | + final bool quarantine; | |
| 120 | + final dynamic removalReason; | |
| 121 | + final dynamic reportReasons; | |
| 122 | + final bool saved; | |
| 123 | + final int score; | |
| 124 | + final dynamic secureMedia; | |
| 125 | + final MediaEmbed secureMediaEmbed; | |
| 126 | + final String selftext; | |
| 127 | + final String? selftextHtml; | |
| 128 | + final bool spoiler; | |
| 129 | + final bool stickied; | |
| 130 | + final Subreddit subreddit; | |
| 131 | + final SubredditId subredditId; | |
| 132 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 133 | + final SubredditType subredditType; | |
| 134 | + final SuggestedSort suggestedSort; | |
| 135 | + final String thumbnail; | |
| 136 | + final int? thumbnailHeight; | |
| 137 | + final int? thumbnailWidth; | |
| 138 | + final String title; | |
| 139 | + final int ups; | |
| 140 | + final String url; | |
| 141 | + final List<dynamic> userReports; | |
| 142 | + final dynamic viewCount; | |
| 143 | + final bool visited; | |
| 144 | + | |
| 145 | + ChildData({ | |
| 146 | + required this.approvedAtUtc, | |
| 147 | + required this.approvedBy, | |
| 148 | + required this.archived, | |
| 149 | + required this.author, | |
| 150 | + required this.authorFlairCssClass, | |
| 151 | + required this.authorFlairText, | |
| 152 | + required this.bannedAtUtc, | |
| 153 | + required this.bannedBy, | |
| 154 | + required this.brandSafe, | |
| 155 | + required this.canGild, | |
| 156 | + required this.canModPost, | |
| 157 | + required this.clicked, | |
| 158 | + required this.contestMode, | |
| 159 | + required this.created, | |
| 160 | + required this.createdUtc, | |
| 161 | + required this.distinguished, | |
| 162 | + required this.domain, | |
| 163 | + required this.downs, | |
| 164 | + required this.edited, | |
| 165 | + required this.gilded, | |
| 166 | + required this.hidden, | |
| 167 | + required this.hideScore, | |
| 168 | + required this.id, | |
| 169 | + required this.isSelf, | |
| 170 | + required this.isVideo, | |
| 171 | + required this.likes, | |
| 172 | + required this.linkFlairCssClass, | |
| 173 | + required this.linkFlairText, | |
| 174 | + required this.locked, | |
| 175 | + required this.media, | |
| 176 | + required this.mediaEmbed, | |
| 177 | + required this.modReports, | |
| 178 | + required this.name, | |
| 179 | + required this.numComments, | |
| 180 | + required this.numReports, | |
| 181 | + required this.over18, | |
| 182 | + required this.permalink, | |
| 183 | + this.postHint, | |
| 184 | + this.preview, | |
| 185 | + required this.quarantine, | |
| 186 | + required this.removalReason, | |
| 187 | + required this.reportReasons, | |
| 188 | + required this.saved, | |
| 189 | + required this.score, | |
| 190 | + required this.secureMedia, | |
| 191 | + required this.secureMediaEmbed, | |
| 192 | + required this.selftext, | |
| 193 | + required this.selftextHtml, | |
| 194 | + required this.spoiler, | |
| 195 | + required this.stickied, | |
| 196 | + required this.subreddit, | |
| 197 | + required this.subredditId, | |
| 198 | + required this.subredditNamePrefixed, | |
| 199 | + required this.subredditType, | |
| 200 | + required this.suggestedSort, | |
| 201 | + required this.thumbnail, | |
| 202 | + required this.thumbnailHeight, | |
| 203 | + required this.thumbnailWidth, | |
| 204 | + required this.title, | |
| 205 | + required this.ups, | |
| 206 | + required this.url, | |
| 207 | + required this.userReports, | |
| 208 | + required this.viewCount, | |
| 209 | + required this.visited, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 213 | + approvedAtUtc: json["approved_at_utc"], | |
| 214 | + approvedBy: json["approved_by"], | |
| 215 | + archived: json["archived"], | |
| 216 | + author: json["author"], | |
| 217 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 218 | + authorFlairText: json["author_flair_text"], | |
| 219 | + bannedAtUtc: json["banned_at_utc"], | |
| 220 | + bannedBy: json["banned_by"], | |
| 221 | + brandSafe: json["brand_safe"], | |
| 222 | + canGild: json["can_gild"], | |
| 223 | + canModPost: json["can_mod_post"], | |
| 224 | + clicked: json["clicked"], | |
| 225 | + contestMode: json["contest_mode"], | |
| 226 | + created: json["created"]?.toDouble(), | |
| 227 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 228 | + distinguished: json["distinguished"], | |
| 229 | + domain: json["domain"], | |
| 230 | + downs: json["downs"], | |
| 231 | + edited: json["edited"], | |
| 232 | + gilded: json["gilded"], | |
| 233 | + hidden: json["hidden"], | |
| 234 | + hideScore: json["hide_score"], | |
| 235 | + id: json["id"], | |
| 236 | + isSelf: json["is_self"], | |
| 237 | + isVideo: json["is_video"], | |
| 238 | + likes: json["likes"], | |
| 239 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 240 | + linkFlairText: json["link_flair_text"], | |
| 241 | + locked: json["locked"], | |
| 242 | + media: json["media"], | |
| 243 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 244 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 245 | + name: json["name"], | |
| 246 | + numComments: json["num_comments"], | |
| 247 | + numReports: json["num_reports"], | |
| 248 | + over18: json["over_18"], | |
| 249 | + permalink: json["permalink"], | |
| 250 | + postHint: postHintValues.map[json["post_hint"]], | |
| 251 | + preview: json["preview"] == null ? null : Preview.fromJson(json["preview"]), | |
| 252 | + quarantine: json["quarantine"], | |
| 253 | + removalReason: json["removal_reason"], | |
| 254 | + reportReasons: json["report_reasons"], | |
| 255 | + saved: json["saved"], | |
| 256 | + score: json["score"], | |
| 257 | + secureMedia: json["secure_media"], | |
| 258 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 259 | + selftext: json["selftext"], | |
| 260 | + selftextHtml: json["selftext_html"], | |
| 261 | + spoiler: json["spoiler"], | |
| 262 | + stickied: json["stickied"], | |
| 263 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 264 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 265 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 266 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 267 | + suggestedSort: suggestedSortValues.map[json["suggested_sort"]]!, | |
| 268 | + thumbnail: json["thumbnail"], | |
| 269 | + thumbnailHeight: json["thumbnail_height"], | |
| 270 | + thumbnailWidth: json["thumbnail_width"], | |
| 271 | + title: json["title"], | |
| 272 | + ups: json["ups"], | |
| 273 | + url: json["url"], | |
| 274 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 275 | + viewCount: json["view_count"], | |
| 276 | + visited: json["visited"], | |
| 277 | + ); | |
| 278 | + | |
| 279 | + Map<String, dynamic> toJson() => { | |
| 280 | + "approved_at_utc": approvedAtUtc, | |
| 281 | + "approved_by": approvedBy, | |
| 282 | + "archived": archived, | |
| 283 | + "author": author, | |
| 284 | + "author_flair_css_class": authorFlairCssClass, | |
| 285 | + "author_flair_text": authorFlairText, | |
| 286 | + "banned_at_utc": bannedAtUtc, | |
| 287 | + "banned_by": bannedBy, | |
| 288 | + "brand_safe": brandSafe, | |
| 289 | + "can_gild": canGild, | |
| 290 | + "can_mod_post": canModPost, | |
| 291 | + "clicked": clicked, | |
| 292 | + "contest_mode": contestMode, | |
| 293 | + "created": created, | |
| 294 | + "created_utc": createdUtc, | |
| 295 | + "distinguished": distinguished, | |
| 296 | + "domain": domain, | |
| 297 | + "downs": downs, | |
| 298 | + "edited": edited, | |
| 299 | + "gilded": gilded, | |
| 300 | + "hidden": hidden, | |
| 301 | + "hide_score": hideScore, | |
| 302 | + "id": id, | |
| 303 | + "is_self": isSelf, | |
| 304 | + "is_video": isVideo, | |
| 305 | + "likes": likes, | |
| 306 | + "link_flair_css_class": linkFlairCssClass, | |
| 307 | + "link_flair_text": linkFlairText, | |
| 308 | + "locked": locked, | |
| 309 | + "media": media, | |
| 310 | + "media_embed": mediaEmbed.toJson(), | |
| 311 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 312 | + "name": name, | |
| 313 | + "num_comments": numComments, | |
| 314 | + "num_reports": numReports, | |
| 315 | + "over_18": over18, | |
| 316 | + "permalink": permalink, | |
| 317 | + "post_hint": postHintValues.reverse[postHint], | |
| 318 | + "preview": preview?.toJson(), | |
| 319 | + "quarantine": quarantine, | |
| 320 | + "removal_reason": removalReason, | |
| 321 | + "report_reasons": reportReasons, | |
| 322 | + "saved": saved, | |
| 323 | + "score": score, | |
| 324 | + "secure_media": secureMedia, | |
| 325 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 326 | + "selftext": selftext, | |
| 327 | + "selftext_html": selftextHtml, | |
| 328 | + "spoiler": spoiler, | |
| 329 | + "stickied": stickied, | |
| 330 | + "subreddit": subredditValues.reverse[subreddit], | |
| 331 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 332 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 333 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 334 | + "suggested_sort": suggestedSortValues.reverse[suggestedSort], | |
| 335 | + "thumbnail": thumbnail, | |
| 336 | + "thumbnail_height": thumbnailHeight, | |
| 337 | + "thumbnail_width": thumbnailWidth, | |
| 338 | + "title": title, | |
| 339 | + "ups": ups, | |
| 340 | + "url": url, | |
| 341 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 342 | + "view_count": viewCount, | |
| 343 | + "visited": visited, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +class MediaEmbed { | |
| 348 | + MediaEmbed(); | |
| 349 | + | |
| 350 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 351 | + ); | |
| 352 | + | |
| 353 | + Map<String, dynamic> toJson() => { | |
| 354 | + }; | |
| 355 | +} | |
| 356 | + | |
| 357 | +enum PostHint { | |
| 358 | + LINK | |
| 359 | +} | |
| 360 | + | |
| 361 | +final postHintValues = EnumValues({ | |
| 362 | + "link": PostHint.LINK | |
| 363 | +}); | |
| 364 | + | |
| 365 | +class Preview { | |
| 366 | + final bool enabled; | |
| 367 | + final List<Image> images; | |
| 368 | + | |
| 369 | + Preview({ | |
| 370 | + required this.enabled, | |
| 371 | + required this.images, | |
| 372 | + }); | |
| 373 | + | |
| 374 | + factory Preview.fromJson(Map<String, dynamic> json) => Preview( | |
| 375 | + enabled: json["enabled"], | |
| 376 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 377 | + ); | |
| 378 | + | |
| 379 | + Map<String, dynamic> toJson() => { | |
| 380 | + "enabled": enabled, | |
| 381 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 382 | + }; | |
| 383 | +} | |
| 384 | + | |
| 385 | +class Image { | |
| 386 | + final String id; | |
| 387 | + final List<Source> resolutions; | |
| 388 | + final Source source; | |
| 389 | + final MediaEmbed variants; | |
| 390 | + | |
| 391 | + Image({ | |
| 392 | + required this.id, | |
| 393 | + required this.resolutions, | |
| 394 | + required this.source, | |
| 395 | + required this.variants, | |
| 396 | + }); | |
| 397 | + | |
| 398 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 399 | + id: json["id"], | |
| 400 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 401 | + source: Source.fromJson(json["source"]), | |
| 402 | + variants: MediaEmbed.fromJson(json["variants"]), | |
| 403 | + ); | |
| 404 | + | |
| 405 | + Map<String, dynamic> toJson() => { | |
| 406 | + "id": id, | |
| 407 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 408 | + "source": source.toJson(), | |
| 409 | + "variants": variants.toJson(), | |
| 410 | + }; | |
| 411 | +} | |
| 412 | + | |
| 413 | +class Source { | |
| 414 | + final int height; | |
| 415 | + final String url; | |
| 416 | + final int width; | |
| 417 | + | |
| 418 | + Source({ | |
| 419 | + required this.height, | |
| 420 | + required this.url, | |
| 421 | + required this.width, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory Source.fromJson(Map<String, dynamic> json) => Source( | |
| 425 | + height: json["height"], | |
| 426 | + url: json["url"], | |
| 427 | + width: json["width"], | |
| 428 | + ); | |
| 429 | + | |
| 430 | + Map<String, dynamic> toJson() => { | |
| 431 | + "height": height, | |
| 432 | + "url": url, | |
| 433 | + "width": width, | |
| 434 | + }; | |
| 435 | +} | |
| 436 | + | |
| 437 | +enum Subreddit { | |
| 438 | + SCIENCE | |
| 439 | +} | |
| 440 | + | |
| 441 | +final subredditValues = EnumValues({ | |
| 442 | + "science": Subreddit.SCIENCE | |
| 443 | +}); | |
| 444 | + | |
| 445 | +enum SubredditId { | |
| 446 | + T5_MOUW | |
| 447 | +} | |
| 448 | + | |
| 449 | +final subredditIdValues = EnumValues({ | |
| 450 | + "t5_mouw": SubredditId.T5_MOUW | |
| 451 | +}); | |
| 452 | + | |
| 453 | +enum SubredditNamePrefixed { | |
| 454 | + R_SCIENCE | |
| 455 | +} | |
| 456 | + | |
| 457 | +final subredditNamePrefixedValues = EnumValues({ | |
| 458 | + "r/science": SubredditNamePrefixed.R_SCIENCE | |
| 459 | +}); | |
| 460 | + | |
| 461 | +enum SubredditType { | |
| 462 | + PUBLIC | |
| 463 | +} | |
| 464 | + | |
| 465 | +final subredditTypeValues = EnumValues({ | |
| 466 | + "public": SubredditType.PUBLIC | |
| 467 | +}); | |
| 468 | + | |
| 469 | +enum SuggestedSort { | |
| 470 | + CONFIDENCE, | |
| 471 | + QA | |
| 472 | +} | |
| 473 | + | |
| 474 | +final suggestedSortValues = EnumValues({ | |
| 475 | + "confidence": SuggestedSort.CONFIDENCE, | |
| 476 | + "qa": SuggestedSort.QA | |
| 477 | +}); | |
| 478 | + | |
| 479 | +enum Kind { | |
| 480 | + T3 | |
| 481 | +} | |
| 482 | + | |
| 483 | +final kindValues = EnumValues({ | |
| 484 | + "t3": Kind.T3 | |
| 485 | +}); | |
| 486 | + | |
| 487 | +class EnumValues<T> { | |
| 488 | + Map<String, T> map; | |
| 489 | + late Map<T, String> reverseMap; | |
| 490 | + | |
| 491 | + EnumValues(this.map); | |
| 492 | + | |
| 493 | + Map<T, String> get reverse { | |
| 494 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 495 | + return reverseMap; | |
| 496 | + } | |
| 497 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/88130.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/8a62c.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +61 −0test/inputs/json/misc/908db.json
Adartdefault / TopLevel.dart+61 −0
| @@ -0,0 +1,61 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<StateElement> states; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.states, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + states: List<StateElement>.from(json["states"].map((x) => StateElement.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "states": List<dynamic>.from(states.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class StateElement { | |
| 28 | + final StateState state; | |
| 29 | + | |
| 30 | + StateElement({ | |
| 31 | + required this.state, | |
| 32 | + }); | |
| 33 | + | |
| 34 | + factory StateElement.fromJson(Map<String, dynamic> json) => StateElement( | |
| 35 | + state: StateState.fromJson(json["state"]), | |
| 36 | + ); | |
| 37 | + | |
| 38 | + Map<String, dynamic> toJson() => { | |
| 39 | + "state": state.toJson(), | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class StateState { | |
| 44 | + final String stateId; | |
| 45 | + final String stateName; | |
| 46 | + | |
| 47 | + StateState({ | |
| 48 | + required this.stateId, | |
| 49 | + required this.stateName, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory StateState.fromJson(Map<String, dynamic> json) => StateState( | |
| 53 | + stateId: json["state_id"], | |
| 54 | + stateName: json["state_name"], | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + "state_id": stateId, | |
| 59 | + "state_name": stateName, | |
| 60 | + }; | |
| 61 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/9617f.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/96f7c.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<String> git; | |
| 13 | + final String githubServicesSha; | |
| 14 | + final List<String> hooks; | |
| 15 | + final List<String> importer; | |
| 16 | + final List<String> pages; | |
| 17 | + final bool verifiablePasswordAuthentication; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.git, | |
| 21 | + required this.githubServicesSha, | |
| 22 | + required this.hooks, | |
| 23 | + required this.importer, | |
| 24 | + required this.pages, | |
| 25 | + required this.verifiablePasswordAuthentication, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + git: List<String>.from(json["git"].map((x) => x)), | |
| 30 | + githubServicesSha: json["github_services_sha"], | |
| 31 | + hooks: List<String>.from(json["hooks"].map((x) => x)), | |
| 32 | + importer: List<String>.from(json["importer"].map((x) => x)), | |
| 33 | + pages: List<String>.from(json["pages"].map((x) => x)), | |
| 34 | + verifiablePasswordAuthentication: json["verifiable_password_authentication"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "git": List<dynamic>.from(git.map((x) => x)), | |
| 39 | + "github_services_sha": githubServicesSha, | |
| 40 | + "hooks": List<dynamic>.from(hooks.map((x) => x)), | |
| 41 | + "importer": List<dynamic>.from(importer.map((x) => x)), | |
| 42 | + "pages": List<dynamic>.from(pages.map((x) => x)), | |
| 43 | + "verifiable_password_authentication": verifiablePasswordAuthentication, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +29 −0test/inputs/json/misc/9847b.json
Adartdefault / TopLevel.dart+29 −0
| @@ -0,0 +1,29 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final String name; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.id, | |
| 17 | + required this.name, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + id: json["id"], | |
| 22 | + name: json["name"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "id": id, | |
| 27 | + "name": name, | |
| 28 | + }; | |
| 29 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/9929c.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +175 −0test/inputs/json/misc/996bd.json
Adartdefault / TopLevel.dart+175 −0
| @@ -0,0 +1,175 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final String? supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + DEP5, | |
| 77 | + SPDX, | |
| 78 | + TROVE | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "DEP5": Scheme.DEP5, | |
| 83 | + "SPDX": Scheme.SPDX, | |
| 84 | + "Trove": Scheme.TROVE | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + OSI_APPROVED, | |
| 89 | + POPULAR, | |
| 90 | + COPYLEFT, | |
| 91 | + INTERNATIONAL | |
| 92 | +} | |
| 93 | + | |
| 94 | +final keywordValues = EnumValues({ | |
| 95 | + "osi-approved": Keyword.OSI_APPROVED, | |
| 96 | + "popular": Keyword.POPULAR, | |
| 97 | + "copyleft": Keyword.COPYLEFT, | |
| 98 | + "international": Keyword.INTERNATIONAL | |
| 99 | +}); | |
| 100 | + | |
| 101 | +class Link { | |
| 102 | + final String note; | |
| 103 | + final String url; | |
| 104 | + | |
| 105 | + Link({ | |
| 106 | + required this.note, | |
| 107 | + required this.url, | |
| 108 | + }); | |
| 109 | + | |
| 110 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 111 | + note: json["note"], | |
| 112 | + url: json["url"], | |
| 113 | + ); | |
| 114 | + | |
| 115 | + Map<String, dynamic> toJson() => { | |
| 116 | + "note": note, | |
| 117 | + "url": url, | |
| 118 | + }; | |
| 119 | +} | |
| 120 | + | |
| 121 | +class Text { | |
| 122 | + final MediaType mediaType; | |
| 123 | + final Title title; | |
| 124 | + final String url; | |
| 125 | + | |
| 126 | + Text({ | |
| 127 | + required this.mediaType, | |
| 128 | + required this.title, | |
| 129 | + required this.url, | |
| 130 | + }); | |
| 131 | + | |
| 132 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 133 | + mediaType: mediaTypeValues.map[json["media_type"]]!, | |
| 134 | + title: titleValues.map[json["title"]]!, | |
| 135 | + url: json["url"], | |
| 136 | + ); | |
| 137 | + | |
| 138 | + Map<String, dynamic> toJson() => { | |
| 139 | + "media_type": mediaTypeValues.reverse[mediaType], | |
| 140 | + "title": titleValues.reverse[title], | |
| 141 | + "url": url, | |
| 142 | + }; | |
| 143 | +} | |
| 144 | + | |
| 145 | +enum MediaType { | |
| 146 | + TEXT_PLAIN, | |
| 147 | + TEXT_HTML | |
| 148 | +} | |
| 149 | + | |
| 150 | +final mediaTypeValues = EnumValues({ | |
| 151 | + "text/plain": MediaType.TEXT_PLAIN, | |
| 152 | + "text/html": MediaType.TEXT_HTML | |
| 153 | +}); | |
| 154 | + | |
| 155 | +enum Title { | |
| 156 | + PLAIN_TEXT, | |
| 157 | + HTML | |
| 158 | +} | |
| 159 | + | |
| 160 | +final titleValues = EnumValues({ | |
| 161 | + "Plain Text": Title.PLAIN_TEXT, | |
| 162 | + "HTML": Title.HTML | |
| 163 | +}); | |
| 164 | + | |
| 165 | +class EnumValues<T> { | |
| 166 | + Map<String, T> map; | |
| 167 | + late Map<T, String> reverseMap; | |
| 168 | + | |
| 169 | + EnumValues(this.map); | |
| 170 | + | |
| 171 | + Map<T, String> get reverse { | |
| 172 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 173 | + return reverseMap; | |
| 174 | + } | |
| 175 | +} |
Test case
1 generated file · +141 −0test/inputs/json/misc/9a503.json
Adartdefault / TopLevel.dart+141 −0
| @@ -0,0 +1,141 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final dynamic supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final String scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: json["scheme"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": scheme, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Keyword { | |
| 76 | + DISCOURAGED, | |
| 77 | + RETIRED, | |
| 78 | + OSI_APPROVED | |
| 79 | +} | |
| 80 | + | |
| 81 | +final keywordValues = EnumValues({ | |
| 82 | + "discouraged": Keyword.DISCOURAGED, | |
| 83 | + "retired": Keyword.RETIRED, | |
| 84 | + "osi-approved": Keyword.OSI_APPROVED | |
| 85 | +}); | |
| 86 | + | |
| 87 | +class Link { | |
| 88 | + final String note; | |
| 89 | + final String url; | |
| 90 | + | |
| 91 | + Link({ | |
| 92 | + required this.note, | |
| 93 | + required this.url, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 97 | + note: json["note"], | |
| 98 | + url: json["url"], | |
| 99 | + ); | |
| 100 | + | |
| 101 | + Map<String, dynamic> toJson() => { | |
| 102 | + "note": note, | |
| 103 | + "url": url, | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Text { | |
| 108 | + final String mediaType; | |
| 109 | + final String title; | |
| 110 | + final String url; | |
| 111 | + | |
| 112 | + Text({ | |
| 113 | + required this.mediaType, | |
| 114 | + required this.title, | |
| 115 | + required this.url, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 119 | + mediaType: json["media_type"], | |
| 120 | + title: json["title"], | |
| 121 | + url: json["url"], | |
| 122 | + ); | |
| 123 | + | |
| 124 | + Map<String, dynamic> toJson() => { | |
| 125 | + "media_type": mediaType, | |
| 126 | + "title": title, | |
| 127 | + "url": url, | |
| 128 | + }; | |
| 129 | +} | |
| 130 | + | |
| 131 | +class EnumValues<T> { | |
| 132 | + Map<String, T> map; | |
| 133 | + late Map<T, String> reverseMap; | |
| 134 | + | |
| 135 | + EnumValues(this.map); | |
| 136 | + | |
| 137 | + Map<T, String> get reverse { | |
| 138 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 139 | + return reverseMap; | |
| 140 | + } | |
| 141 | +} |
Test case
1 generated file · +147 −0test/inputs/json/misc/9ac3b.json
Adartdefault / TopLevel.dart+147 −0
| @@ -0,0 +1,147 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final String next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final DateTime createdAt; | |
| 63 | + final String entity; | |
| 64 | + final String firstName; | |
| 65 | + final String id; | |
| 66 | + final String lastName; | |
| 67 | + final String name; | |
| 68 | + final String? position; | |
| 69 | + final Status status; | |
| 70 | + final Title? title; | |
| 71 | + final DateTime updatedAt; | |
| 72 | + final String uri; | |
| 73 | + | |
| 74 | + Result({ | |
| 75 | + required this.createdAt, | |
| 76 | + required this.entity, | |
| 77 | + required this.firstName, | |
| 78 | + required this.id, | |
| 79 | + required this.lastName, | |
| 80 | + required this.name, | |
| 81 | + required this.position, | |
| 82 | + required this.status, | |
| 83 | + required this.title, | |
| 84 | + required this.updatedAt, | |
| 85 | + required this.uri, | |
| 86 | + }); | |
| 87 | + | |
| 88 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 89 | + createdAt: DateTime.parse(json["created_at"]), | |
| 90 | + entity: json["entity"], | |
| 91 | + firstName: json["first_name"], | |
| 92 | + id: json["id"], | |
| 93 | + lastName: json["last_name"], | |
| 94 | + name: json["name"], | |
| 95 | + position: json["position"], | |
| 96 | + status: statusValues.map[json["status"]]!, | |
| 97 | + title: titleValues.map[json["title"]], | |
| 98 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 99 | + uri: json["uri"], | |
| 100 | + ); | |
| 101 | + | |
| 102 | + Map<String, dynamic> toJson() => { | |
| 103 | + "created_at": createdAt.toIso8601String(), | |
| 104 | + "entity": entity, | |
| 105 | + "first_name": firstName, | |
| 106 | + "id": id, | |
| 107 | + "last_name": lastName, | |
| 108 | + "name": name, | |
| 109 | + "position": position, | |
| 110 | + "status": statusValues.reverse[status], | |
| 111 | + "title": titleValues.reverse[title], | |
| 112 | + "updated_at": updatedAt.toIso8601String(), | |
| 113 | + "uri": uri, | |
| 114 | + }; | |
| 115 | +} | |
| 116 | + | |
| 117 | +enum Status { | |
| 118 | + INACTIVE, | |
| 119 | + ACTIVE | |
| 120 | +} | |
| 121 | + | |
| 122 | +final statusValues = EnumValues({ | |
| 123 | + "inactive": Status.INACTIVE, | |
| 124 | + "active": Status.ACTIVE | |
| 125 | +}); | |
| 126 | + | |
| 127 | +enum Title { | |
| 128 | + MR, | |
| 129 | + MS | |
| 130 | +} | |
| 131 | + | |
| 132 | +final titleValues = EnumValues({ | |
| 133 | + "Mr": Title.MR, | |
| 134 | + "Ms": Title.MS | |
| 135 | +}); | |
| 136 | + | |
| 137 | +class EnumValues<T> { | |
| 138 | + Map<String, T> map; | |
| 139 | + late Map<T, String> reverseMap; | |
| 140 | + | |
| 141 | + EnumValues(this.map); | |
| 142 | + | |
| 143 | + Map<T, String> get reverse { | |
| 144 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 145 | + return reverseMap; | |
| 146 | + } | |
| 147 | +} |
Test case
1 generated file · +139 −0test/inputs/json/misc/9eed5.json
Adartdefault / TopLevel.dart+139 −0
| @@ -0,0 +1,139 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<dynamic> otherNames; | |
| 18 | + final dynamic supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<dynamic>.from(json["other_names"].map((x) => x)), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x)), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final String scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: json["scheme"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": scheme, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Keyword { | |
| 76 | + SPECIAL_PURPOSE, | |
| 77 | + OSI_APPROVED | |
| 78 | +} | |
| 79 | + | |
| 80 | +final keywordValues = EnumValues({ | |
| 81 | + "special-purpose": Keyword.SPECIAL_PURPOSE, | |
| 82 | + "osi-approved": Keyword.OSI_APPROVED | |
| 83 | +}); | |
| 84 | + | |
| 85 | +class Link { | |
| 86 | + final String note; | |
| 87 | + final String url; | |
| 88 | + | |
| 89 | + Link({ | |
| 90 | + required this.note, | |
| 91 | + required this.url, | |
| 92 | + }); | |
| 93 | + | |
| 94 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 95 | + note: json["note"], | |
| 96 | + url: json["url"], | |
| 97 | + ); | |
| 98 | + | |
| 99 | + Map<String, dynamic> toJson() => { | |
| 100 | + "note": note, | |
| 101 | + "url": url, | |
| 102 | + }; | |
| 103 | +} | |
| 104 | + | |
| 105 | +class Text { | |
| 106 | + final String mediaType; | |
| 107 | + final String title; | |
| 108 | + final String url; | |
| 109 | + | |
| 110 | + Text({ | |
| 111 | + required this.mediaType, | |
| 112 | + required this.title, | |
| 113 | + required this.url, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 117 | + mediaType: json["media_type"], | |
| 118 | + title: json["title"], | |
| 119 | + url: json["url"], | |
| 120 | + ); | |
| 121 | + | |
| 122 | + Map<String, dynamic> toJson() => { | |
| 123 | + "media_type": mediaType, | |
| 124 | + "title": title, | |
| 125 | + "url": url, | |
| 126 | + }; | |
| 127 | +} | |
| 128 | + | |
| 129 | +class EnumValues<T> { | |
| 130 | + Map<String, T> map; | |
| 131 | + late Map<T, String> reverseMap; | |
| 132 | + | |
| 133 | + EnumValues(this.map); | |
| 134 | + | |
| 135 | + Map<T, String> get reverse { | |
| 136 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 137 | + return reverseMap; | |
| 138 | + } | |
| 139 | +} |
Test case
1 generated file · +99 −0test/inputs/json/misc/a0496.json
Adartdefault / TopLevel.dart+99 −0
| @@ -0,0 +1,99 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String code; | |
| 13 | + final List<String> columnNames; | |
| 14 | + final List<List<dynamic>> data; | |
| 15 | + final String description; | |
| 16 | + final String displayUrl; | |
| 17 | + final Errors errors; | |
| 18 | + final String frequency; | |
| 19 | + final DateTime fromDate; | |
| 20 | + final int id; | |
| 21 | + final String name; | |
| 22 | + final bool premium; | |
| 23 | + final String sourceCode; | |
| 24 | + final String sourceName; | |
| 25 | + final DateTime toDate; | |
| 26 | + final String type; | |
| 27 | + final DateTime updatedAt; | |
| 28 | + final String urlizeName; | |
| 29 | + | |
| 30 | + TopLevel({ | |
| 31 | + required this.code, | |
| 32 | + required this.columnNames, | |
| 33 | + required this.data, | |
| 34 | + required this.description, | |
| 35 | + required this.displayUrl, | |
| 36 | + required this.errors, | |
| 37 | + required this.frequency, | |
| 38 | + required this.fromDate, | |
| 39 | + required this.id, | |
| 40 | + required this.name, | |
| 41 | + required this.premium, | |
| 42 | + required this.sourceCode, | |
| 43 | + required this.sourceName, | |
| 44 | + required this.toDate, | |
| 45 | + required this.type, | |
| 46 | + required this.updatedAt, | |
| 47 | + required this.urlizeName, | |
| 48 | + }); | |
| 49 | + | |
| 50 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 51 | + code: json["code"], | |
| 52 | + columnNames: List<String>.from(json["column_names"].map((x) => x)), | |
| 53 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 54 | + description: json["description"], | |
| 55 | + displayUrl: json["display_url"], | |
| 56 | + errors: Errors.fromJson(json["errors"]), | |
| 57 | + frequency: json["frequency"], | |
| 58 | + fromDate: DateTime.parse(json["from_date"]), | |
| 59 | + id: json["id"], | |
| 60 | + name: json["name"], | |
| 61 | + premium: json["premium"], | |
| 62 | + sourceCode: json["source_code"], | |
| 63 | + sourceName: json["source_name"], | |
| 64 | + toDate: DateTime.parse(json["to_date"]), | |
| 65 | + type: json["type"], | |
| 66 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 67 | + urlizeName: json["urlize_name"], | |
| 68 | + ); | |
| 69 | + | |
| 70 | + Map<String, dynamic> toJson() => { | |
| 71 | + "code": code, | |
| 72 | + "column_names": List<dynamic>.from(columnNames.map((x) => x)), | |
| 73 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 74 | + "description": description, | |
| 75 | + "display_url": displayUrl, | |
| 76 | + "errors": errors.toJson(), | |
| 77 | + "frequency": frequency, | |
| 78 | + "from_date": "${fromDate.year.toString().padLeft(4, '0')}-${fromDate.month.toString().padLeft(2, '0')}-${fromDate.day.toString().padLeft(2, '0')}", | |
| 79 | + "id": id, | |
| 80 | + "name": name, | |
| 81 | + "premium": premium, | |
| 82 | + "source_code": sourceCode, | |
| 83 | + "source_name": sourceName, | |
| 84 | + "to_date": "${toDate.year.toString().padLeft(4, '0')}-${toDate.month.toString().padLeft(2, '0')}-${toDate.day.toString().padLeft(2, '0')}", | |
| 85 | + "type": type, | |
| 86 | + "updated_at": updatedAt.toIso8601String(), | |
| 87 | + "urlize_name": urlizeName, | |
| 88 | + }; | |
| 89 | +} | |
| 90 | + | |
| 91 | +class Errors { | |
| 92 | + Errors(); | |
| 93 | + | |
| 94 | + factory Errors.fromJson(Map<String, dynamic> json) => Errors( | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + }; | |
| 99 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/a1eca.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +483 −0test/inputs/json/misc/a3d8c.json
Adartdefault / TopLevel.dart+483 −0
| @@ -0,0 +1,483 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final int averageRating; | |
| 49 | + final String category; | |
| 50 | + final List<Column> columns; | |
| 51 | + final int createdAt; | |
| 52 | + final String displayType; | |
| 53 | + final int downloadCount; | |
| 54 | + final List<String> flags; | |
| 55 | + final List<Grant> grants; | |
| 56 | + final bool hideFromCatalog; | |
| 57 | + final bool hideFromDataJson; | |
| 58 | + final String id; | |
| 59 | + final int indexUpdatedAt; | |
| 60 | + final License license; | |
| 61 | + final String licenseId; | |
| 62 | + final String locale; | |
| 63 | + final Metadata metadata; | |
| 64 | + final String name; | |
| 65 | + final bool newBackend; | |
| 66 | + final int numberOfComments; | |
| 67 | + final int oid; | |
| 68 | + final Owner owner; | |
| 69 | + final String provenance; | |
| 70 | + final bool publicationAppendEnabled; | |
| 71 | + final int publicationDate; | |
| 72 | + final int publicationGroup; | |
| 73 | + final String publicationStage; | |
| 74 | + final Query query; | |
| 75 | + final List<String> rights; | |
| 76 | + final String rowClass; | |
| 77 | + final int rowsUpdatedAt; | |
| 78 | + final String rowsUpdatedBy; | |
| 79 | + final Owner tableAuthor; | |
| 80 | + final int tableId; | |
| 81 | + final int totalTimesRated; | |
| 82 | + final int viewCount; | |
| 83 | + final int viewLastModified; | |
| 84 | + final String viewType; | |
| 85 | + | |
| 86 | + View({ | |
| 87 | + required this.averageRating, | |
| 88 | + required this.category, | |
| 89 | + required this.columns, | |
| 90 | + required this.createdAt, | |
| 91 | + required this.displayType, | |
| 92 | + required this.downloadCount, | |
| 93 | + required this.flags, | |
| 94 | + required this.grants, | |
| 95 | + required this.hideFromCatalog, | |
| 96 | + required this.hideFromDataJson, | |
| 97 | + required this.id, | |
| 98 | + required this.indexUpdatedAt, | |
| 99 | + required this.license, | |
| 100 | + required this.licenseId, | |
| 101 | + required this.locale, | |
| 102 | + required this.metadata, | |
| 103 | + required this.name, | |
| 104 | + required this.newBackend, | |
| 105 | + required this.numberOfComments, | |
| 106 | + required this.oid, | |
| 107 | + required this.owner, | |
| 108 | + required this.provenance, | |
| 109 | + required this.publicationAppendEnabled, | |
| 110 | + required this.publicationDate, | |
| 111 | + required this.publicationGroup, | |
| 112 | + required this.publicationStage, | |
| 113 | + required this.query, | |
| 114 | + required this.rights, | |
| 115 | + required this.rowClass, | |
| 116 | + required this.rowsUpdatedAt, | |
| 117 | + required this.rowsUpdatedBy, | |
| 118 | + required this.tableAuthor, | |
| 119 | + required this.tableId, | |
| 120 | + required this.totalTimesRated, | |
| 121 | + required this.viewCount, | |
| 122 | + required this.viewLastModified, | |
| 123 | + required this.viewType, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 127 | + averageRating: json["averageRating"], | |
| 128 | + category: json["category"], | |
| 129 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 130 | + createdAt: json["createdAt"], | |
| 131 | + displayType: json["displayType"], | |
| 132 | + downloadCount: json["downloadCount"], | |
| 133 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 134 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 135 | + hideFromCatalog: json["hideFromCatalog"], | |
| 136 | + hideFromDataJson: json["hideFromDataJson"], | |
| 137 | + id: json["id"], | |
| 138 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 139 | + license: License.fromJson(json["license"]), | |
| 140 | + licenseId: json["licenseId"], | |
| 141 | + locale: json["locale"], | |
| 142 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 143 | + name: json["name"], | |
| 144 | + newBackend: json["newBackend"], | |
| 145 | + numberOfComments: json["numberOfComments"], | |
| 146 | + oid: json["oid"], | |
| 147 | + owner: Owner.fromJson(json["owner"]), | |
| 148 | + provenance: json["provenance"], | |
| 149 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 150 | + publicationDate: json["publicationDate"], | |
| 151 | + publicationGroup: json["publicationGroup"], | |
| 152 | + publicationStage: json["publicationStage"], | |
| 153 | + query: Query.fromJson(json["query"]), | |
| 154 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 155 | + rowClass: json["rowClass"], | |
| 156 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 157 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 158 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 159 | + tableId: json["tableId"], | |
| 160 | + totalTimesRated: json["totalTimesRated"], | |
| 161 | + viewCount: json["viewCount"], | |
| 162 | + viewLastModified: json["viewLastModified"], | |
| 163 | + viewType: json["viewType"], | |
| 164 | + ); | |
| 165 | + | |
| 166 | + Map<String, dynamic> toJson() => { | |
| 167 | + "averageRating": averageRating, | |
| 168 | + "category": category, | |
| 169 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 170 | + "createdAt": createdAt, | |
| 171 | + "displayType": displayType, | |
| 172 | + "downloadCount": downloadCount, | |
| 173 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 174 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 175 | + "hideFromCatalog": hideFromCatalog, | |
| 176 | + "hideFromDataJson": hideFromDataJson, | |
| 177 | + "id": id, | |
| 178 | + "indexUpdatedAt": indexUpdatedAt, | |
| 179 | + "license": license.toJson(), | |
| 180 | + "licenseId": licenseId, | |
| 181 | + "locale": locale, | |
| 182 | + "metadata": metadata.toJson(), | |
| 183 | + "name": name, | |
| 184 | + "newBackend": newBackend, | |
| 185 | + "numberOfComments": numberOfComments, | |
| 186 | + "oid": oid, | |
| 187 | + "owner": owner.toJson(), | |
| 188 | + "provenance": provenance, | |
| 189 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 190 | + "publicationDate": publicationDate, | |
| 191 | + "publicationGroup": publicationGroup, | |
| 192 | + "publicationStage": publicationStage, | |
| 193 | + "query": query.toJson(), | |
| 194 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 195 | + "rowClass": rowClass, | |
| 196 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 197 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 198 | + "tableAuthor": tableAuthor.toJson(), | |
| 199 | + "tableId": tableId, | |
| 200 | + "totalTimesRated": totalTimesRated, | |
| 201 | + "viewCount": viewCount, | |
| 202 | + "viewLastModified": viewLastModified, | |
| 203 | + "viewType": viewType, | |
| 204 | + }; | |
| 205 | +} | |
| 206 | + | |
| 207 | +class Column { | |
| 208 | + final CachedContents? cachedContents; | |
| 209 | + final TypeName dataTypeName; | |
| 210 | + final String fieldName; | |
| 211 | + final List<String>? flags; | |
| 212 | + final Query format; | |
| 213 | + final int id; | |
| 214 | + final String name; | |
| 215 | + final int position; | |
| 216 | + final TypeName renderTypeName; | |
| 217 | + final int? tableColumnId; | |
| 218 | + final int? width; | |
| 219 | + | |
| 220 | + Column({ | |
| 221 | + this.cachedContents, | |
| 222 | + required this.dataTypeName, | |
| 223 | + required this.fieldName, | |
| 224 | + this.flags, | |
| 225 | + required this.format, | |
| 226 | + required this.id, | |
| 227 | + required this.name, | |
| 228 | + required this.position, | |
| 229 | + required this.renderTypeName, | |
| 230 | + this.tableColumnId, | |
| 231 | + this.width, | |
| 232 | + }); | |
| 233 | + | |
| 234 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 235 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 236 | + dataTypeName: typeNameValues.map[json["dataTypeName"]]!, | |
| 237 | + fieldName: json["fieldName"], | |
| 238 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 239 | + format: Query.fromJson(json["format"]), | |
| 240 | + id: json["id"], | |
| 241 | + name: json["name"], | |
| 242 | + position: json["position"], | |
| 243 | + renderTypeName: typeNameValues.map[json["renderTypeName"]]!, | |
| 244 | + tableColumnId: json["tableColumnId"], | |
| 245 | + width: json["width"], | |
| 246 | + ); | |
| 247 | + | |
| 248 | + Map<String, dynamic> toJson() => { | |
| 249 | + "cachedContents": cachedContents?.toJson(), | |
| 250 | + "dataTypeName": typeNameValues.reverse[dataTypeName], | |
| 251 | + "fieldName": fieldName, | |
| 252 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 253 | + "format": format.toJson(), | |
| 254 | + "id": id, | |
| 255 | + "name": name, | |
| 256 | + "position": position, | |
| 257 | + "renderTypeName": typeNameValues.reverse[renderTypeName], | |
| 258 | + "tableColumnId": tableColumnId, | |
| 259 | + "width": width, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class CachedContents { | |
| 264 | + final String? average; | |
| 265 | + final int cachedContentsNull; | |
| 266 | + final String largest; | |
| 267 | + final int nonNull; | |
| 268 | + final String smallest; | |
| 269 | + final String? sum; | |
| 270 | + final List<Top> top; | |
| 271 | + | |
| 272 | + CachedContents({ | |
| 273 | + this.average, | |
| 274 | + required this.cachedContentsNull, | |
| 275 | + required this.largest, | |
| 276 | + required this.nonNull, | |
| 277 | + required this.smallest, | |
| 278 | + this.sum, | |
| 279 | + required this.top, | |
| 280 | + }); | |
| 281 | + | |
| 282 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 283 | + average: json["average"], | |
| 284 | + cachedContentsNull: json["null"], | |
| 285 | + largest: json["largest"], | |
| 286 | + nonNull: json["non_null"], | |
| 287 | + smallest: json["smallest"], | |
| 288 | + sum: json["sum"], | |
| 289 | + top: List<Top>.from(json["top"].map((x) => Top.fromJson(x))), | |
| 290 | + ); | |
| 291 | + | |
| 292 | + Map<String, dynamic> toJson() => { | |
| 293 | + "average": average, | |
| 294 | + "null": cachedContentsNull, | |
| 295 | + "largest": largest, | |
| 296 | + "non_null": nonNull, | |
| 297 | + "smallest": smallest, | |
| 298 | + "sum": sum, | |
| 299 | + "top": List<dynamic>.from(top.map((x) => x.toJson())), | |
| 300 | + }; | |
| 301 | +} | |
| 302 | + | |
| 303 | +class Top { | |
| 304 | + final int count; | |
| 305 | + final String item; | |
| 306 | + | |
| 307 | + Top({ | |
| 308 | + required this.count, | |
| 309 | + required this.item, | |
| 310 | + }); | |
| 311 | + | |
| 312 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 313 | + count: json["count"], | |
| 314 | + item: json["item"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "count": count, | |
| 319 | + "item": item, | |
| 320 | + }; | |
| 321 | +} | |
| 322 | + | |
| 323 | +enum TypeName { | |
| 324 | + META_DATA, | |
| 325 | + NUMBER, | |
| 326 | + TEXT | |
| 327 | +} | |
| 328 | + | |
| 329 | +final typeNameValues = EnumValues({ | |
| 330 | + "meta_data": TypeName.META_DATA, | |
| 331 | + "number": TypeName.NUMBER, | |
| 332 | + "text": TypeName.TEXT | |
| 333 | +}); | |
| 334 | + | |
| 335 | +class Query { | |
| 336 | + Query(); | |
| 337 | + | |
| 338 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 339 | + ); | |
| 340 | + | |
| 341 | + Map<String, dynamic> toJson() => { | |
| 342 | + }; | |
| 343 | +} | |
| 344 | + | |
| 345 | +class Grant { | |
| 346 | + final List<String> flags; | |
| 347 | + final bool inherited; | |
| 348 | + final String type; | |
| 349 | + | |
| 350 | + Grant({ | |
| 351 | + required this.flags, | |
| 352 | + required this.inherited, | |
| 353 | + required this.type, | |
| 354 | + }); | |
| 355 | + | |
| 356 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 357 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 358 | + inherited: json["inherited"], | |
| 359 | + type: json["type"], | |
| 360 | + ); | |
| 361 | + | |
| 362 | + Map<String, dynamic> toJson() => { | |
| 363 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 364 | + "inherited": inherited, | |
| 365 | + "type": type, | |
| 366 | + }; | |
| 367 | +} | |
| 368 | + | |
| 369 | +class License { | |
| 370 | + final String name; | |
| 371 | + | |
| 372 | + License({ | |
| 373 | + required this.name, | |
| 374 | + }); | |
| 375 | + | |
| 376 | + factory License.fromJson(Map<String, dynamic> json) => License( | |
| 377 | + name: json["name"], | |
| 378 | + ); | |
| 379 | + | |
| 380 | + Map<String, dynamic> toJson() => { | |
| 381 | + "name": name, | |
| 382 | + }; | |
| 383 | +} | |
| 384 | + | |
| 385 | +class Metadata { | |
| 386 | + final List<String> availableDisplayTypes; | |
| 387 | + final String rdfClass; | |
| 388 | + final String rdfSubject; | |
| 389 | + final RenderTypeConfig renderTypeConfig; | |
| 390 | + final String rowIdentifier; | |
| 391 | + | |
| 392 | + Metadata({ | |
| 393 | + required this.availableDisplayTypes, | |
| 394 | + required this.rdfClass, | |
| 395 | + required this.rdfSubject, | |
| 396 | + required this.renderTypeConfig, | |
| 397 | + required this.rowIdentifier, | |
| 398 | + }); | |
| 399 | + | |
| 400 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 401 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 402 | + rdfClass: json["rdfClass"], | |
| 403 | + rdfSubject: json["rdfSubject"], | |
| 404 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 405 | + rowIdentifier: json["rowIdentifier"], | |
| 406 | + ); | |
| 407 | + | |
| 408 | + Map<String, dynamic> toJson() => { | |
| 409 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 410 | + "rdfClass": rdfClass, | |
| 411 | + "rdfSubject": rdfSubject, | |
| 412 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 413 | + "rowIdentifier": rowIdentifier, | |
| 414 | + }; | |
| 415 | +} | |
| 416 | + | |
| 417 | +class RenderTypeConfig { | |
| 418 | + final Visible visible; | |
| 419 | + | |
| 420 | + RenderTypeConfig({ | |
| 421 | + required this.visible, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 425 | + visible: Visible.fromJson(json["visible"]), | |
| 426 | + ); | |
| 427 | + | |
| 428 | + Map<String, dynamic> toJson() => { | |
| 429 | + "visible": visible.toJson(), | |
| 430 | + }; | |
| 431 | +} | |
| 432 | + | |
| 433 | +class Visible { | |
| 434 | + final bool table; | |
| 435 | + | |
| 436 | + Visible({ | |
| 437 | + required this.table, | |
| 438 | + }); | |
| 439 | + | |
| 440 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 441 | + table: json["table"], | |
| 442 | + ); | |
| 443 | + | |
| 444 | + Map<String, dynamic> toJson() => { | |
| 445 | + "table": table, | |
| 446 | + }; | |
| 447 | +} | |
| 448 | + | |
| 449 | +class Owner { | |
| 450 | + final String displayName; | |
| 451 | + final String id; | |
| 452 | + final String screenName; | |
| 453 | + | |
| 454 | + Owner({ | |
| 455 | + required this.displayName, | |
| 456 | + required this.id, | |
| 457 | + required this.screenName, | |
| 458 | + }); | |
| 459 | + | |
| 460 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 461 | + displayName: json["displayName"], | |
| 462 | + id: json["id"], | |
| 463 | + screenName: json["screenName"], | |
| 464 | + ); | |
| 465 | + | |
| 466 | + Map<String, dynamic> toJson() => { | |
| 467 | + "displayName": displayName, | |
| 468 | + "id": id, | |
| 469 | + "screenName": screenName, | |
| 470 | + }; | |
| 471 | +} | |
| 472 | + | |
| 473 | +class EnumValues<T> { | |
| 474 | + Map<String, T> map; | |
| 475 | + late Map<T, String> reverseMap; | |
| 476 | + | |
| 477 | + EnumValues(this.map); | |
| 478 | + | |
| 479 | + Map<T, String> get reverse { | |
| 480 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 481 | + return reverseMap; | |
| 482 | + } | |
| 483 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/a45b0.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/a71df.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/a9691.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/ab0d1.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/abb4b.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/ac944.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +233 −0test/inputs/json/misc/ad8be.json
Adartdefault / TopLevel.dart+233 −0
| @@ -0,0 +1,233 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final List<Identifier> identifiers; | |
| 14 | + final List<Keyword> keywords; | |
| 15 | + final List<Link> links; | |
| 16 | + final String name; | |
| 17 | + final List<OtherName> otherNames; | |
| 18 | + final String? supersededBy; | |
| 19 | + final List<Text> text; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.id, | |
| 23 | + required this.identifiers, | |
| 24 | + required this.keywords, | |
| 25 | + required this.links, | |
| 26 | + required this.name, | |
| 27 | + required this.otherNames, | |
| 28 | + required this.supersededBy, | |
| 29 | + required this.text, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + id: json["id"], | |
| 34 | + identifiers: List<Identifier>.from(json["identifiers"].map((x) => Identifier.fromJson(x))), | |
| 35 | + keywords: List<Keyword>.from(json["keywords"].map((x) => keywordValues.map[x]!)), | |
| 36 | + links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))), | |
| 37 | + name: json["name"], | |
| 38 | + otherNames: List<OtherName>.from(json["other_names"].map((x) => OtherName.fromJson(x))), | |
| 39 | + supersededBy: json["superseded_by"], | |
| 40 | + text: List<Text>.from(json["text"].map((x) => Text.fromJson(x))), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "id": id, | |
| 45 | + "identifiers": List<dynamic>.from(identifiers.map((x) => x.toJson())), | |
| 46 | + "keywords": List<dynamic>.from(keywords.map((x) => keywordValues.reverse[x])), | |
| 47 | + "links": List<dynamic>.from(links.map((x) => x.toJson())), | |
| 48 | + "name": name, | |
| 49 | + "other_names": List<dynamic>.from(otherNames.map((x) => x.toJson())), | |
| 50 | + "superseded_by": supersededBy, | |
| 51 | + "text": List<dynamic>.from(text.map((x) => x.toJson())), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Identifier { | |
| 56 | + final String identifier; | |
| 57 | + final Scheme scheme; | |
| 58 | + | |
| 59 | + Identifier({ | |
| 60 | + required this.identifier, | |
| 61 | + required this.scheme, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Identifier.fromJson(Map<String, dynamic> json) => Identifier( | |
| 65 | + identifier: json["identifier"], | |
| 66 | + scheme: schemeValues.map[json["scheme"]]!, | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "identifier": identifier, | |
| 71 | + "scheme": schemeValues.reverse[scheme], | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +enum Scheme { | |
| 76 | + SPDX, | |
| 77 | + TROVE, | |
| 78 | + DEP5 | |
| 79 | +} | |
| 80 | + | |
| 81 | +final schemeValues = EnumValues({ | |
| 82 | + "SPDX": Scheme.SPDX, | |
| 83 | + "Trove": Scheme.TROVE, | |
| 84 | + "DEP5": Scheme.DEP5 | |
| 85 | +}); | |
| 86 | + | |
| 87 | +enum Keyword { | |
| 88 | + OSI_APPROVED, | |
| 89 | + DISCOURAGED, | |
| 90 | + REDUNDANT, | |
| 91 | + MISCELLANEOUS, | |
| 92 | + NON_REUSABLE, | |
| 93 | + OBSOLETE, | |
| 94 | + POPULAR, | |
| 95 | + PERMISSIVE, | |
| 96 | + RETIRED, | |
| 97 | + SPECIAL_PURPOSE, | |
| 98 | + COPYLEFT, | |
| 99 | + INTERNATIONAL | |
| 100 | +} | |
| 101 | + | |
| 102 | +final keywordValues = EnumValues({ | |
| 103 | + "osi-approved": Keyword.OSI_APPROVED, | |
| 104 | + "discouraged": Keyword.DISCOURAGED, | |
| 105 | + "redundant": Keyword.REDUNDANT, | |
| 106 | + "miscellaneous": Keyword.MISCELLANEOUS, | |
| 107 | + "non-reusable": Keyword.NON_REUSABLE, | |
| 108 | + "obsolete": Keyword.OBSOLETE, | |
| 109 | + "popular": Keyword.POPULAR, | |
| 110 | + "permissive": Keyword.PERMISSIVE, | |
| 111 | + "retired": Keyword.RETIRED, | |
| 112 | + "special-purpose": Keyword.SPECIAL_PURPOSE, | |
| 113 | + "copyleft": Keyword.COPYLEFT, | |
| 114 | + "international": Keyword.INTERNATIONAL | |
| 115 | +}); | |
| 116 | + | |
| 117 | +class Link { | |
| 118 | + final Note note; | |
| 119 | + final String url; | |
| 120 | + | |
| 121 | + Link({ | |
| 122 | + required this.note, | |
| 123 | + required this.url, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory Link.fromJson(Map<String, dynamic> json) => Link( | |
| 127 | + note: noteValues.map[json["note"]]!, | |
| 128 | + url: json["url"], | |
| 129 | + ); | |
| 130 | + | |
| 131 | + Map<String, dynamic> toJson() => { | |
| 132 | + "note": noteValues.reverse[note], | |
| 133 | + "url": url, | |
| 134 | + }; | |
| 135 | +} | |
| 136 | + | |
| 137 | +enum Note { | |
| 138 | + OSI_PAGE, | |
| 139 | + TL_DR_LEGAL, | |
| 140 | + WIKIPEDIA_PAGE, | |
| 141 | + NOTE_WIKIPEDIA_PAGE, | |
| 142 | + MOZILLA_PAGE, | |
| 143 | + OSET_FOUNDATION_PAGE | |
| 144 | +} | |
| 145 | + | |
| 146 | +final noteValues = EnumValues({ | |
| 147 | + "OSI Page": Note.OSI_PAGE, | |
| 148 | + "tl;dr legal": Note.TL_DR_LEGAL, | |
| 149 | + "Wikipedia page": Note.WIKIPEDIA_PAGE, | |
| 150 | + "Wikipedia Page": Note.NOTE_WIKIPEDIA_PAGE, | |
| 151 | + "Mozilla Page": Note.MOZILLA_PAGE, | |
| 152 | + "OSET Foundation Page": Note.OSET_FOUNDATION_PAGE | |
| 153 | +}); | |
| 154 | + | |
| 155 | +class OtherName { | |
| 156 | + final String name; | |
| 157 | + final String? note; | |
| 158 | + | |
| 159 | + OtherName({ | |
| 160 | + required this.name, | |
| 161 | + required this.note, | |
| 162 | + }); | |
| 163 | + | |
| 164 | + factory OtherName.fromJson(Map<String, dynamic> json) => OtherName( | |
| 165 | + name: json["name"], | |
| 166 | + note: json["note"], | |
| 167 | + ); | |
| 168 | + | |
| 169 | + Map<String, dynamic> toJson() => { | |
| 170 | + "name": name, | |
| 171 | + "note": note, | |
| 172 | + }; | |
| 173 | +} | |
| 174 | + | |
| 175 | +class Text { | |
| 176 | + final MediaType mediaType; | |
| 177 | + final Title title; | |
| 178 | + final String url; | |
| 179 | + | |
| 180 | + Text({ | |
| 181 | + required this.mediaType, | |
| 182 | + required this.title, | |
| 183 | + required this.url, | |
| 184 | + }); | |
| 185 | + | |
| 186 | + factory Text.fromJson(Map<String, dynamic> json) => Text( | |
| 187 | + mediaType: mediaTypeValues.map[json["media_type"]]!, | |
| 188 | + title: titleValues.map[json["title"]]!, | |
| 189 | + url: json["url"], | |
| 190 | + ); | |
| 191 | + | |
| 192 | + Map<String, dynamic> toJson() => { | |
| 193 | + "media_type": mediaTypeValues.reverse[mediaType], | |
| 194 | + "title": titleValues.reverse[title], | |
| 195 | + "url": url, | |
| 196 | + }; | |
| 197 | +} | |
| 198 | + | |
| 199 | +enum MediaType { | |
| 200 | + TEXT_HTML, | |
| 201 | + TEXT_PLAIN, | |
| 202 | + APPLICATION_PDF | |
| 203 | +} | |
| 204 | + | |
| 205 | +final mediaTypeValues = EnumValues({ | |
| 206 | + "text/html": MediaType.TEXT_HTML, | |
| 207 | + "text/plain": MediaType.TEXT_PLAIN, | |
| 208 | + "application/pdf": MediaType.APPLICATION_PDF | |
| 209 | +}); | |
| 210 | + | |
| 211 | +enum Title { | |
| 212 | + HTML, | |
| 213 | + PLAIN_TEXT, | |
| 214 | ||
| 215 | +} | |
| 216 | + | |
| 217 | +final titleValues = EnumValues({ | |
| 218 | + "HTML": Title.HTML, | |
| 219 | + "Plain Text": Title.PLAIN_TEXT, | |
| 220 | + "PDF": Title.PDF | |
| 221 | +}); | |
| 222 | + | |
| 223 | +class EnumValues<T> { | |
| 224 | + Map<String, T> map; | |
| 225 | + late Map<T, String> reverseMap; | |
| 226 | + | |
| 227 | + EnumValues(this.map); | |
| 228 | + | |
| 229 | + Map<T, String> get reverse { | |
| 230 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 231 | + return reverseMap; | |
| 232 | + } | |
| 233 | +} |
Test case
1 generated file · +399 −0test/inputs/json/misc/ae7f0.json
Adartdefault / TopLevel.dart+399 −0
| @@ -0,0 +1,399 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final dynamic authorFlairCssClass; | |
| 85 | + final dynamic authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final dynamic distinguished; | |
| 96 | + final Domain domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final String? linkFlairCssClass; | |
| 107 | + final String? linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final dynamic media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final bool quarantine; | |
| 118 | + final dynamic removalReason; | |
| 119 | + final dynamic reportReasons; | |
| 120 | + final bool saved; | |
| 121 | + final int score; | |
| 122 | + final dynamic secureMedia; | |
| 123 | + final MediaEmbed secureMediaEmbed; | |
| 124 | + final String selftext; | |
| 125 | + final dynamic selftextHtml; | |
| 126 | + final bool spoiler; | |
| 127 | + final bool stickied; | |
| 128 | + final Subreddit subreddit; | |
| 129 | + final SubredditId subredditId; | |
| 130 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 131 | + final SubredditType subredditType; | |
| 132 | + final dynamic suggestedSort; | |
| 133 | + final String thumbnail; | |
| 134 | + final String title; | |
| 135 | + final int ups; | |
| 136 | + final String url; | |
| 137 | + final List<dynamic> userReports; | |
| 138 | + final dynamic viewCount; | |
| 139 | + final bool visited; | |
| 140 | + | |
| 141 | + ChildData({ | |
| 142 | + required this.approvedAtUtc, | |
| 143 | + required this.approvedBy, | |
| 144 | + required this.archived, | |
| 145 | + required this.author, | |
| 146 | + required this.authorFlairCssClass, | |
| 147 | + required this.authorFlairText, | |
| 148 | + required this.bannedAtUtc, | |
| 149 | + required this.bannedBy, | |
| 150 | + required this.brandSafe, | |
| 151 | + required this.canGild, | |
| 152 | + required this.canModPost, | |
| 153 | + required this.clicked, | |
| 154 | + required this.contestMode, | |
| 155 | + required this.created, | |
| 156 | + required this.createdUtc, | |
| 157 | + required this.distinguished, | |
| 158 | + required this.domain, | |
| 159 | + required this.downs, | |
| 160 | + required this.edited, | |
| 161 | + required this.gilded, | |
| 162 | + required this.hidden, | |
| 163 | + required this.hideScore, | |
| 164 | + required this.id, | |
| 165 | + required this.isSelf, | |
| 166 | + required this.isVideo, | |
| 167 | + required this.likes, | |
| 168 | + required this.linkFlairCssClass, | |
| 169 | + required this.linkFlairText, | |
| 170 | + required this.locked, | |
| 171 | + required this.media, | |
| 172 | + required this.mediaEmbed, | |
| 173 | + required this.modReports, | |
| 174 | + required this.name, | |
| 175 | + required this.numComments, | |
| 176 | + required this.numReports, | |
| 177 | + required this.over18, | |
| 178 | + required this.permalink, | |
| 179 | + required this.quarantine, | |
| 180 | + required this.removalReason, | |
| 181 | + required this.reportReasons, | |
| 182 | + required this.saved, | |
| 183 | + required this.score, | |
| 184 | + required this.secureMedia, | |
| 185 | + required this.secureMediaEmbed, | |
| 186 | + required this.selftext, | |
| 187 | + required this.selftextHtml, | |
| 188 | + required this.spoiler, | |
| 189 | + required this.stickied, | |
| 190 | + required this.subreddit, | |
| 191 | + required this.subredditId, | |
| 192 | + required this.subredditNamePrefixed, | |
| 193 | + required this.subredditType, | |
| 194 | + required this.suggestedSort, | |
| 195 | + required this.thumbnail, | |
| 196 | + required this.title, | |
| 197 | + required this.ups, | |
| 198 | + required this.url, | |
| 199 | + required this.userReports, | |
| 200 | + required this.viewCount, | |
| 201 | + required this.visited, | |
| 202 | + }); | |
| 203 | + | |
| 204 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 205 | + approvedAtUtc: json["approved_at_utc"], | |
| 206 | + approvedBy: json["approved_by"], | |
| 207 | + archived: json["archived"], | |
| 208 | + author: json["author"], | |
| 209 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 210 | + authorFlairText: json["author_flair_text"], | |
| 211 | + bannedAtUtc: json["banned_at_utc"], | |
| 212 | + bannedBy: json["banned_by"], | |
| 213 | + brandSafe: json["brand_safe"], | |
| 214 | + canGild: json["can_gild"], | |
| 215 | + canModPost: json["can_mod_post"], | |
| 216 | + clicked: json["clicked"], | |
| 217 | + contestMode: json["contest_mode"], | |
| 218 | + created: json["created"]?.toDouble(), | |
| 219 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 220 | + distinguished: json["distinguished"], | |
| 221 | + domain: domainValues.map[json["domain"]]!, | |
| 222 | + downs: json["downs"], | |
| 223 | + edited: json["edited"], | |
| 224 | + gilded: json["gilded"], | |
| 225 | + hidden: json["hidden"], | |
| 226 | + hideScore: json["hide_score"], | |
| 227 | + id: json["id"], | |
| 228 | + isSelf: json["is_self"], | |
| 229 | + isVideo: json["is_video"], | |
| 230 | + likes: json["likes"], | |
| 231 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 232 | + linkFlairText: json["link_flair_text"], | |
| 233 | + locked: json["locked"], | |
| 234 | + media: json["media"], | |
| 235 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 236 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 237 | + name: json["name"], | |
| 238 | + numComments: json["num_comments"], | |
| 239 | + numReports: json["num_reports"], | |
| 240 | + over18: json["over_18"], | |
| 241 | + permalink: json["permalink"], | |
| 242 | + quarantine: json["quarantine"], | |
| 243 | + removalReason: json["removal_reason"], | |
| 244 | + reportReasons: json["report_reasons"], | |
| 245 | + saved: json["saved"], | |
| 246 | + score: json["score"], | |
| 247 | + secureMedia: json["secure_media"], | |
| 248 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 249 | + selftext: json["selftext"], | |
| 250 | + selftextHtml: json["selftext_html"], | |
| 251 | + spoiler: json["spoiler"], | |
| 252 | + stickied: json["stickied"], | |
| 253 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 254 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 255 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 256 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 257 | + suggestedSort: json["suggested_sort"], | |
| 258 | + thumbnail: json["thumbnail"], | |
| 259 | + title: json["title"], | |
| 260 | + ups: json["ups"], | |
| 261 | + url: json["url"], | |
| 262 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 263 | + viewCount: json["view_count"], | |
| 264 | + visited: json["visited"], | |
| 265 | + ); | |
| 266 | + | |
| 267 | + Map<String, dynamic> toJson() => { | |
| 268 | + "approved_at_utc": approvedAtUtc, | |
| 269 | + "approved_by": approvedBy, | |
| 270 | + "archived": archived, | |
| 271 | + "author": author, | |
| 272 | + "author_flair_css_class": authorFlairCssClass, | |
| 273 | + "author_flair_text": authorFlairText, | |
| 274 | + "banned_at_utc": bannedAtUtc, | |
| 275 | + "banned_by": bannedBy, | |
| 276 | + "brand_safe": brandSafe, | |
| 277 | + "can_gild": canGild, | |
| 278 | + "can_mod_post": canModPost, | |
| 279 | + "clicked": clicked, | |
| 280 | + "contest_mode": contestMode, | |
| 281 | + "created": created, | |
| 282 | + "created_utc": createdUtc, | |
| 283 | + "distinguished": distinguished, | |
| 284 | + "domain": domainValues.reverse[domain], | |
| 285 | + "downs": downs, | |
| 286 | + "edited": edited, | |
| 287 | + "gilded": gilded, | |
| 288 | + "hidden": hidden, | |
| 289 | + "hide_score": hideScore, | |
| 290 | + "id": id, | |
| 291 | + "is_self": isSelf, | |
| 292 | + "is_video": isVideo, | |
| 293 | + "likes": likes, | |
| 294 | + "link_flair_css_class": linkFlairCssClass, | |
| 295 | + "link_flair_text": linkFlairText, | |
| 296 | + "locked": locked, | |
| 297 | + "media": media, | |
| 298 | + "media_embed": mediaEmbed.toJson(), | |
| 299 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 300 | + "name": name, | |
| 301 | + "num_comments": numComments, | |
| 302 | + "num_reports": numReports, | |
| 303 | + "over_18": over18, | |
| 304 | + "permalink": permalink, | |
| 305 | + "quarantine": quarantine, | |
| 306 | + "removal_reason": removalReason, | |
| 307 | + "report_reasons": reportReasons, | |
| 308 | + "saved": saved, | |
| 309 | + "score": score, | |
| 310 | + "secure_media": secureMedia, | |
| 311 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 312 | + "selftext": selftext, | |
| 313 | + "selftext_html": selftextHtml, | |
| 314 | + "spoiler": spoiler, | |
| 315 | + "stickied": stickied, | |
| 316 | + "subreddit": subredditValues.reverse[subreddit], | |
| 317 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 318 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 319 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 320 | + "suggested_sort": suggestedSort, | |
| 321 | + "thumbnail": thumbnail, | |
| 322 | + "title": title, | |
| 323 | + "ups": ups, | |
| 324 | + "url": url, | |
| 325 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 326 | + "view_count": viewCount, | |
| 327 | + "visited": visited, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +enum Domain { | |
| 332 | + SELF_ASK_REDDIT | |
| 333 | +} | |
| 334 | + | |
| 335 | +final domainValues = EnumValues({ | |
| 336 | + "self.AskReddit": Domain.SELF_ASK_REDDIT | |
| 337 | +}); | |
| 338 | + | |
| 339 | +class MediaEmbed { | |
| 340 | + MediaEmbed(); | |
| 341 | + | |
| 342 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + }; | |
| 347 | +} | |
| 348 | + | |
| 349 | +enum Subreddit { | |
| 350 | + ASK_REDDIT | |
| 351 | +} | |
| 352 | + | |
| 353 | +final subredditValues = EnumValues({ | |
| 354 | + "AskReddit": Subreddit.ASK_REDDIT | |
| 355 | +}); | |
| 356 | + | |
| 357 | +enum SubredditId { | |
| 358 | + T5_2_QH1_I | |
| 359 | +} | |
| 360 | + | |
| 361 | +final subredditIdValues = EnumValues({ | |
| 362 | + "t5_2qh1i": SubredditId.T5_2_QH1_I | |
| 363 | +}); | |
| 364 | + | |
| 365 | +enum SubredditNamePrefixed { | |
| 366 | + R_ASK_REDDIT | |
| 367 | +} | |
| 368 | + | |
| 369 | +final subredditNamePrefixedValues = EnumValues({ | |
| 370 | + "r/AskReddit": SubredditNamePrefixed.R_ASK_REDDIT | |
| 371 | +}); | |
| 372 | + | |
| 373 | +enum SubredditType { | |
| 374 | + PUBLIC | |
| 375 | +} | |
| 376 | + | |
| 377 | +final subredditTypeValues = EnumValues({ | |
| 378 | + "public": SubredditType.PUBLIC | |
| 379 | +}); | |
| 380 | + | |
| 381 | +enum Kind { | |
| 382 | + T3 | |
| 383 | +} | |
| 384 | + | |
| 385 | +final kindValues = EnumValues({ | |
| 386 | + "t3": Kind.T3 | |
| 387 | +}); | |
| 388 | + | |
| 389 | +class EnumValues<T> { | |
| 390 | + Map<String, T> map; | |
| 391 | + late Map<T, String> reverseMap; | |
| 392 | + | |
| 393 | + EnumValues(this.map); | |
| 394 | + | |
| 395 | + Map<T, String> get reverse { | |
| 396 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 397 | + return reverseMap; | |
| 398 | + } | |
| 399 | +} |
Test case
1 generated file · +191 −0test/inputs/json/misc/ae9ca.json
Adartdefault / TopLevel.dart+191 −0
| @@ -0,0 +1,191 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Feature> features; | |
| 13 | + final String name; | |
| 14 | + final String type; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.features, | |
| 18 | + required this.name, | |
| 19 | + required this.type, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + features: List<Feature>.from(json["features"].map((x) => Feature.fromJson(x))), | |
| 24 | + name: json["name"], | |
| 25 | + type: json["type"], | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "features": List<dynamic>.from(features.map((x) => x.toJson())), | |
| 30 | + "name": name, | |
| 31 | + "type": type, | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Feature { | |
| 36 | + final Geometry geometry; | |
| 37 | + final Properties properties; | |
| 38 | + final FeatureType type; | |
| 39 | + | |
| 40 | + Feature({ | |
| 41 | + required this.geometry, | |
| 42 | + required this.properties, | |
| 43 | + required this.type, | |
| 44 | + }); | |
| 45 | + | |
| 46 | + factory Feature.fromJson(Map<String, dynamic> json) => Feature( | |
| 47 | + geometry: Geometry.fromJson(json["geometry"]), | |
| 48 | + properties: Properties.fromJson(json["properties"]), | |
| 49 | + type: featureTypeValues.map[json["type"]]!, | |
| 50 | + ); | |
| 51 | + | |
| 52 | + Map<String, dynamic> toJson() => { | |
| 53 | + "geometry": geometry.toJson(), | |
| 54 | + "properties": properties.toJson(), | |
| 55 | + "type": featureTypeValues.reverse[type], | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Geometry { | |
| 60 | + final List<double> coordinates; | |
| 61 | + final GeometryType type; | |
| 62 | + | |
| 63 | + Geometry({ | |
| 64 | + required this.coordinates, | |
| 65 | + required this.type, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Geometry.fromJson(Map<String, dynamic> json) => Geometry( | |
| 69 | + coordinates: List<double>.from(json["coordinates"].map((x) => x?.toDouble())), | |
| 70 | + type: geometryTypeValues.map[json["type"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "coordinates": List<dynamic>.from(coordinates.map((x) => x)), | |
| 75 | + "type": geometryTypeValues.reverse[type], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +enum GeometryType { | |
| 80 | + POINT | |
| 81 | +} | |
| 82 | + | |
| 83 | +final geometryTypeValues = EnumValues({ | |
| 84 | + "Point": GeometryType.POINT | |
| 85 | +}); | |
| 86 | + | |
| 87 | +class Properties { | |
| 88 | + final String area; | |
| 89 | + final String centralAssetId; | |
| 90 | + final String featureLocation; | |
| 91 | + final String lat; | |
| 92 | + final String long; | |
| 93 | + final MaintainingAuthority maintainingAuthority; | |
| 94 | + final String number; | |
| 95 | + final Class propertiesClass; | |
| 96 | + final String siteName; | |
| 97 | + final Ward ward; | |
| 98 | + | |
| 99 | + Properties({ | |
| 100 | + required this.area, | |
| 101 | + required this.centralAssetId, | |
| 102 | + required this.featureLocation, | |
| 103 | + required this.lat, | |
| 104 | + required this.long, | |
| 105 | + required this.maintainingAuthority, | |
| 106 | + required this.number, | |
| 107 | + required this.propertiesClass, | |
| 108 | + required this.siteName, | |
| 109 | + required this.ward, | |
| 110 | + }); | |
| 111 | + | |
| 112 | + factory Properties.fromJson(Map<String, dynamic> json) => Properties( | |
| 113 | + area: json["Area"], | |
| 114 | + centralAssetId: json["Central Asset ID"], | |
| 115 | + featureLocation: json["Feature Location"], | |
| 116 | + lat: json["lat"], | |
| 117 | + long: json["long"], | |
| 118 | + maintainingAuthority: maintainingAuthorityValues.map[json["Maintaining Authority"]]!, | |
| 119 | + number: json["Number"], | |
| 120 | + propertiesClass: classValues.map[json["Class"]]!, | |
| 121 | + siteName: json["Site Name"], | |
| 122 | + ward: wardValues.map[json["Ward"]]!, | |
| 123 | + ); | |
| 124 | + | |
| 125 | + Map<String, dynamic> toJson() => { | |
| 126 | + "Area": area, | |
| 127 | + "Central Asset ID": centralAssetId, | |
| 128 | + "Feature Location": featureLocation, | |
| 129 | + "lat": lat, | |
| 130 | + "long": long, | |
| 131 | + "Maintaining Authority": maintainingAuthorityValues.reverse[maintainingAuthority], | |
| 132 | + "Number": number, | |
| 133 | + "Class": classValues.reverse[propertiesClass], | |
| 134 | + "Site Name": siteName, | |
| 135 | + "Ward": wardValues.reverse[ward], | |
| 136 | + }; | |
| 137 | +} | |
| 138 | + | |
| 139 | +enum MaintainingAuthority { | |
| 140 | + CITY_OF_BALLARAT | |
| 141 | +} | |
| 142 | + | |
| 143 | +final maintainingAuthorityValues = EnumValues({ | |
| 144 | + "City of Ballarat": MaintainingAuthority.CITY_OF_BALLARAT | |
| 145 | +}); | |
| 146 | + | |
| 147 | +enum Class { | |
| 148 | + NO_CODE_ALLOCATED, | |
| 149 | + OS_DISTRICT, | |
| 150 | + OS_NEIGHBOURHOOD, | |
| 151 | + OS_REGIONAL | |
| 152 | +} | |
| 153 | + | |
| 154 | +final classValues = EnumValues({ | |
| 155 | + "No Code Allocated": Class.NO_CODE_ALLOCATED, | |
| 156 | + "OS-District": Class.OS_DISTRICT, | |
| 157 | + "OS-Neighbourhood": Class.OS_NEIGHBOURHOOD, | |
| 158 | + "OS-Regional": Class.OS_REGIONAL | |
| 159 | +}); | |
| 160 | + | |
| 161 | +enum Ward { | |
| 162 | + SOUTH, | |
| 163 | + NORTH, | |
| 164 | + CENTRAL | |
| 165 | +} | |
| 166 | + | |
| 167 | +final wardValues = EnumValues({ | |
| 168 | + "South": Ward.SOUTH, | |
| 169 | + "North": Ward.NORTH, | |
| 170 | + "Central": Ward.CENTRAL | |
| 171 | +}); | |
| 172 | + | |
| 173 | +enum FeatureType { | |
| 174 | + FEATURE | |
| 175 | +} | |
| 176 | + | |
| 177 | +final featureTypeValues = EnumValues({ | |
| 178 | + "Feature": FeatureType.FEATURE | |
| 179 | +}); | |
| 180 | + | |
| 181 | +class EnumValues<T> { | |
| 182 | + Map<String, T> map; | |
| 183 | + late Map<T, String> reverseMap; | |
| 184 | + | |
| 185 | + EnumValues(this.map); | |
| 186 | + | |
| 187 | + Map<T, String> get reverse { | |
| 188 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 189 | + return reverseMap; | |
| 190 | + } | |
| 191 | +} |
Test case
1 generated file · +405 −0test/inputs/json/misc/af2d1.json
Adartdefault / TopLevel.dart+405 −0
| @@ -0,0 +1,405 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Crs crs; | |
| 13 | + final List<Feature> features; | |
| 14 | + final int totalFeatures; | |
| 15 | + final String type; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.crs, | |
| 19 | + required this.features, | |
| 20 | + required this.totalFeatures, | |
| 21 | + required this.type, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + crs: Crs.fromJson(json["crs"]), | |
| 26 | + features: List<Feature>.from(json["features"].map((x) => Feature.fromJson(x))), | |
| 27 | + totalFeatures: json["totalFeatures"], | |
| 28 | + type: json["type"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "crs": crs.toJson(), | |
| 33 | + "features": List<dynamic>.from(features.map((x) => x.toJson())), | |
| 34 | + "totalFeatures": totalFeatures, | |
| 35 | + "type": type, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Crs { | |
| 40 | + final CrsProperties properties; | |
| 41 | + final String type; | |
| 42 | + | |
| 43 | + Crs({ | |
| 44 | + required this.properties, | |
| 45 | + required this.type, | |
| 46 | + }); | |
| 47 | + | |
| 48 | + factory Crs.fromJson(Map<String, dynamic> json) => Crs( | |
| 49 | + properties: CrsProperties.fromJson(json["properties"]), | |
| 50 | + type: json["type"], | |
| 51 | + ); | |
| 52 | + | |
| 53 | + Map<String, dynamic> toJson() => { | |
| 54 | + "properties": properties.toJson(), | |
| 55 | + "type": type, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class CrsProperties { | |
| 60 | + final String name; | |
| 61 | + | |
| 62 | + CrsProperties({ | |
| 63 | + required this.name, | |
| 64 | + }); | |
| 65 | + | |
| 66 | + factory CrsProperties.fromJson(Map<String, dynamic> json) => CrsProperties( | |
| 67 | + name: json["name"], | |
| 68 | + ); | |
| 69 | + | |
| 70 | + Map<String, dynamic> toJson() => { | |
| 71 | + "name": name, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Feature { | |
| 76 | + final Geometry geometry; | |
| 77 | + final GeometryName geometryName; | |
| 78 | + final String id; | |
| 79 | + final FeatureProperties properties; | |
| 80 | + final FeatureType type; | |
| 81 | + | |
| 82 | + Feature({ | |
| 83 | + required this.geometry, | |
| 84 | + required this.geometryName, | |
| 85 | + required this.id, | |
| 86 | + required this.properties, | |
| 87 | + required this.type, | |
| 88 | + }); | |
| 89 | + | |
| 90 | + factory Feature.fromJson(Map<String, dynamic> json) => Feature( | |
| 91 | + geometry: Geometry.fromJson(json["geometry"]), | |
| 92 | + geometryName: geometryNameValues.map[json["geometry_name"]]!, | |
| 93 | + id: json["id"], | |
| 94 | + properties: FeatureProperties.fromJson(json["properties"]), | |
| 95 | + type: featureTypeValues.map[json["type"]]!, | |
| 96 | + ); | |
| 97 | + | |
| 98 | + Map<String, dynamic> toJson() => { | |
| 99 | + "geometry": geometry.toJson(), | |
| 100 | + "geometry_name": geometryNameValues.reverse[geometryName], | |
| 101 | + "id": id, | |
| 102 | + "properties": properties.toJson(), | |
| 103 | + "type": featureTypeValues.reverse[type], | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +class Geometry { | |
| 108 | + final List<List<List<List<double>>>> coordinates; | |
| 109 | + final GeometryType type; | |
| 110 | + | |
| 111 | + Geometry({ | |
| 112 | + required this.coordinates, | |
| 113 | + required this.type, | |
| 114 | + }); | |
| 115 | + | |
| 116 | + factory Geometry.fromJson(Map<String, dynamic> json) => Geometry( | |
| 117 | + coordinates: List<List<List<List<double>>>>.from(json["coordinates"].map((x) => List<List<List<double>>>.from(x.map((x) => List<List<double>>.from(x.map((x) => List<double>.from(x.map((x) => x?.toDouble())))))))), | |
| 118 | + type: geometryTypeValues.map[json["type"]]!, | |
| 119 | + ); | |
| 120 | + | |
| 121 | + Map<String, dynamic> toJson() => { | |
| 122 | + "coordinates": List<dynamic>.from(coordinates.map((x) => List<dynamic>.from(x.map((x) => List<dynamic>.from(x.map((x) => List<dynamic>.from(x.map((x) => x)))))))), | |
| 123 | + "type": geometryTypeValues.reverse[type], | |
| 124 | + }; | |
| 125 | +} | |
| 126 | + | |
| 127 | +enum GeometryType { | |
| 128 | + MULTI_POLYGON | |
| 129 | +} | |
| 130 | + | |
| 131 | +final geometryTypeValues = EnumValues({ | |
| 132 | + "MultiPolygon": GeometryType.MULTI_POLYGON | |
| 133 | +}); | |
| 134 | + | |
| 135 | +enum GeometryName { | |
| 136 | + GEOM | |
| 137 | +} | |
| 138 | + | |
| 139 | +final geometryNameValues = EnumValues({ | |
| 140 | + "geom": GeometryName.GEOM | |
| 141 | +}); | |
| 142 | + | |
| 143 | +class FeatureProperties { | |
| 144 | + final AddImprov? addImprov; | |
| 145 | + final double area; | |
| 146 | + final String assetNumb; | |
| 147 | + final String? comments; | |
| 148 | + final int condition; | |
| 149 | + final String? constructi; | |
| 150 | + final dynamic createdate; | |
| 151 | + final dynamic createuser; | |
| 152 | + final dynamic disposalD; | |
| 153 | + final String documents; | |
| 154 | + final String? drawingNu; | |
| 155 | + final String? fileNumbe; | |
| 156 | + final String? folderNum; | |
| 157 | + final FundingBa? fundingBa; | |
| 158 | + final int historicC; | |
| 159 | + final String inspection; | |
| 160 | + final dynamic inspectors; | |
| 161 | + final dynamic lastUpdat; | |
| 162 | + final LevelAccu? levelAccu; | |
| 163 | + final Material material; | |
| 164 | + final int miPrinx; | |
| 165 | + final MiSymbolo miSymbolo; | |
| 166 | + final int numberLan; | |
| 167 | + final String? owner; | |
| 168 | + final LevelAccu? positional; | |
| 169 | + final String? projectNu; | |
| 170 | + final int recId; | |
| 171 | + final String? recordCre; | |
| 172 | + final double shapeArea; | |
| 173 | + final double shapeLeng; | |
| 174 | + final Status status; | |
| 175 | + final dynamic surveyNum; | |
| 176 | + final double toeRl; | |
| 177 | + final double topRl; | |
| 178 | + final PropertiesType? type; | |
| 179 | + final String updateDat; | |
| 180 | + final dynamic updatedate; | |
| 181 | + final dynamic updateuser; | |
| 182 | + | |
| 183 | + FeatureProperties({ | |
| 184 | + required this.addImprov, | |
| 185 | + required this.area, | |
| 186 | + required this.assetNumb, | |
| 187 | + required this.comments, | |
| 188 | + required this.condition, | |
| 189 | + required this.constructi, | |
| 190 | + required this.createdate, | |
| 191 | + required this.createuser, | |
| 192 | + required this.disposalD, | |
| 193 | + required this.documents, | |
| 194 | + required this.drawingNu, | |
| 195 | + required this.fileNumbe, | |
| 196 | + required this.folderNum, | |
| 197 | + required this.fundingBa, | |
| 198 | + required this.historicC, | |
| 199 | + required this.inspection, | |
| 200 | + required this.inspectors, | |
| 201 | + required this.lastUpdat, | |
| 202 | + required this.levelAccu, | |
| 203 | + required this.material, | |
| 204 | + required this.miPrinx, | |
| 205 | + required this.miSymbolo, | |
| 206 | + required this.numberLan, | |
| 207 | + required this.owner, | |
| 208 | + required this.positional, | |
| 209 | + required this.projectNu, | |
| 210 | + required this.recId, | |
| 211 | + required this.recordCre, | |
| 212 | + required this.shapeArea, | |
| 213 | + required this.shapeLeng, | |
| 214 | + required this.status, | |
| 215 | + required this.surveyNum, | |
| 216 | + required this.toeRl, | |
| 217 | + required this.topRl, | |
| 218 | + required this.type, | |
| 219 | + required this.updateDat, | |
| 220 | + required this.updatedate, | |
| 221 | + required this.updateuser, | |
| 222 | + }); | |
| 223 | + | |
| 224 | + factory FeatureProperties.fromJson(Map<String, dynamic> json) => FeatureProperties( | |
| 225 | + addImprov: addImprovValues.map[json["add_improv"]], | |
| 226 | + area: json["area_"]?.toDouble(), | |
| 227 | + assetNumb: json["asset_numb"], | |
| 228 | + comments: json["comments"], | |
| 229 | + condition: json["condition"], | |
| 230 | + constructi: json["constructi"], | |
| 231 | + createdate: json["createdate"], | |
| 232 | + createuser: json["createuser"], | |
| 233 | + disposalD: json["disposal_d"], | |
| 234 | + documents: json["documents"], | |
| 235 | + drawingNu: json["drawing_nu"], | |
| 236 | + fileNumbe: json["file_numbe"], | |
| 237 | + folderNum: json["folder_num"], | |
| 238 | + fundingBa: fundingBaValues.map[json["funding_ba"]], | |
| 239 | + historicC: json["historic_c"], | |
| 240 | + inspection: json["inspection"], | |
| 241 | + inspectors: json["inspectors"], | |
| 242 | + lastUpdat: json["last_updat"], | |
| 243 | + levelAccu: levelAccuValues.map[json["level_accu"]], | |
| 244 | + material: materialValues.map[json["material"]]!, | |
| 245 | + miPrinx: json["mi_prinx"], | |
| 246 | + miSymbolo: miSymboloValues.map[json["mi_symbolo"]]!, | |
| 247 | + numberLan: json["number_lan"], | |
| 248 | + owner: json["owner"], | |
| 249 | + positional: levelAccuValues.map[json["positional"]], | |
| 250 | + projectNu: json["project_nu"], | |
| 251 | + recId: json["rec_id"], | |
| 252 | + recordCre: json["record_cre"], | |
| 253 | + shapeArea: json["shape_area"]?.toDouble(), | |
| 254 | + shapeLeng: json["shape_leng"]?.toDouble(), | |
| 255 | + status: statusValues.map[json["status"]]!, | |
| 256 | + surveyNum: json["survey_num"], | |
| 257 | + toeRl: json["toe_rl"]?.toDouble(), | |
| 258 | + topRl: json["top_rl"]?.toDouble(), | |
| 259 | + type: propertiesTypeValues.map[json["type"]], | |
| 260 | + updateDat: json["update_dat"], | |
| 261 | + updatedate: json["updatedate"], | |
| 262 | + updateuser: json["updateuser"], | |
| 263 | + ); | |
| 264 | + | |
| 265 | + Map<String, dynamic> toJson() => { | |
| 266 | + "add_improv": addImprovValues.reverse[addImprov], | |
| 267 | + "area_": area, | |
| 268 | + "asset_numb": assetNumb, | |
| 269 | + "comments": comments, | |
| 270 | + "condition": condition, | |
| 271 | + "constructi": constructi, | |
| 272 | + "createdate": createdate, | |
| 273 | + "createuser": createuser, | |
| 274 | + "disposal_d": disposalD, | |
| 275 | + "documents": documents, | |
| 276 | + "drawing_nu": drawingNu, | |
| 277 | + "file_numbe": fileNumbe, | |
| 278 | + "folder_num": folderNum, | |
| 279 | + "funding_ba": fundingBaValues.reverse[fundingBa], | |
| 280 | + "historic_c": historicC, | |
| 281 | + "inspection": inspection, | |
| 282 | + "inspectors": inspectors, | |
| 283 | + "last_updat": lastUpdat, | |
| 284 | + "level_accu": levelAccuValues.reverse[levelAccu], | |
| 285 | + "material": materialValues.reverse[material], | |
| 286 | + "mi_prinx": miPrinx, | |
| 287 | + "mi_symbolo": miSymboloValues.reverse[miSymbolo], | |
| 288 | + "number_lan": numberLan, | |
| 289 | + "owner": owner, | |
| 290 | + "positional": levelAccuValues.reverse[positional], | |
| 291 | + "project_nu": projectNu, | |
| 292 | + "rec_id": recId, | |
| 293 | + "record_cre": recordCre, | |
| 294 | + "shape_area": shapeArea, | |
| 295 | + "shape_leng": shapeLeng, | |
| 296 | + "status": statusValues.reverse[status], | |
| 297 | + "survey_num": surveyNum, | |
| 298 | + "toe_rl": toeRl, | |
| 299 | + "top_rl": topRl, | |
| 300 | + "type": propertiesTypeValues.reverse[type], | |
| 301 | + "update_dat": updateDat, | |
| 302 | + "updatedate": updatedate, | |
| 303 | + "updateuser": updateuser, | |
| 304 | + }; | |
| 305 | +} | |
| 306 | + | |
| 307 | +enum AddImprov { | |
| 308 | + F, | |
| 309 | + ADD_IMPROV_F, | |
| 310 | + T | |
| 311 | +} | |
| 312 | + | |
| 313 | +final addImprovValues = EnumValues({ | |
| 314 | + "f": AddImprov.F, | |
| 315 | + "F": AddImprov.ADD_IMPROV_F, | |
| 316 | + "t": AddImprov.T | |
| 317 | +}); | |
| 318 | + | |
| 319 | +enum FundingBa { | |
| 320 | + NON_GCCC, | |
| 321 | + CAPEX, | |
| 322 | + INITIAL, | |
| 323 | + CONTRIBUTE | |
| 324 | +} | |
| 325 | + | |
| 326 | +final fundingBaValues = EnumValues({ | |
| 327 | + "Non GCCC": FundingBa.NON_GCCC, | |
| 328 | + "Capex": FundingBa.CAPEX, | |
| 329 | + "Initial": FundingBa.INITIAL, | |
| 330 | + "Contribute": FundingBa.CONTRIBUTE | |
| 331 | +}); | |
| 332 | + | |
| 333 | +enum LevelAccu { | |
| 334 | + GPS_CORRECTED_10_M, | |
| 335 | + APPROX, | |
| 336 | + GPS_C_ORRECTED_10_M | |
| 337 | +} | |
| 338 | + | |
| 339 | +final levelAccuValues = EnumValues({ | |
| 340 | + "GPS Corrected 1.0M": LevelAccu.GPS_CORRECTED_10_M, | |
| 341 | + "APPROX": LevelAccu.APPROX, | |
| 342 | + "GPS COrrected 1.0M": LevelAccu.GPS_C_ORRECTED_10_M | |
| 343 | +}); | |
| 344 | + | |
| 345 | +enum Material { | |
| 346 | + GRAVEL, | |
| 347 | + CONCRETE, | |
| 348 | + BITUMEN, | |
| 349 | + INTERLOCK_CONC_BLOCK, | |
| 350 | + OTHER, | |
| 351 | + EARTH | |
| 352 | +} | |
| 353 | + | |
| 354 | +final materialValues = EnumValues({ | |
| 355 | + "Gravel": Material.GRAVEL, | |
| 356 | + "Concrete": Material.CONCRETE, | |
| 357 | + "Bitumen": Material.BITUMEN, | |
| 358 | + "Interlock Conc Block": Material.INTERLOCK_CONC_BLOCK, | |
| 359 | + "Other": Material.OTHER, | |
| 360 | + "Earth": Material.EARTH | |
| 361 | +}); | |
| 362 | + | |
| 363 | +enum MiSymbolo { | |
| 364 | + PEN_2265535_BRUSH_1016777215 | |
| 365 | +} | |
| 366 | + | |
| 367 | +final miSymboloValues = EnumValues({ | |
| 368 | + "Pen (2, 2, 65535) Brush (1, 0, 16777215)": MiSymbolo.PEN_2265535_BRUSH_1016777215 | |
| 369 | +}); | |
| 370 | + | |
| 371 | +enum Status { | |
| 372 | + CURRENT | |
| 373 | +} | |
| 374 | + | |
| 375 | +final statusValues = EnumValues({ | |
| 376 | + "CURRENT": Status.CURRENT | |
| 377 | +}); | |
| 378 | + | |
| 379 | +enum PropertiesType { | |
| 380 | + BOAT_RAMP | |
| 381 | +} | |
| 382 | + | |
| 383 | +final propertiesTypeValues = EnumValues({ | |
| 384 | + "Boat Ramp": PropertiesType.BOAT_RAMP | |
| 385 | +}); | |
| 386 | + | |
| 387 | +enum FeatureType { | |
| 388 | + FEATURE | |
| 389 | +} | |
| 390 | + | |
| 391 | +final featureTypeValues = EnumValues({ | |
| 392 | + "Feature": FeatureType.FEATURE | |
| 393 | +}); | |
| 394 | + | |
| 395 | +class EnumValues<T> { | |
| 396 | + Map<String, T> map; | |
| 397 | + late Map<T, String> reverseMap; | |
| 398 | + | |
| 399 | + EnumValues(this.map); | |
| 400 | + | |
| 401 | + Map<T, String> get reverse { | |
| 402 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 403 | + return reverseMap; | |
| 404 | + } | |
| 405 | +} |
Test case
1 generated file · +127 −0test/inputs/json/misc/b4865.json
Adartdefault / TopLevel.dart+127 −0
| @@ -0,0 +1,127 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String? computedRegionCbhkFwbd; | |
| 13 | + final String? computedRegionNnqa25F4; | |
| 14 | + final Fall fall; | |
| 15 | + final Geolocation? geolocation; | |
| 16 | + final String id; | |
| 17 | + final String? mass; | |
| 18 | + final String name; | |
| 19 | + final Nametype nametype; | |
| 20 | + final String recclass; | |
| 21 | + final String? reclat; | |
| 22 | + final String? reclong; | |
| 23 | + final DateTime? year; | |
| 24 | + | |
| 25 | + TopLevel({ | |
| 26 | + this.computedRegionCbhkFwbd, | |
| 27 | + this.computedRegionNnqa25F4, | |
| 28 | + required this.fall, | |
| 29 | + this.geolocation, | |
| 30 | + required this.id, | |
| 31 | + this.mass, | |
| 32 | + required this.name, | |
| 33 | + required this.nametype, | |
| 34 | + required this.recclass, | |
| 35 | + this.reclat, | |
| 36 | + this.reclong, | |
| 37 | + this.year, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 41 | + computedRegionCbhkFwbd: json[":@computed_region_cbhk_fwbd"], | |
| 42 | + computedRegionNnqa25F4: json[":@computed_region_nnqa_25f4"], | |
| 43 | + fall: fallValues.map[json["fall"]]!, | |
| 44 | + geolocation: json["geolocation"] == null ? null : Geolocation.fromJson(json["geolocation"]), | |
| 45 | + id: json["id"], | |
| 46 | + mass: json["mass"], | |
| 47 | + name: json["name"], | |
| 48 | + nametype: nametypeValues.map[json["nametype"]]!, | |
| 49 | + recclass: json["recclass"], | |
| 50 | + reclat: json["reclat"], | |
| 51 | + reclong: json["reclong"], | |
| 52 | + year: json["year"] == null ? null : DateTime.parse(json["year"]), | |
| 53 | + ); | |
| 54 | + | |
| 55 | + Map<String, dynamic> toJson() => { | |
| 56 | + ":@computed_region_cbhk_fwbd": computedRegionCbhkFwbd, | |
| 57 | + ":@computed_region_nnqa_25f4": computedRegionNnqa25F4, | |
| 58 | + "fall": fallValues.reverse[fall], | |
| 59 | + "geolocation": geolocation?.toJson(), | |
| 60 | + "id": id, | |
| 61 | + "mass": mass, | |
| 62 | + "name": name, | |
| 63 | + "nametype": nametypeValues.reverse[nametype], | |
| 64 | + "recclass": recclass, | |
| 65 | + "reclat": reclat, | |
| 66 | + "reclong": reclong, | |
| 67 | + "year": year?.toIso8601String(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +enum Fall { | |
| 72 | + FELL, | |
| 73 | + FOUND | |
| 74 | +} | |
| 75 | + | |
| 76 | +final fallValues = EnumValues({ | |
| 77 | + "Fell": Fall.FELL, | |
| 78 | + "Found": Fall.FOUND | |
| 79 | +}); | |
| 80 | + | |
| 81 | +class Geolocation { | |
| 82 | + final List<double> coordinates; | |
| 83 | + final Type type; | |
| 84 | + | |
| 85 | + Geolocation({ | |
| 86 | + required this.coordinates, | |
| 87 | + required this.type, | |
| 88 | + }); | |
| 89 | + | |
| 90 | + factory Geolocation.fromJson(Map<String, dynamic> json) => Geolocation( | |
| 91 | + coordinates: List<double>.from(json["coordinates"].map((x) => x?.toDouble())), | |
| 92 | + type: typeValues.map[json["type"]]!, | |
| 93 | + ); | |
| 94 | + | |
| 95 | + Map<String, dynamic> toJson() => { | |
| 96 | + "coordinates": List<dynamic>.from(coordinates.map((x) => x)), | |
| 97 | + "type": typeValues.reverse[type], | |
| 98 | + }; | |
| 99 | +} | |
| 100 | + | |
| 101 | +enum Type { | |
| 102 | + POINT | |
| 103 | +} | |
| 104 | + | |
| 105 | +final typeValues = EnumValues({ | |
| 106 | + "Point": Type.POINT | |
| 107 | +}); | |
| 108 | + | |
| 109 | +enum Nametype { | |
| 110 | + VALID | |
| 111 | +} | |
| 112 | + | |
| 113 | +final nametypeValues = EnumValues({ | |
| 114 | + "Valid": Nametype.VALID | |
| 115 | +}); | |
| 116 | + | |
| 117 | +class EnumValues<T> { | |
| 118 | + Map<String, T> map; | |
| 119 | + late Map<T, String> reverseMap; | |
| 120 | + | |
| 121 | + EnumValues(this.map); | |
| 122 | + | |
| 123 | + Map<T, String> get reverse { | |
| 124 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 125 | + return reverseMap; | |
| 126 | + } | |
| 127 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/b6f2c.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +37 −0test/inputs/json/misc/b6fe5.json
Adartdefault / TopLevel.dart+37 −0
| @@ -0,0 +1,37 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String group; | |
| 13 | + final String movie; | |
| 14 | + final String movieImage; | |
| 15 | + final String theater; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.group, | |
| 19 | + required this.movie, | |
| 20 | + required this.movieImage, | |
| 21 | + required this.theater, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + group: json["group"], | |
| 26 | + movie: json["movie"], | |
| 27 | + movieImage: json["movie-image"], | |
| 28 | + theater: json["theater"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "group": group, | |
| 33 | + "movie": movie, | |
| 34 | + "movie-image": movieImage, | |
| 35 | + "theater": theater, | |
| 36 | + }; | |
| 37 | +} |
Test case
1 generated file · +25 −0test/inputs/json/misc/b9f64.json
Adartdefault / TopLevel.dart+25 −0
| @@ -0,0 +1,25 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String userAgent; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.userAgent, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + userAgent: json["user-agent"], | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "user-agent": userAgent, | |
| 24 | + }; | |
| 25 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/bb1ec.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +645 −0test/inputs/json/misc/be234.json
Adartdefault / TopLevel.dart+645 −0
| @@ -0,0 +1,645 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final dynamic authorFlairCssClass; | |
| 85 | + final String? authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final String? distinguished; | |
| 96 | + final Domain domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final dynamic linkFlairCssClass; | |
| 107 | + final dynamic linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final Media? media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final PostHint postHint; | |
| 118 | + final Preview preview; | |
| 119 | + final bool quarantine; | |
| 120 | + final dynamic removalReason; | |
| 121 | + final dynamic reportReasons; | |
| 122 | + final bool saved; | |
| 123 | + final int score; | |
| 124 | + final Media? secureMedia; | |
| 125 | + final MediaEmbed secureMediaEmbed; | |
| 126 | + final String selftext; | |
| 127 | + final dynamic selftextHtml; | |
| 128 | + final bool spoiler; | |
| 129 | + final bool stickied; | |
| 130 | + final Subreddit subreddit; | |
| 131 | + final SubredditId subredditId; | |
| 132 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 133 | + final SubredditType subredditType; | |
| 134 | + final dynamic suggestedSort; | |
| 135 | + final String thumbnail; | |
| 136 | + final int thumbnailHeight; | |
| 137 | + final int thumbnailWidth; | |
| 138 | + final String title; | |
| 139 | + final int ups; | |
| 140 | + final String url; | |
| 141 | + final List<dynamic> userReports; | |
| 142 | + final dynamic viewCount; | |
| 143 | + final bool visited; | |
| 144 | + | |
| 145 | + ChildData({ | |
| 146 | + required this.approvedAtUtc, | |
| 147 | + required this.approvedBy, | |
| 148 | + required this.archived, | |
| 149 | + required this.author, | |
| 150 | + required this.authorFlairCssClass, | |
| 151 | + required this.authorFlairText, | |
| 152 | + required this.bannedAtUtc, | |
| 153 | + required this.bannedBy, | |
| 154 | + required this.brandSafe, | |
| 155 | + required this.canGild, | |
| 156 | + required this.canModPost, | |
| 157 | + required this.clicked, | |
| 158 | + required this.contestMode, | |
| 159 | + required this.created, | |
| 160 | + required this.createdUtc, | |
| 161 | + required this.distinguished, | |
| 162 | + required this.domain, | |
| 163 | + required this.downs, | |
| 164 | + required this.edited, | |
| 165 | + required this.gilded, | |
| 166 | + required this.hidden, | |
| 167 | + required this.hideScore, | |
| 168 | + required this.id, | |
| 169 | + required this.isSelf, | |
| 170 | + required this.isVideo, | |
| 171 | + required this.likes, | |
| 172 | + required this.linkFlairCssClass, | |
| 173 | + required this.linkFlairText, | |
| 174 | + required this.locked, | |
| 175 | + required this.media, | |
| 176 | + required this.mediaEmbed, | |
| 177 | + required this.modReports, | |
| 178 | + required this.name, | |
| 179 | + required this.numComments, | |
| 180 | + required this.numReports, | |
| 181 | + required this.over18, | |
| 182 | + required this.permalink, | |
| 183 | + required this.postHint, | |
| 184 | + required this.preview, | |
| 185 | + required this.quarantine, | |
| 186 | + required this.removalReason, | |
| 187 | + required this.reportReasons, | |
| 188 | + required this.saved, | |
| 189 | + required this.score, | |
| 190 | + required this.secureMedia, | |
| 191 | + required this.secureMediaEmbed, | |
| 192 | + required this.selftext, | |
| 193 | + required this.selftextHtml, | |
| 194 | + required this.spoiler, | |
| 195 | + required this.stickied, | |
| 196 | + required this.subreddit, | |
| 197 | + required this.subredditId, | |
| 198 | + required this.subredditNamePrefixed, | |
| 199 | + required this.subredditType, | |
| 200 | + required this.suggestedSort, | |
| 201 | + required this.thumbnail, | |
| 202 | + required this.thumbnailHeight, | |
| 203 | + required this.thumbnailWidth, | |
| 204 | + required this.title, | |
| 205 | + required this.ups, | |
| 206 | + required this.url, | |
| 207 | + required this.userReports, | |
| 208 | + required this.viewCount, | |
| 209 | + required this.visited, | |
| 210 | + }); | |
| 211 | + | |
| 212 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 213 | + approvedAtUtc: json["approved_at_utc"], | |
| 214 | + approvedBy: json["approved_by"], | |
| 215 | + archived: json["archived"], | |
| 216 | + author: json["author"], | |
| 217 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 218 | + authorFlairText: json["author_flair_text"], | |
| 219 | + bannedAtUtc: json["banned_at_utc"], | |
| 220 | + bannedBy: json["banned_by"], | |
| 221 | + brandSafe: json["brand_safe"], | |
| 222 | + canGild: json["can_gild"], | |
| 223 | + canModPost: json["can_mod_post"], | |
| 224 | + clicked: json["clicked"], | |
| 225 | + contestMode: json["contest_mode"], | |
| 226 | + created: json["created"]?.toDouble(), | |
| 227 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 228 | + distinguished: json["distinguished"], | |
| 229 | + domain: domainValues.map[json["domain"]]!, | |
| 230 | + downs: json["downs"], | |
| 231 | + edited: json["edited"], | |
| 232 | + gilded: json["gilded"], | |
| 233 | + hidden: json["hidden"], | |
| 234 | + hideScore: json["hide_score"], | |
| 235 | + id: json["id"], | |
| 236 | + isSelf: json["is_self"], | |
| 237 | + isVideo: json["is_video"], | |
| 238 | + likes: json["likes"], | |
| 239 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 240 | + linkFlairText: json["link_flair_text"], | |
| 241 | + locked: json["locked"], | |
| 242 | + media: json["media"] == null ? null : Media.fromJson(json["media"]), | |
| 243 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 244 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 245 | + name: json["name"], | |
| 246 | + numComments: json["num_comments"], | |
| 247 | + numReports: json["num_reports"], | |
| 248 | + over18: json["over_18"], | |
| 249 | + permalink: json["permalink"], | |
| 250 | + postHint: postHintValues.map[json["post_hint"]]!, | |
| 251 | + preview: Preview.fromJson(json["preview"]), | |
| 252 | + quarantine: json["quarantine"], | |
| 253 | + removalReason: json["removal_reason"], | |
| 254 | + reportReasons: json["report_reasons"], | |
| 255 | + saved: json["saved"], | |
| 256 | + score: json["score"], | |
| 257 | + secureMedia: json["secure_media"] == null ? null : Media.fromJson(json["secure_media"]), | |
| 258 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 259 | + selftext: json["selftext"], | |
| 260 | + selftextHtml: json["selftext_html"], | |
| 261 | + spoiler: json["spoiler"], | |
| 262 | + stickied: json["stickied"], | |
| 263 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 264 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 265 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 266 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 267 | + suggestedSort: json["suggested_sort"], | |
| 268 | + thumbnail: json["thumbnail"], | |
| 269 | + thumbnailHeight: json["thumbnail_height"], | |
| 270 | + thumbnailWidth: json["thumbnail_width"], | |
| 271 | + title: json["title"], | |
| 272 | + ups: json["ups"], | |
| 273 | + url: json["url"], | |
| 274 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 275 | + viewCount: json["view_count"], | |
| 276 | + visited: json["visited"], | |
| 277 | + ); | |
| 278 | + | |
| 279 | + Map<String, dynamic> toJson() => { | |
| 280 | + "approved_at_utc": approvedAtUtc, | |
| 281 | + "approved_by": approvedBy, | |
| 282 | + "archived": archived, | |
| 283 | + "author": author, | |
| 284 | + "author_flair_css_class": authorFlairCssClass, | |
| 285 | + "author_flair_text": authorFlairText, | |
| 286 | + "banned_at_utc": bannedAtUtc, | |
| 287 | + "banned_by": bannedBy, | |
| 288 | + "brand_safe": brandSafe, | |
| 289 | + "can_gild": canGild, | |
| 290 | + "can_mod_post": canModPost, | |
| 291 | + "clicked": clicked, | |
| 292 | + "contest_mode": contestMode, | |
| 293 | + "created": created, | |
| 294 | + "created_utc": createdUtc, | |
| 295 | + "distinguished": distinguished, | |
| 296 | + "domain": domainValues.reverse[domain], | |
| 297 | + "downs": downs, | |
| 298 | + "edited": edited, | |
| 299 | + "gilded": gilded, | |
| 300 | + "hidden": hidden, | |
| 301 | + "hide_score": hideScore, | |
| 302 | + "id": id, | |
| 303 | + "is_self": isSelf, | |
| 304 | + "is_video": isVideo, | |
| 305 | + "likes": likes, | |
| 306 | + "link_flair_css_class": linkFlairCssClass, | |
| 307 | + "link_flair_text": linkFlairText, | |
| 308 | + "locked": locked, | |
| 309 | + "media": media?.toJson(), | |
| 310 | + "media_embed": mediaEmbed.toJson(), | |
| 311 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 312 | + "name": name, | |
| 313 | + "num_comments": numComments, | |
| 314 | + "num_reports": numReports, | |
| 315 | + "over_18": over18, | |
| 316 | + "permalink": permalink, | |
| 317 | + "post_hint": postHintValues.reverse[postHint], | |
| 318 | + "preview": preview.toJson(), | |
| 319 | + "quarantine": quarantine, | |
| 320 | + "removal_reason": removalReason, | |
| 321 | + "report_reasons": reportReasons, | |
| 322 | + "saved": saved, | |
| 323 | + "score": score, | |
| 324 | + "secure_media": secureMedia?.toJson(), | |
| 325 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 326 | + "selftext": selftext, | |
| 327 | + "selftext_html": selftextHtml, | |
| 328 | + "spoiler": spoiler, | |
| 329 | + "stickied": stickied, | |
| 330 | + "subreddit": subredditValues.reverse[subreddit], | |
| 331 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 332 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 333 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 334 | + "suggested_sort": suggestedSort, | |
| 335 | + "thumbnail": thumbnail, | |
| 336 | + "thumbnail_height": thumbnailHeight, | |
| 337 | + "thumbnail_width": thumbnailWidth, | |
| 338 | + "title": title, | |
| 339 | + "ups": ups, | |
| 340 | + "url": url, | |
| 341 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 342 | + "view_count": viewCount, | |
| 343 | + "visited": visited, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +enum Domain { | |
| 348 | + REDDIT_COM, | |
| 349 | + I_REDD_IT, | |
| 350 | + I_IMGUR_COM, | |
| 351 | + GFYCAT_COM, | |
| 352 | + IMGUR_COM | |
| 353 | +} | |
| 354 | + | |
| 355 | +final domainValues = EnumValues({ | |
| 356 | + "reddit.com": Domain.REDDIT_COM, | |
| 357 | + "i.redd.it": Domain.I_REDD_IT, | |
| 358 | + "i.imgur.com": Domain.I_IMGUR_COM, | |
| 359 | + "gfycat.com": Domain.GFYCAT_COM, | |
| 360 | + "imgur.com": Domain.IMGUR_COM | |
| 361 | +}); | |
| 362 | + | |
| 363 | +class Media { | |
| 364 | + final Oembed oembed; | |
| 365 | + final Domain type; | |
| 366 | + | |
| 367 | + Media({ | |
| 368 | + required this.oembed, | |
| 369 | + required this.type, | |
| 370 | + }); | |
| 371 | + | |
| 372 | + factory Media.fromJson(Map<String, dynamic> json) => Media( | |
| 373 | + oembed: Oembed.fromJson(json["oembed"]), | |
| 374 | + type: domainValues.map[json["type"]]!, | |
| 375 | + ); | |
| 376 | + | |
| 377 | + Map<String, dynamic> toJson() => { | |
| 378 | + "oembed": oembed.toJson(), | |
| 379 | + "type": domainValues.reverse[type], | |
| 380 | + }; | |
| 381 | +} | |
| 382 | + | |
| 383 | +class Oembed { | |
| 384 | + final String description; | |
| 385 | + final int height; | |
| 386 | + final String html; | |
| 387 | + final String providerName; | |
| 388 | + final String providerUrl; | |
| 389 | + final int thumbnailHeight; | |
| 390 | + final String thumbnailUrl; | |
| 391 | + final int thumbnailWidth; | |
| 392 | + final String title; | |
| 393 | + final String type; | |
| 394 | + final String version; | |
| 395 | + final int width; | |
| 396 | + | |
| 397 | + Oembed({ | |
| 398 | + required this.description, | |
| 399 | + required this.height, | |
| 400 | + required this.html, | |
| 401 | + required this.providerName, | |
| 402 | + required this.providerUrl, | |
| 403 | + required this.thumbnailHeight, | |
| 404 | + required this.thumbnailUrl, | |
| 405 | + required this.thumbnailWidth, | |
| 406 | + required this.title, | |
| 407 | + required this.type, | |
| 408 | + required this.version, | |
| 409 | + required this.width, | |
| 410 | + }); | |
| 411 | + | |
| 412 | + factory Oembed.fromJson(Map<String, dynamic> json) => Oembed( | |
| 413 | + description: json["description"], | |
| 414 | + height: json["height"], | |
| 415 | + html: json["html"], | |
| 416 | + providerName: json["provider_name"], | |
| 417 | + providerUrl: json["provider_url"], | |
| 418 | + thumbnailHeight: json["thumbnail_height"], | |
| 419 | + thumbnailUrl: json["thumbnail_url"], | |
| 420 | + thumbnailWidth: json["thumbnail_width"], | |
| 421 | + title: json["title"], | |
| 422 | + type: json["type"], | |
| 423 | + version: json["version"], | |
| 424 | + width: json["width"], | |
| 425 | + ); | |
| 426 | + | |
| 427 | + Map<String, dynamic> toJson() => { | |
| 428 | + "description": description, | |
| 429 | + "height": height, | |
| 430 | + "html": html, | |
| 431 | + "provider_name": providerName, | |
| 432 | + "provider_url": providerUrl, | |
| 433 | + "thumbnail_height": thumbnailHeight, | |
| 434 | + "thumbnail_url": thumbnailUrl, | |
| 435 | + "thumbnail_width": thumbnailWidth, | |
| 436 | + "title": title, | |
| 437 | + "type": type, | |
| 438 | + "version": version, | |
| 439 | + "width": width, | |
| 440 | + }; | |
| 441 | +} | |
| 442 | + | |
| 443 | +class MediaEmbed { | |
| 444 | + final String? content; | |
| 445 | + final int? height; | |
| 446 | + final bool? scrolling; | |
| 447 | + final int? width; | |
| 448 | + | |
| 449 | + MediaEmbed({ | |
| 450 | + this.content, | |
| 451 | + this.height, | |
| 452 | + this.scrolling, | |
| 453 | + this.width, | |
| 454 | + }); | |
| 455 | + | |
| 456 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 457 | + content: json["content"], | |
| 458 | + height: json["height"], | |
| 459 | + scrolling: json["scrolling"], | |
| 460 | + width: json["width"], | |
| 461 | + ); | |
| 462 | + | |
| 463 | + Map<String, dynamic> toJson() => { | |
| 464 | + "content": content, | |
| 465 | + "height": height, | |
| 466 | + "scrolling": scrolling, | |
| 467 | + "width": width, | |
| 468 | + }; | |
| 469 | +} | |
| 470 | + | |
| 471 | +enum PostHint { | |
| 472 | + LINK, | |
| 473 | + IMAGE, | |
| 474 | + RICH_VIDEO | |
| 475 | +} | |
| 476 | + | |
| 477 | +final postHintValues = EnumValues({ | |
| 478 | + "link": PostHint.LINK, | |
| 479 | + "image": PostHint.IMAGE, | |
| 480 | + "rich:video": PostHint.RICH_VIDEO | |
| 481 | +}); | |
| 482 | + | |
| 483 | +class Preview { | |
| 484 | + final bool enabled; | |
| 485 | + final List<Image> images; | |
| 486 | + | |
| 487 | + Preview({ | |
| 488 | + required this.enabled, | |
| 489 | + required this.images, | |
| 490 | + }); | |
| 491 | + | |
| 492 | + factory Preview.fromJson(Map<String, dynamic> json) => Preview( | |
| 493 | + enabled: json["enabled"], | |
| 494 | + images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), | |
| 495 | + ); | |
| 496 | + | |
| 497 | + Map<String, dynamic> toJson() => { | |
| 498 | + "enabled": enabled, | |
| 499 | + "images": List<dynamic>.from(images.map((x) => x.toJson())), | |
| 500 | + }; | |
| 501 | +} | |
| 502 | + | |
| 503 | +class Image { | |
| 504 | + final String id; | |
| 505 | + final List<Source> resolutions; | |
| 506 | + final Source source; | |
| 507 | + final Variants variants; | |
| 508 | + | |
| 509 | + Image({ | |
| 510 | + required this.id, | |
| 511 | + required this.resolutions, | |
| 512 | + required this.source, | |
| 513 | + required this.variants, | |
| 514 | + }); | |
| 515 | + | |
| 516 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 517 | + id: json["id"], | |
| 518 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 519 | + source: Source.fromJson(json["source"]), | |
| 520 | + variants: Variants.fromJson(json["variants"]), | |
| 521 | + ); | |
| 522 | + | |
| 523 | + Map<String, dynamic> toJson() => { | |
| 524 | + "id": id, | |
| 525 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 526 | + "source": source.toJson(), | |
| 527 | + "variants": variants.toJson(), | |
| 528 | + }; | |
| 529 | +} | |
| 530 | + | |
| 531 | +class Source { | |
| 532 | + final int height; | |
| 533 | + final String url; | |
| 534 | + final int width; | |
| 535 | + | |
| 536 | + Source({ | |
| 537 | + required this.height, | |
| 538 | + required this.url, | |
| 539 | + required this.width, | |
| 540 | + }); | |
| 541 | + | |
| 542 | + factory Source.fromJson(Map<String, dynamic> json) => Source( | |
| 543 | + height: json["height"], | |
| 544 | + url: json["url"], | |
| 545 | + width: json["width"], | |
| 546 | + ); | |
| 547 | + | |
| 548 | + Map<String, dynamic> toJson() => { | |
| 549 | + "height": height, | |
| 550 | + "url": url, | |
| 551 | + "width": width, | |
| 552 | + }; | |
| 553 | +} | |
| 554 | + | |
| 555 | +class Variants { | |
| 556 | + final Gif? gif; | |
| 557 | + final Gif? mp4; | |
| 558 | + | |
| 559 | + Variants({ | |
| 560 | + this.gif, | |
| 561 | + this.mp4, | |
| 562 | + }); | |
| 563 | + | |
| 564 | + factory Variants.fromJson(Map<String, dynamic> json) => Variants( | |
| 565 | + gif: json["gif"] == null ? null : Gif.fromJson(json["gif"]), | |
| 566 | + mp4: json["mp4"] == null ? null : Gif.fromJson(json["mp4"]), | |
| 567 | + ); | |
| 568 | + | |
| 569 | + Map<String, dynamic> toJson() => { | |
| 570 | + "gif": gif?.toJson(), | |
| 571 | + "mp4": mp4?.toJson(), | |
| 572 | + }; | |
| 573 | +} | |
| 574 | + | |
| 575 | +class Gif { | |
| 576 | + final List<Source> resolutions; | |
| 577 | + final Source source; | |
| 578 | + | |
| 579 | + Gif({ | |
| 580 | + required this.resolutions, | |
| 581 | + required this.source, | |
| 582 | + }); | |
| 583 | + | |
| 584 | + factory Gif.fromJson(Map<String, dynamic> json) => Gif( | |
| 585 | + resolutions: List<Source>.from(json["resolutions"].map((x) => Source.fromJson(x))), | |
| 586 | + source: Source.fromJson(json["source"]), | |
| 587 | + ); | |
| 588 | + | |
| 589 | + Map<String, dynamic> toJson() => { | |
| 590 | + "resolutions": List<dynamic>.from(resolutions.map((x) => x.toJson())), | |
| 591 | + "source": source.toJson(), | |
| 592 | + }; | |
| 593 | +} | |
| 594 | + | |
| 595 | +enum Subreddit { | |
| 596 | + FUNNY | |
| 597 | +} | |
| 598 | + | |
| 599 | +final subredditValues = EnumValues({ | |
| 600 | + "funny": Subreddit.FUNNY | |
| 601 | +}); | |
| 602 | + | |
| 603 | +enum SubredditId { | |
| 604 | + T5_2_QH33 | |
| 605 | +} | |
| 606 | + | |
| 607 | +final subredditIdValues = EnumValues({ | |
| 608 | + "t5_2qh33": SubredditId.T5_2_QH33 | |
| 609 | +}); | |
| 610 | + | |
| 611 | +enum SubredditNamePrefixed { | |
| 612 | + R_FUNNY | |
| 613 | +} | |
| 614 | + | |
| 615 | +final subredditNamePrefixedValues = EnumValues({ | |
| 616 | + "r/funny": SubredditNamePrefixed.R_FUNNY | |
| 617 | +}); | |
| 618 | + | |
| 619 | +enum SubredditType { | |
| 620 | + PUBLIC | |
| 621 | +} | |
| 622 | + | |
| 623 | +final subredditTypeValues = EnumValues({ | |
| 624 | + "public": SubredditType.PUBLIC | |
| 625 | +}); | |
| 626 | + | |
| 627 | +enum Kind { | |
| 628 | + T3 | |
| 629 | +} | |
| 630 | + | |
| 631 | +final kindValues = EnumValues({ | |
| 632 | + "t3": Kind.T3 | |
| 633 | +}); | |
| 634 | + | |
| 635 | +class EnumValues<T> { | |
| 636 | + Map<String, T> map; | |
| 637 | + late Map<T, String> reverseMap; | |
| 638 | + | |
| 639 | + EnumValues(this.map); | |
| 640 | + | |
| 641 | + Map<T, String> get reverse { | |
| 642 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 643 | + return reverseMap; | |
| 644 | + } | |
| 645 | +} |
Test case
1 generated file · +73 −0test/inputs/json/misc/c0356.json
Adartdefault / TopLevel.dart+73 −0
| @@ -0,0 +1,73 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Map<String, Datum> data; | |
| 13 | + final Description description; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.description, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: Map.from(json["data"]).map((k, v) => MapEntry<String, Datum>(k, Datum.fromJson(v))), | |
| 22 | + description: Description.fromJson(json["description"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 27 | + "description": description.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Datum { | |
| 32 | + final String anomaly; | |
| 33 | + final String value; | |
| 34 | + | |
| 35 | + Datum({ | |
| 36 | + required this.anomaly, | |
| 37 | + required this.value, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 41 | + anomaly: json["anomaly"], | |
| 42 | + value: json["value"], | |
| 43 | + ); | |
| 44 | + | |
| 45 | + Map<String, dynamic> toJson() => { | |
| 46 | + "anomaly": anomaly, | |
| 47 | + "value": value, | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Description { | |
| 52 | + final String basePeriod; | |
| 53 | + final int missing; | |
| 54 | + final String title; | |
| 55 | + | |
| 56 | + Description({ | |
| 57 | + required this.basePeriod, | |
| 58 | + required this.missing, | |
| 59 | + required this.title, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Description.fromJson(Map<String, dynamic> json) => Description( | |
| 63 | + basePeriod: json["base_period"], | |
| 64 | + missing: json["missing"], | |
| 65 | + title: json["title"], | |
| 66 | + ); | |
| 67 | + | |
| 68 | + Map<String, dynamic> toJson() => { | |
| 69 | + "base_period": basePeriod, | |
| 70 | + "missing": missing, | |
| 71 | + "title": title, | |
| 72 | + }; | |
| 73 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/c0a3a.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +471 −0test/inputs/json/misc/c3303.json
Adartdefault / TopLevel.dart+471 −0
| @@ -0,0 +1,471 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final Username username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: usernameValues.map[json["username"]]!, | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": usernameValues.reverse[username], | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final Looping looping; | |
| 136 | + final FixedHeight original; | |
| 137 | + final DownsizedSmall originalMp4; | |
| 138 | + final Downsized originalStill; | |
| 139 | + final DownsizedSmall preview; | |
| 140 | + final Downsized previewGif; | |
| 141 | + final Downsized previewWebp; | |
| 142 | + final Downsized? the480WStill; | |
| 143 | + | |
| 144 | + Images({ | |
| 145 | + required this.downsized, | |
| 146 | + required this.downsizedLarge, | |
| 147 | + required this.downsizedMedium, | |
| 148 | + required this.downsizedSmall, | |
| 149 | + required this.downsizedStill, | |
| 150 | + required this.fixedHeight, | |
| 151 | + required this.fixedHeightDownsampled, | |
| 152 | + required this.fixedHeightSmall, | |
| 153 | + required this.fixedHeightSmallStill, | |
| 154 | + required this.fixedHeightStill, | |
| 155 | + required this.fixedWidth, | |
| 156 | + required this.fixedWidthDownsampled, | |
| 157 | + required this.fixedWidthSmall, | |
| 158 | + required this.fixedWidthSmallStill, | |
| 159 | + required this.fixedWidthStill, | |
| 160 | + required this.looping, | |
| 161 | + required this.original, | |
| 162 | + required this.originalMp4, | |
| 163 | + required this.originalStill, | |
| 164 | + required this.preview, | |
| 165 | + required this.previewGif, | |
| 166 | + required this.previewWebp, | |
| 167 | + this.the480WStill, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 171 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 172 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 173 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 174 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 175 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 176 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 177 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 178 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 179 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 180 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 181 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 182 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 183 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 184 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 185 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 186 | + looping: Looping.fromJson(json["looping"]), | |
| 187 | + original: FixedHeight.fromJson(json["original"]), | |
| 188 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 189 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 190 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 191 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 192 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 193 | + the480WStill: json["480w_still"] == null ? null : Downsized.fromJson(json["480w_still"]), | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "downsized": downsized.toJson(), | |
| 198 | + "downsized_large": downsizedLarge.toJson(), | |
| 199 | + "downsized_medium": downsizedMedium.toJson(), | |
| 200 | + "downsized_small": downsizedSmall.toJson(), | |
| 201 | + "downsized_still": downsizedStill.toJson(), | |
| 202 | + "fixed_height": fixedHeight.toJson(), | |
| 203 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 204 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 205 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 206 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 207 | + "fixed_width": fixedWidth.toJson(), | |
| 208 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 209 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 210 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 211 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 212 | + "looping": looping.toJson(), | |
| 213 | + "original": original.toJson(), | |
| 214 | + "original_mp4": originalMp4.toJson(), | |
| 215 | + "original_still": originalStill.toJson(), | |
| 216 | + "preview": preview.toJson(), | |
| 217 | + "preview_gif": previewGif.toJson(), | |
| 218 | + "preview_webp": previewWebp.toJson(), | |
| 219 | + "480w_still": the480WStill?.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Downsized { | |
| 224 | + final String height; | |
| 225 | + final String? size; | |
| 226 | + final String url; | |
| 227 | + final String width; | |
| 228 | + | |
| 229 | + Downsized({ | |
| 230 | + required this.height, | |
| 231 | + this.size, | |
| 232 | + required this.url, | |
| 233 | + required this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 237 | + height: json["height"], | |
| 238 | + size: json["size"], | |
| 239 | + url: json["url"], | |
| 240 | + width: json["width"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "height": height, | |
| 245 | + "size": size, | |
| 246 | + "url": url, | |
| 247 | + "width": width, | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +class DownsizedSmall { | |
| 252 | + final String height; | |
| 253 | + final String mp4; | |
| 254 | + final String mp4Size; | |
| 255 | + final String width; | |
| 256 | + | |
| 257 | + DownsizedSmall({ | |
| 258 | + required this.height, | |
| 259 | + required this.mp4, | |
| 260 | + required this.mp4Size, | |
| 261 | + required this.width, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 265 | + height: json["height"], | |
| 266 | + mp4: json["mp4"], | |
| 267 | + mp4Size: json["mp4_size"], | |
| 268 | + width: json["width"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "height": height, | |
| 273 | + "mp4": mp4, | |
| 274 | + "mp4_size": mp4Size, | |
| 275 | + "width": width, | |
| 276 | + }; | |
| 277 | +} | |
| 278 | + | |
| 279 | +class FixedHeight { | |
| 280 | + final String? frames; | |
| 281 | + final String? hash; | |
| 282 | + final String height; | |
| 283 | + final String? mp4; | |
| 284 | + final String? mp4Size; | |
| 285 | + final String size; | |
| 286 | + final String url; | |
| 287 | + final String webp; | |
| 288 | + final String webpSize; | |
| 289 | + final String width; | |
| 290 | + | |
| 291 | + FixedHeight({ | |
| 292 | + this.frames, | |
| 293 | + this.hash, | |
| 294 | + required this.height, | |
| 295 | + this.mp4, | |
| 296 | + this.mp4Size, | |
| 297 | + required this.size, | |
| 298 | + required this.url, | |
| 299 | + required this.webp, | |
| 300 | + required this.webpSize, | |
| 301 | + required this.width, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 305 | + frames: json["frames"], | |
| 306 | + hash: json["hash"], | |
| 307 | + height: json["height"], | |
| 308 | + mp4: json["mp4"], | |
| 309 | + mp4Size: json["mp4_size"], | |
| 310 | + size: json["size"], | |
| 311 | + url: json["url"], | |
| 312 | + webp: json["webp"], | |
| 313 | + webpSize: json["webp_size"], | |
| 314 | + width: json["width"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "frames": frames, | |
| 319 | + "hash": hash, | |
| 320 | + "height": height, | |
| 321 | + "mp4": mp4, | |
| 322 | + "mp4_size": mp4Size, | |
| 323 | + "size": size, | |
| 324 | + "url": url, | |
| 325 | + "webp": webp, | |
| 326 | + "webp_size": webpSize, | |
| 327 | + "width": width, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class Looping { | |
| 332 | + final String mp4; | |
| 333 | + final String mp4Size; | |
| 334 | + | |
| 335 | + Looping({ | |
| 336 | + required this.mp4, | |
| 337 | + required this.mp4Size, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 341 | + mp4: json["mp4"], | |
| 342 | + mp4Size: json["mp4_size"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "mp4": mp4, | |
| 347 | + "mp4_size": mp4Size, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +enum Rating { | |
| 352 | + PG, | |
| 353 | + G, | |
| 354 | + PG_13 | |
| 355 | +} | |
| 356 | + | |
| 357 | +final ratingValues = EnumValues({ | |
| 358 | + "pg": Rating.PG, | |
| 359 | + "g": Rating.G, | |
| 360 | + "pg-13": Rating.PG_13 | |
| 361 | +}); | |
| 362 | + | |
| 363 | +enum Type { | |
| 364 | + GIF | |
| 365 | +} | |
| 366 | + | |
| 367 | +final typeValues = EnumValues({ | |
| 368 | + "gif": Type.GIF | |
| 369 | +}); | |
| 370 | + | |
| 371 | +class User { | |
| 372 | + final String avatarUrl; | |
| 373 | + final String bannerUrl; | |
| 374 | + final String displayName; | |
| 375 | + final String profileUrl; | |
| 376 | + final Username username; | |
| 377 | + | |
| 378 | + User({ | |
| 379 | + required this.avatarUrl, | |
| 380 | + required this.bannerUrl, | |
| 381 | + required this.displayName, | |
| 382 | + required this.profileUrl, | |
| 383 | + required this.username, | |
| 384 | + }); | |
| 385 | + | |
| 386 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 387 | + avatarUrl: json["avatar_url"], | |
| 388 | + bannerUrl: json["banner_url"], | |
| 389 | + displayName: json["display_name"], | |
| 390 | + profileUrl: json["profile_url"], | |
| 391 | + username: usernameValues.map[json["username"]]!, | |
| 392 | + ); | |
| 393 | + | |
| 394 | + Map<String, dynamic> toJson() => { | |
| 395 | + "avatar_url": avatarUrl, | |
| 396 | + "banner_url": bannerUrl, | |
| 397 | + "display_name": displayName, | |
| 398 | + "profile_url": profileUrl, | |
| 399 | + "username": usernameValues.reverse[username], | |
| 400 | + }; | |
| 401 | +} | |
| 402 | + | |
| 403 | +enum Username { | |
| 404 | + EMPTY, | |
| 405 | + DISNEYPIXAR | |
| 406 | +} | |
| 407 | + | |
| 408 | +final usernameValues = EnumValues({ | |
| 409 | + "": Username.EMPTY, | |
| 410 | + "disneypixar": Username.DISNEYPIXAR | |
| 411 | +}); | |
| 412 | + | |
| 413 | +class Meta { | |
| 414 | + final String msg; | |
| 415 | + final String responseId; | |
| 416 | + final int status; | |
| 417 | + | |
| 418 | + Meta({ | |
| 419 | + required this.msg, | |
| 420 | + required this.responseId, | |
| 421 | + required this.status, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 425 | + msg: json["msg"], | |
| 426 | + responseId: json["response_id"], | |
| 427 | + status: json["status"], | |
| 428 | + ); | |
| 429 | + | |
| 430 | + Map<String, dynamic> toJson() => { | |
| 431 | + "msg": msg, | |
| 432 | + "response_id": responseId, | |
| 433 | + "status": status, | |
| 434 | + }; | |
| 435 | +} | |
| 436 | + | |
| 437 | +class Pagination { | |
| 438 | + final int count; | |
| 439 | + final int offset; | |
| 440 | + final int totalCount; | |
| 441 | + | |
| 442 | + Pagination({ | |
| 443 | + required this.count, | |
| 444 | + required this.offset, | |
| 445 | + required this.totalCount, | |
| 446 | + }); | |
| 447 | + | |
| 448 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 449 | + count: json["count"], | |
| 450 | + offset: json["offset"], | |
| 451 | + totalCount: json["total_count"], | |
| 452 | + ); | |
| 453 | + | |
| 454 | + Map<String, dynamic> toJson() => { | |
| 455 | + "count": count, | |
| 456 | + "offset": offset, | |
| 457 | + "total_count": totalCount, | |
| 458 | + }; | |
| 459 | +} | |
| 460 | + | |
| 461 | +class EnumValues<T> { | |
| 462 | + Map<String, T> map; | |
| 463 | + late Map<T, String> reverseMap; | |
| 464 | + | |
| 465 | + EnumValues(this.map); | |
| 466 | + | |
| 467 | + Map<T, String> get reverse { | |
| 468 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 469 | + return reverseMap; | |
| 470 | + } | |
| 471 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/c6cfd.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Country> countries; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.countries, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + countries: List<Country>.from(json["countries"].map((x) => Country.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "countries": List<dynamic>.from(countries.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Country { | |
| 28 | + final String code; | |
| 29 | + final String name; | |
| 30 | + | |
| 31 | + Country({ | |
| 32 | + required this.code, | |
| 33 | + required this.name, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory Country.fromJson(Map<String, dynamic> json) => Country( | |
| 37 | + code: json["code"], | |
| 38 | + name: json["name"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "code": code, | |
| 43 | + "name": name, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +121 −0test/inputs/json/misc/c8c7e.json
Adartdefault / TopLevel.dart+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<dynamic> topLevelFromJson(String str) => List<dynamic>.from(json.decode(str).map((x) => x)); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<dynamic> data) => json.encode(List<dynamic>.from(data.map((x) => x))); | |
| 10 | + | |
| 11 | +class TopLevelElement { | |
| 12 | + final Country country; | |
| 13 | + final String date; | |
| 14 | + final String decimal; | |
| 15 | + final Country indicator; | |
| 16 | + final String value; | |
| 17 | + | |
| 18 | + TopLevelElement({ | |
| 19 | + required this.country, | |
| 20 | + required this.date, | |
| 21 | + required this.decimal, | |
| 22 | + required this.indicator, | |
| 23 | + required this.value, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevelElement.fromJson(Map<String, dynamic> json) => TopLevelElement( | |
| 27 | + country: Country.fromJson(json["country"]), | |
| 28 | + date: json["date"], | |
| 29 | + decimal: json["decimal"], | |
| 30 | + indicator: Country.fromJson(json["indicator"]), | |
| 31 | + value: json["value"], | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "country": country.toJson(), | |
| 36 | + "date": date, | |
| 37 | + "decimal": decimal, | |
| 38 | + "indicator": indicator.toJson(), | |
| 39 | + "value": value, | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class Country { | |
| 44 | + final Id id; | |
| 45 | + final Value value; | |
| 46 | + | |
| 47 | + Country({ | |
| 48 | + required this.id, | |
| 49 | + required this.value, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory Country.fromJson(Map<String, dynamic> json) => Country( | |
| 53 | + id: idValues.map[json["id"]]!, | |
| 54 | + value: valueValues.map[json["value"]]!, | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + "id": idValues.reverse[id], | |
| 59 | + "value": valueValues.reverse[value], | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +enum Id { | |
| 64 | + IN, | |
| 65 | + NY_GDP_MKTP_CD | |
| 66 | +} | |
| 67 | + | |
| 68 | +final idValues = EnumValues({ | |
| 69 | + "IN": Id.IN, | |
| 70 | + "NY.GDP.MKTP.CD": Id.NY_GDP_MKTP_CD | |
| 71 | +}); | |
| 72 | + | |
| 73 | +enum Value { | |
| 74 | + INDIA, | |
| 75 | + GDP_CURRENT_US | |
| 76 | +} | |
| 77 | + | |
| 78 | +final valueValues = EnumValues({ | |
| 79 | + "India": Value.INDIA, | |
| 80 | + "GDP (current US\u0024)": Value.GDP_CURRENT_US | |
| 81 | +}); | |
| 82 | + | |
| 83 | +class PurpleTopLevel { | |
| 84 | + final int page; | |
| 85 | + final int pages; | |
| 86 | + final String perPage; | |
| 87 | + final int total; | |
| 88 | + | |
| 89 | + PurpleTopLevel({ | |
| 90 | + required this.page, | |
| 91 | + required this.pages, | |
| 92 | + required this.perPage, | |
| 93 | + required this.total, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory PurpleTopLevel.fromJson(Map<String, dynamic> json) => PurpleTopLevel( | |
| 97 | + page: json["page"], | |
| 98 | + pages: json["pages"], | |
| 99 | + perPage: json["per_page"], | |
| 100 | + total: json["total"], | |
| 101 | + ); | |
| 102 | + | |
| 103 | + Map<String, dynamic> toJson() => { | |
| 104 | + "page": page, | |
| 105 | + "pages": pages, | |
| 106 | + "per_page": perPage, | |
| 107 | + "total": total, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class EnumValues<T> { | |
| 112 | + Map<String, T> map; | |
| 113 | + late Map<T, String> reverseMap; | |
| 114 | + | |
| 115 | + EnumValues(this.map); | |
| 116 | + | |
| 117 | + Map<T, String> get reverse { | |
| 118 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 119 | + return reverseMap; | |
| 120 | + } | |
| 121 | +} |
Test case
1 generated file · +115 −0test/inputs/json/misc/cb0cc.json
Adartdefault / TopLevel.dart+115 −0
| @@ -0,0 +1,115 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Prize> prizes; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.prizes, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + prizes: List<Prize>.from(json["prizes"].map((x) => Prize.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "prizes": List<dynamic>.from(prizes.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Prize { | |
| 28 | + final Category category; | |
| 29 | + final List<Laureate> laureates; | |
| 30 | + final String? overallMotivation; | |
| 31 | + final String year; | |
| 32 | + | |
| 33 | + Prize({ | |
| 34 | + required this.category, | |
| 35 | + required this.laureates, | |
| 36 | + this.overallMotivation, | |
| 37 | + required this.year, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Prize.fromJson(Map<String, dynamic> json) => Prize( | |
| 41 | + category: categoryValues.map[json["category"]]!, | |
| 42 | + laureates: List<Laureate>.from(json["laureates"].map((x) => Laureate.fromJson(x))), | |
| 43 | + overallMotivation: json["overallMotivation"], | |
| 44 | + year: json["year"], | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "category": categoryValues.reverse[category], | |
| 49 | + "laureates": List<dynamic>.from(laureates.map((x) => x.toJson())), | |
| 50 | + "overallMotivation": overallMotivation, | |
| 51 | + "year": year, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +enum Category { | |
| 56 | + PHYSICS, | |
| 57 | + CHEMISTRY, | |
| 58 | + MEDICINE, | |
| 59 | + LITERATURE, | |
| 60 | + PEACE, | |
| 61 | + ECONOMICS | |
| 62 | +} | |
| 63 | + | |
| 64 | +final categoryValues = EnumValues({ | |
| 65 | + "physics": Category.PHYSICS, | |
| 66 | + "chemistry": Category.CHEMISTRY, | |
| 67 | + "medicine": Category.MEDICINE, | |
| 68 | + "literature": Category.LITERATURE, | |
| 69 | + "peace": Category.PEACE, | |
| 70 | + "economics": Category.ECONOMICS | |
| 71 | +}); | |
| 72 | + | |
| 73 | +class Laureate { | |
| 74 | + final String firstname; | |
| 75 | + final String id; | |
| 76 | + final String? motivation; | |
| 77 | + final String share; | |
| 78 | + final String surname; | |
| 79 | + | |
| 80 | + Laureate({ | |
| 81 | + required this.firstname, | |
| 82 | + required this.id, | |
| 83 | + this.motivation, | |
| 84 | + required this.share, | |
| 85 | + required this.surname, | |
| 86 | + }); | |
| 87 | + | |
| 88 | + factory Laureate.fromJson(Map<String, dynamic> json) => Laureate( | |
| 89 | + firstname: json["firstname"], | |
| 90 | + id: json["id"], | |
| 91 | + motivation: json["motivation"], | |
| 92 | + share: json["share"], | |
| 93 | + surname: json["surname"], | |
| 94 | + ); | |
| 95 | + | |
| 96 | + Map<String, dynamic> toJson() => { | |
| 97 | + "firstname": firstname, | |
| 98 | + "id": id, | |
| 99 | + "motivation": motivation, | |
| 100 | + "share": share, | |
| 101 | + "surname": surname, | |
| 102 | + }; | |
| 103 | +} | |
| 104 | + | |
| 105 | +class EnumValues<T> { | |
| 106 | + Map<String, T> map; | |
| 107 | + late Map<T, String> reverseMap; | |
| 108 | + | |
| 109 | + EnumValues(this.map); | |
| 110 | + | |
| 111 | + Map<T, String> get reverse { | |
| 112 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 113 | + return reverseMap; | |
| 114 | + } | |
| 115 | +} |
Test case
1 generated file · +57 −0test/inputs/json/misc/cb81e.json
Adartdefault / TopLevel.dart+57 −0
| @@ -0,0 +1,57 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Map<String, String> data; | |
| 13 | + final Description description; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.description, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: Map.from(json["data"]).map((k, v) => MapEntry<String, String>(k, v)), | |
| 22 | + description: Description.fromJson(json["description"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 27 | + "description": description.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Description { | |
| 32 | + final String basePeriod; | |
| 33 | + final String missing; | |
| 34 | + final String title; | |
| 35 | + final String units; | |
| 36 | + | |
| 37 | + Description({ | |
| 38 | + required this.basePeriod, | |
| 39 | + required this.missing, | |
| 40 | + required this.title, | |
| 41 | + required this.units, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory Description.fromJson(Map<String, dynamic> json) => Description( | |
| 45 | + basePeriod: json["base_period"], | |
| 46 | + missing: json["missing"], | |
| 47 | + title: json["title"], | |
| 48 | + units: json["units"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "base_period": basePeriod, | |
| 53 | + "missing": missing, | |
| 54 | + "title": title, | |
| 55 | + "units": units, | |
| 56 | + }; | |
| 57 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/ccd18.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +157 −0test/inputs/json/misc/cd238.json
Adartdefault / TopLevel.dart+157 −0
| @@ -0,0 +1,157 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String city; | |
| 13 | + final String delay; | |
| 14 | + final String iata; | |
| 15 | + final String icao; | |
| 16 | + final String name; | |
| 17 | + final String state; | |
| 18 | + final Status status; | |
| 19 | + final Weather weather; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.city, | |
| 23 | + required this.delay, | |
| 24 | + required this.iata, | |
| 25 | + required this.icao, | |
| 26 | + required this.name, | |
| 27 | + required this.state, | |
| 28 | + required this.status, | |
| 29 | + required this.weather, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + city: json["city"], | |
| 34 | + delay: json["delay"], | |
| 35 | + iata: json["IATA"], | |
| 36 | + icao: json["ICAO"], | |
| 37 | + name: json["name"], | |
| 38 | + state: json["state"], | |
| 39 | + status: Status.fromJson(json["status"]), | |
| 40 | + weather: Weather.fromJson(json["weather"]), | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "city": city, | |
| 45 | + "delay": delay, | |
| 46 | + "IATA": iata, | |
| 47 | + "ICAO": icao, | |
| 48 | + "name": name, | |
| 49 | + "state": state, | |
| 50 | + "status": status.toJson(), | |
| 51 | + "weather": weather.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Status { | |
| 56 | + final String avgDelay; | |
| 57 | + final String closureBegin; | |
| 58 | + final String closureEnd; | |
| 59 | + final String endTime; | |
| 60 | + final String maxDelay; | |
| 61 | + final String minDelay; | |
| 62 | + final String reason; | |
| 63 | + final String trend; | |
| 64 | + final String type; | |
| 65 | + | |
| 66 | + Status({ | |
| 67 | + required this.avgDelay, | |
| 68 | + required this.closureBegin, | |
| 69 | + required this.closureEnd, | |
| 70 | + required this.endTime, | |
| 71 | + required this.maxDelay, | |
| 72 | + required this.minDelay, | |
| 73 | + required this.reason, | |
| 74 | + required this.trend, | |
| 75 | + required this.type, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Status.fromJson(Map<String, dynamic> json) => Status( | |
| 79 | + avgDelay: json["avgDelay"], | |
| 80 | + closureBegin: json["closureBegin"], | |
| 81 | + closureEnd: json["closureEnd"], | |
| 82 | + endTime: json["endTime"], | |
| 83 | + maxDelay: json["maxDelay"], | |
| 84 | + minDelay: json["minDelay"], | |
| 85 | + reason: json["reason"], | |
| 86 | + trend: json["trend"], | |
| 87 | + type: json["type"], | |
| 88 | + ); | |
| 89 | + | |
| 90 | + Map<String, dynamic> toJson() => { | |
| 91 | + "avgDelay": avgDelay, | |
| 92 | + "closureBegin": closureBegin, | |
| 93 | + "closureEnd": closureEnd, | |
| 94 | + "endTime": endTime, | |
| 95 | + "maxDelay": maxDelay, | |
| 96 | + "minDelay": minDelay, | |
| 97 | + "reason": reason, | |
| 98 | + "trend": trend, | |
| 99 | + "type": type, | |
| 100 | + }; | |
| 101 | +} | |
| 102 | + | |
| 103 | +class Weather { | |
| 104 | + final Meta meta; | |
| 105 | + final String temp; | |
| 106 | + final double visibility; | |
| 107 | + final String weather; | |
| 108 | + final String wind; | |
| 109 | + | |
| 110 | + Weather({ | |
| 111 | + required this.meta, | |
| 112 | + required this.temp, | |
| 113 | + required this.visibility, | |
| 114 | + required this.weather, | |
| 115 | + required this.wind, | |
| 116 | + }); | |
| 117 | + | |
| 118 | + factory Weather.fromJson(Map<String, dynamic> json) => Weather( | |
| 119 | + meta: Meta.fromJson(json["meta"]), | |
| 120 | + temp: json["temp"], | |
| 121 | + visibility: json["visibility"]?.toDouble(), | |
| 122 | + weather: json["weather"], | |
| 123 | + wind: json["wind"], | |
| 124 | + ); | |
| 125 | + | |
| 126 | + Map<String, dynamic> toJson() => { | |
| 127 | + "meta": meta.toJson(), | |
| 128 | + "temp": temp, | |
| 129 | + "visibility": visibility, | |
| 130 | + "weather": weather, | |
| 131 | + "wind": wind, | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Meta { | |
| 136 | + final String credit; | |
| 137 | + final String updated; | |
| 138 | + final String url; | |
| 139 | + | |
| 140 | + Meta({ | |
| 141 | + required this.credit, | |
| 142 | + required this.updated, | |
| 143 | + required this.url, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 147 | + credit: json["credit"], | |
| 148 | + updated: json["updated"], | |
| 149 | + url: json["url"], | |
| 150 | + ); | |
| 151 | + | |
| 152 | + Map<String, dynamic> toJson() => { | |
| 153 | + "credit": credit, | |
| 154 | + "updated": updated, | |
| 155 | + "url": url, | |
| 156 | + }; | |
| 157 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/cd463.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +121 −0test/inputs/json/misc/cda6c.json
Adartdefault / TopLevel.dart+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<dynamic> topLevelFromJson(String str) => List<dynamic>.from(json.decode(str).map((x) => x)); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<dynamic> data) => json.encode(List<dynamic>.from(data.map((x) => x))); | |
| 10 | + | |
| 11 | +class TopLevelElement { | |
| 12 | + final Country country; | |
| 13 | + final String date; | |
| 14 | + final String decimal; | |
| 15 | + final Country indicator; | |
| 16 | + final String value; | |
| 17 | + | |
| 18 | + TopLevelElement({ | |
| 19 | + required this.country, | |
| 20 | + required this.date, | |
| 21 | + required this.decimal, | |
| 22 | + required this.indicator, | |
| 23 | + required this.value, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevelElement.fromJson(Map<String, dynamic> json) => TopLevelElement( | |
| 27 | + country: Country.fromJson(json["country"]), | |
| 28 | + date: json["date"], | |
| 29 | + decimal: json["decimal"], | |
| 30 | + indicator: Country.fromJson(json["indicator"]), | |
| 31 | + value: json["value"], | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "country": country.toJson(), | |
| 36 | + "date": date, | |
| 37 | + "decimal": decimal, | |
| 38 | + "indicator": indicator.toJson(), | |
| 39 | + "value": value, | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class Country { | |
| 44 | + final Id id; | |
| 45 | + final Value value; | |
| 46 | + | |
| 47 | + Country({ | |
| 48 | + required this.id, | |
| 49 | + required this.value, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory Country.fromJson(Map<String, dynamic> json) => Country( | |
| 53 | + id: idValues.map[json["id"]]!, | |
| 54 | + value: valueValues.map[json["value"]]!, | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + "id": idValues.reverse[id], | |
| 59 | + "value": valueValues.reverse[value], | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +enum Id { | |
| 64 | + CN, | |
| 65 | + SP_POP_TOTL | |
| 66 | +} | |
| 67 | + | |
| 68 | +final idValues = EnumValues({ | |
| 69 | + "CN": Id.CN, | |
| 70 | + "SP.POP.TOTL": Id.SP_POP_TOTL | |
| 71 | +}); | |
| 72 | + | |
| 73 | +enum Value { | |
| 74 | + CHINA, | |
| 75 | + POPULATION_TOTAL | |
| 76 | +} | |
| 77 | + | |
| 78 | +final valueValues = EnumValues({ | |
| 79 | + "China": Value.CHINA, | |
| 80 | + "Population, total": Value.POPULATION_TOTAL | |
| 81 | +}); | |
| 82 | + | |
| 83 | +class PurpleTopLevel { | |
| 84 | + final int page; | |
| 85 | + final int pages; | |
| 86 | + final String perPage; | |
| 87 | + final int total; | |
| 88 | + | |
| 89 | + PurpleTopLevel({ | |
| 90 | + required this.page, | |
| 91 | + required this.pages, | |
| 92 | + required this.perPage, | |
| 93 | + required this.total, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory PurpleTopLevel.fromJson(Map<String, dynamic> json) => PurpleTopLevel( | |
| 97 | + page: json["page"], | |
| 98 | + pages: json["pages"], | |
| 99 | + perPage: json["per_page"], | |
| 100 | + total: json["total"], | |
| 101 | + ); | |
| 102 | + | |
| 103 | + Map<String, dynamic> toJson() => { | |
| 104 | + "page": page, | |
| 105 | + "pages": pages, | |
| 106 | + "per_page": perPage, | |
| 107 | + "total": total, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class EnumValues<T> { | |
| 112 | + Map<String, T> map; | |
| 113 | + late Map<T, String> reverseMap; | |
| 114 | + | |
| 115 | + EnumValues(this.map); | |
| 116 | + | |
| 117 | + Map<T, String> get reverse { | |
| 118 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 119 | + return reverseMap; | |
| 120 | + } | |
| 121 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/cf0d8.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +33 −0test/inputs/json/misc/cfbce.json
Adartdefault / TopLevel.dart+33 −0
| @@ -0,0 +1,33 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String base; | |
| 13 | + final DateTime date; | |
| 14 | + final Map<String, double> rates; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.base, | |
| 18 | + required this.date, | |
| 19 | + required this.rates, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + base: json["base"], | |
| 24 | + date: DateTime.parse(json["date"]), | |
| 25 | + rates: Map.from(json["rates"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "base": base, | |
| 30 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 31 | + "rates": Map.from(rates).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 32 | + }; | |
| 33 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/d0908.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<TotalPopulation> totalPopulation; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.totalPopulation, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + totalPopulation: List<TotalPopulation>.from(json["total_population"].map((x) => TotalPopulation.fromJson(x))), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "total_population": List<dynamic>.from(totalPopulation.map((x) => x.toJson())), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class TotalPopulation { | |
| 28 | + final DateTime date; | |
| 29 | + final int population; | |
| 30 | + | |
| 31 | + TotalPopulation({ | |
| 32 | + required this.date, | |
| 33 | + required this.population, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory TotalPopulation.fromJson(Map<String, dynamic> json) => TotalPopulation( | |
| 37 | + date: DateTime.parse(json["date"]), | |
| 38 | + population: json["population"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 43 | + "population": population, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +95 −0test/inputs/json/misc/d23d5.json
Adartdefault / TopLevel.dart+95 −0
| @@ -0,0 +1,95 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int count; | |
| 13 | + final Facets facets; | |
| 14 | + final int limit; | |
| 15 | + final String next; | |
| 16 | + final int offset; | |
| 17 | + final bool previous; | |
| 18 | + final List<Result> results; | |
| 19 | + | |
| 20 | + TopLevel({ | |
| 21 | + required this.count, | |
| 22 | + required this.facets, | |
| 23 | + required this.limit, | |
| 24 | + required this.next, | |
| 25 | + required this.offset, | |
| 26 | + required this.previous, | |
| 27 | + required this.results, | |
| 28 | + }); | |
| 29 | + | |
| 30 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 31 | + count: json["count"], | |
| 32 | + facets: Facets.fromJson(json["facets"]), | |
| 33 | + limit: json["limit"], | |
| 34 | + next: json["next"], | |
| 35 | + offset: json["offset"], | |
| 36 | + previous: json["previous"], | |
| 37 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 38 | + ); | |
| 39 | + | |
| 40 | + Map<String, dynamic> toJson() => { | |
| 41 | + "count": count, | |
| 42 | + "facets": facets.toJson(), | |
| 43 | + "limit": limit, | |
| 44 | + "next": next, | |
| 45 | + "offset": offset, | |
| 46 | + "previous": previous, | |
| 47 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Facets { | |
| 52 | + Facets(); | |
| 53 | + | |
| 54 | + factory Facets.fromJson(Map<String, dynamic> json) => Facets( | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + }; | |
| 59 | +} | |
| 60 | + | |
| 61 | +class Result { | |
| 62 | + final String? acronym; | |
| 63 | + final DateTime createdAt; | |
| 64 | + final String id; | |
| 65 | + final String name; | |
| 66 | + final DateTime updatedAt; | |
| 67 | + final String uri; | |
| 68 | + | |
| 69 | + Result({ | |
| 70 | + required this.acronym, | |
| 71 | + required this.createdAt, | |
| 72 | + required this.id, | |
| 73 | + required this.name, | |
| 74 | + required this.updatedAt, | |
| 75 | + required this.uri, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 79 | + acronym: json["acronym"], | |
| 80 | + createdAt: DateTime.parse(json["created_at"]), | |
| 81 | + id: json["id"], | |
| 82 | + name: json["name"], | |
| 83 | + updatedAt: DateTime.parse(json["updated_at"]), | |
| 84 | + uri: json["uri"], | |
| 85 | + ); | |
| 86 | + | |
| 87 | + Map<String, dynamic> toJson() => { | |
| 88 | + "acronym": acronym, | |
| 89 | + "created_at": createdAt.toIso8601String(), | |
| 90 | + "id": id, | |
| 91 | + "name": name, | |
| 92 | + "updated_at": updatedAt.toIso8601String(), | |
| 93 | + "uri": uri, | |
| 94 | + }; | |
| 95 | +} |
Test case
1 generated file · +439 −0test/inputs/json/misc/dbfb3.json
Adartdefault / TopLevel.dart+439 −0
| @@ -0,0 +1,439 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final Text text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: textValues.map[json["text"]]!, | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": textValues.reverse[text], | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +enum Text { | |
| 292 | + MOSTLY_SUNNY, | |
| 293 | + SUNNY | |
| 294 | +} | |
| 295 | + | |
| 296 | +final textValues = EnumValues({ | |
| 297 | + "Mostly Sunny": Text.MOSTLY_SUNNY, | |
| 298 | + "Sunny": Text.SUNNY | |
| 299 | +}); | |
| 300 | + | |
| 301 | +class Forecast { | |
| 302 | + final String code; | |
| 303 | + final String date; | |
| 304 | + final String day; | |
| 305 | + final String high; | |
| 306 | + final String low; | |
| 307 | + final Text text; | |
| 308 | + | |
| 309 | + Forecast({ | |
| 310 | + required this.code, | |
| 311 | + required this.date, | |
| 312 | + required this.day, | |
| 313 | + required this.high, | |
| 314 | + required this.low, | |
| 315 | + required this.text, | |
| 316 | + }); | |
| 317 | + | |
| 318 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 319 | + code: json["code"], | |
| 320 | + date: json["date"], | |
| 321 | + day: json["day"], | |
| 322 | + high: json["high"], | |
| 323 | + low: json["low"], | |
| 324 | + text: textValues.map[json["text"]]!, | |
| 325 | + ); | |
| 326 | + | |
| 327 | + Map<String, dynamic> toJson() => { | |
| 328 | + "code": code, | |
| 329 | + "date": date, | |
| 330 | + "day": day, | |
| 331 | + "high": high, | |
| 332 | + "low": low, | |
| 333 | + "text": textValues.reverse[text], | |
| 334 | + }; | |
| 335 | +} | |
| 336 | + | |
| 337 | +class Guid { | |
| 338 | + final String isPermaLink; | |
| 339 | + | |
| 340 | + Guid({ | |
| 341 | + required this.isPermaLink, | |
| 342 | + }); | |
| 343 | + | |
| 344 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 345 | + isPermaLink: json["isPermaLink"], | |
| 346 | + ); | |
| 347 | + | |
| 348 | + Map<String, dynamic> toJson() => { | |
| 349 | + "isPermaLink": isPermaLink, | |
| 350 | + }; | |
| 351 | +} | |
| 352 | + | |
| 353 | +class Location { | |
| 354 | + final String city; | |
| 355 | + final String country; | |
| 356 | + final String region; | |
| 357 | + | |
| 358 | + Location({ | |
| 359 | + required this.city, | |
| 360 | + required this.country, | |
| 361 | + required this.region, | |
| 362 | + }); | |
| 363 | + | |
| 364 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 365 | + city: json["city"], | |
| 366 | + country: json["country"], | |
| 367 | + region: json["region"], | |
| 368 | + ); | |
| 369 | + | |
| 370 | + Map<String, dynamic> toJson() => { | |
| 371 | + "city": city, | |
| 372 | + "country": country, | |
| 373 | + "region": region, | |
| 374 | + }; | |
| 375 | +} | |
| 376 | + | |
| 377 | +class Units { | |
| 378 | + final String distance; | |
| 379 | + final String pressure; | |
| 380 | + final String speed; | |
| 381 | + final String temperature; | |
| 382 | + | |
| 383 | + Units({ | |
| 384 | + required this.distance, | |
| 385 | + required this.pressure, | |
| 386 | + required this.speed, | |
| 387 | + required this.temperature, | |
| 388 | + }); | |
| 389 | + | |
| 390 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 391 | + distance: json["distance"], | |
| 392 | + pressure: json["pressure"], | |
| 393 | + speed: json["speed"], | |
| 394 | + temperature: json["temperature"], | |
| 395 | + ); | |
| 396 | + | |
| 397 | + Map<String, dynamic> toJson() => { | |
| 398 | + "distance": distance, | |
| 399 | + "pressure": pressure, | |
| 400 | + "speed": speed, | |
| 401 | + "temperature": temperature, | |
| 402 | + }; | |
| 403 | +} | |
| 404 | + | |
| 405 | +class Wind { | |
| 406 | + final String chill; | |
| 407 | + final String direction; | |
| 408 | + final String speed; | |
| 409 | + | |
| 410 | + Wind({ | |
| 411 | + required this.chill, | |
| 412 | + required this.direction, | |
| 413 | + required this.speed, | |
| 414 | + }); | |
| 415 | + | |
| 416 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 417 | + chill: json["chill"], | |
| 418 | + direction: json["direction"], | |
| 419 | + speed: json["speed"], | |
| 420 | + ); | |
| 421 | + | |
| 422 | + Map<String, dynamic> toJson() => { | |
| 423 | + "chill": chill, | |
| 424 | + "direction": direction, | |
| 425 | + "speed": speed, | |
| 426 | + }; | |
| 427 | +} | |
| 428 | + | |
| 429 | +class EnumValues<T> { | |
| 430 | + Map<String, T> map; | |
| 431 | + late Map<T, String> reverseMap; | |
| 432 | + | |
| 433 | + EnumValues(this.map); | |
| 434 | + | |
| 435 | + Map<T, String> get reverse { | |
| 436 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 437 | + return reverseMap; | |
| 438 | + } | |
| 439 | +} |
Test case
1 generated file · +407 −0test/inputs/json/misc/dc44f.json
Adartdefault / TopLevel.dart+407 −0
| @@ -0,0 +1,407 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Booster> booster; | |
| 13 | + final String border; | |
| 14 | + final List<Card> cards; | |
| 15 | + final String code; | |
| 16 | + final String gathererCode; | |
| 17 | + final String magicCardsInfoCode; | |
| 18 | + final int mkmId; | |
| 19 | + final String mkmName; | |
| 20 | + final String name; | |
| 21 | + final DateTime releaseDate; | |
| 22 | + final String type; | |
| 23 | + | |
| 24 | + TopLevel({ | |
| 25 | + required this.booster, | |
| 26 | + required this.border, | |
| 27 | + required this.cards, | |
| 28 | + required this.code, | |
| 29 | + required this.gathererCode, | |
| 30 | + required this.magicCardsInfoCode, | |
| 31 | + required this.mkmId, | |
| 32 | + required this.mkmName, | |
| 33 | + required this.name, | |
| 34 | + required this.releaseDate, | |
| 35 | + required this.type, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 39 | + booster: List<Booster>.from(json["booster"].map((x) => boosterValues.map[x]!)), | |
| 40 | + border: json["border"], | |
| 41 | + cards: List<Card>.from(json["cards"].map((x) => Card.fromJson(x))), | |
| 42 | + code: json["code"], | |
| 43 | + gathererCode: json["gathererCode"], | |
| 44 | + magicCardsInfoCode: json["magicCardsInfoCode"], | |
| 45 | + mkmId: json["mkm_id"], | |
| 46 | + mkmName: json["mkm_name"], | |
| 47 | + name: json["name"], | |
| 48 | + releaseDate: DateTime.parse(json["releaseDate"]), | |
| 49 | + type: json["type"], | |
| 50 | + ); | |
| 51 | + | |
| 52 | + Map<String, dynamic> toJson() => { | |
| 53 | + "booster": List<dynamic>.from(booster.map((x) => boosterValues.reverse[x])), | |
| 54 | + "border": border, | |
| 55 | + "cards": List<dynamic>.from(cards.map((x) => x.toJson())), | |
| 56 | + "code": code, | |
| 57 | + "gathererCode": gathererCode, | |
| 58 | + "magicCardsInfoCode": magicCardsInfoCode, | |
| 59 | + "mkm_id": mkmId, | |
| 60 | + "mkm_name": mkmName, | |
| 61 | + "name": name, | |
| 62 | + "releaseDate": "${releaseDate.year.toString().padLeft(4, '0')}-${releaseDate.month.toString().padLeft(2, '0')}-${releaseDate.day.toString().padLeft(2, '0')}", | |
| 63 | + "type": type, | |
| 64 | + }; | |
| 65 | +} | |
| 66 | + | |
| 67 | +enum Booster { | |
| 68 | + RARE, | |
| 69 | + UNCOMMON, | |
| 70 | + COMMON | |
| 71 | +} | |
| 72 | + | |
| 73 | +final boosterValues = EnumValues({ | |
| 74 | + "rare": Booster.RARE, | |
| 75 | + "uncommon": Booster.UNCOMMON, | |
| 76 | + "common": Booster.COMMON | |
| 77 | +}); | |
| 78 | + | |
| 79 | +class Card { | |
| 80 | + final String artist; | |
| 81 | + final int cmc; | |
| 82 | + final List<ColorIdentity>? colorIdentity; | |
| 83 | + final List<Color>? colors; | |
| 84 | + final String? flavor; | |
| 85 | + final String id; | |
| 86 | + final String imageName; | |
| 87 | + final Layout layout; | |
| 88 | + final List<LegalityElement> legalities; | |
| 89 | + final String? manaCost; | |
| 90 | + final String? mciNumber; | |
| 91 | + final int multiverseid; | |
| 92 | + final String name; | |
| 93 | + final String? originalText; | |
| 94 | + final String originalType; | |
| 95 | + final String? power; | |
| 96 | + final List<String> printings; | |
| 97 | + final Rarity rarity; | |
| 98 | + final bool? reserved; | |
| 99 | + final List<Ruling>? rulings; | |
| 100 | + final List<String>? subtypes; | |
| 101 | + final List<Supertype>? supertypes; | |
| 102 | + final String? text; | |
| 103 | + final String? toughness; | |
| 104 | + final String type; | |
| 105 | + final List<Type> types; | |
| 106 | + final List<int>? variations; | |
| 107 | + | |
| 108 | + Card({ | |
| 109 | + required this.artist, | |
| 110 | + required this.cmc, | |
| 111 | + this.colorIdentity, | |
| 112 | + this.colors, | |
| 113 | + this.flavor, | |
| 114 | + required this.id, | |
| 115 | + required this.imageName, | |
| 116 | + required this.layout, | |
| 117 | + required this.legalities, | |
| 118 | + this.manaCost, | |
| 119 | + this.mciNumber, | |
| 120 | + required this.multiverseid, | |
| 121 | + required this.name, | |
| 122 | + this.originalText, | |
| 123 | + required this.originalType, | |
| 124 | + this.power, | |
| 125 | + required this.printings, | |
| 126 | + required this.rarity, | |
| 127 | + this.reserved, | |
| 128 | + this.rulings, | |
| 129 | + this.subtypes, | |
| 130 | + this.supertypes, | |
| 131 | + this.text, | |
| 132 | + this.toughness, | |
| 133 | + required this.type, | |
| 134 | + required this.types, | |
| 135 | + this.variations, | |
| 136 | + }); | |
| 137 | + | |
| 138 | + factory Card.fromJson(Map<String, dynamic> json) => Card( | |
| 139 | + artist: json["artist"], | |
| 140 | + cmc: json["cmc"], | |
| 141 | + colorIdentity: json["colorIdentity"] == null ? null : List<ColorIdentity>.from(json["colorIdentity"]!.map((x) => colorIdentityValues.map[x]!)), | |
| 142 | + colors: json["colors"] == null ? null : List<Color>.from(json["colors"]!.map((x) => colorValues.map[x]!)), | |
| 143 | + flavor: json["flavor"], | |
| 144 | + id: json["id"], | |
| 145 | + imageName: json["imageName"], | |
| 146 | + layout: layoutValues.map[json["layout"]]!, | |
| 147 | + legalities: List<LegalityElement>.from(json["legalities"].map((x) => LegalityElement.fromJson(x))), | |
| 148 | + manaCost: json["manaCost"], | |
| 149 | + mciNumber: json["mciNumber"], | |
| 150 | + multiverseid: json["multiverseid"], | |
| 151 | + name: json["name"], | |
| 152 | + originalText: json["originalText"], | |
| 153 | + originalType: json["originalType"], | |
| 154 | + power: json["power"], | |
| 155 | + printings: List<String>.from(json["printings"].map((x) => x)), | |
| 156 | + rarity: rarityValues.map[json["rarity"]]!, | |
| 157 | + reserved: json["reserved"], | |
| 158 | + rulings: json["rulings"] == null ? null : List<Ruling>.from(json["rulings"]!.map((x) => Ruling.fromJson(x))), | |
| 159 | + subtypes: json["subtypes"] == null ? null : List<String>.from(json["subtypes"]!.map((x) => x)), | |
| 160 | + supertypes: json["supertypes"] == null ? null : List<Supertype>.from(json["supertypes"]!.map((x) => supertypeValues.map[x]!)), | |
| 161 | + text: json["text"], | |
| 162 | + toughness: json["toughness"], | |
| 163 | + type: json["type"], | |
| 164 | + types: List<Type>.from(json["types"].map((x) => typeValues.map[x]!)), | |
| 165 | + variations: json["variations"] == null ? null : List<int>.from(json["variations"]!.map((x) => x)), | |
| 166 | + ); | |
| 167 | + | |
| 168 | + Map<String, dynamic> toJson() => { | |
| 169 | + "artist": artist, | |
| 170 | + "cmc": cmc, | |
| 171 | + "colorIdentity": colorIdentity == null ? null : List<dynamic>.from(colorIdentity!.map((x) => colorIdentityValues.reverse[x])), | |
| 172 | + "colors": colors == null ? null : List<dynamic>.from(colors!.map((x) => colorValues.reverse[x])), | |
| 173 | + "flavor": flavor, | |
| 174 | + "id": id, | |
| 175 | + "imageName": imageName, | |
| 176 | + "layout": layoutValues.reverse[layout], | |
| 177 | + "legalities": List<dynamic>.from(legalities.map((x) => x.toJson())), | |
| 178 | + "manaCost": manaCost, | |
| 179 | + "mciNumber": mciNumber, | |
| 180 | + "multiverseid": multiverseid, | |
| 181 | + "name": name, | |
| 182 | + "originalText": originalText, | |
| 183 | + "originalType": originalType, | |
| 184 | + "power": power, | |
| 185 | + "printings": List<dynamic>.from(printings.map((x) => x)), | |
| 186 | + "rarity": rarityValues.reverse[rarity], | |
| 187 | + "reserved": reserved, | |
| 188 | + "rulings": rulings == null ? null : List<dynamic>.from(rulings!.map((x) => x.toJson())), | |
| 189 | + "subtypes": subtypes == null ? null : List<dynamic>.from(subtypes!.map((x) => x)), | |
| 190 | + "supertypes": supertypes == null ? null : List<dynamic>.from(supertypes!.map((x) => supertypeValues.reverse[x])), | |
| 191 | + "text": text, | |
| 192 | + "toughness": toughness, | |
| 193 | + "type": type, | |
| 194 | + "types": List<dynamic>.from(types.map((x) => typeValues.reverse[x])), | |
| 195 | + "variations": variations == null ? null : List<dynamic>.from(variations!.map((x) => x)), | |
| 196 | + }; | |
| 197 | +} | |
| 198 | + | |
| 199 | +enum ColorIdentity { | |
| 200 | + U, | |
| 201 | + B, | |
| 202 | + W, | |
| 203 | + G, | |
| 204 | + R | |
| 205 | +} | |
| 206 | + | |
| 207 | +final colorIdentityValues = EnumValues({ | |
| 208 | + "U": ColorIdentity.U, | |
| 209 | + "B": ColorIdentity.B, | |
| 210 | + "W": ColorIdentity.W, | |
| 211 | + "G": ColorIdentity.G, | |
| 212 | + "R": ColorIdentity.R | |
| 213 | +}); | |
| 214 | + | |
| 215 | +enum Color { | |
| 216 | + BLUE, | |
| 217 | + BLACK, | |
| 218 | + WHITE, | |
| 219 | + GREEN, | |
| 220 | + RED | |
| 221 | +} | |
| 222 | + | |
| 223 | +final colorValues = EnumValues({ | |
| 224 | + "Blue": Color.BLUE, | |
| 225 | + "Black": Color.BLACK, | |
| 226 | + "White": Color.WHITE, | |
| 227 | + "Green": Color.GREEN, | |
| 228 | + "Red": Color.RED | |
| 229 | +}); | |
| 230 | + | |
| 231 | +enum Layout { | |
| 232 | + NORMAL | |
| 233 | +} | |
| 234 | + | |
| 235 | +final layoutValues = EnumValues({ | |
| 236 | + "normal": Layout.NORMAL | |
| 237 | +}); | |
| 238 | + | |
| 239 | +class LegalityElement { | |
| 240 | + final Format format; | |
| 241 | + final LegalityEnum legality; | |
| 242 | + | |
| 243 | + LegalityElement({ | |
| 244 | + required this.format, | |
| 245 | + required this.legality, | |
| 246 | + }); | |
| 247 | + | |
| 248 | + factory LegalityElement.fromJson(Map<String, dynamic> json) => LegalityElement( | |
| 249 | + format: formatValues.map[json["format"]]!, | |
| 250 | + legality: legalityEnumValues.map[json["legality"]]!, | |
| 251 | + ); | |
| 252 | + | |
| 253 | + Map<String, dynamic> toJson() => { | |
| 254 | + "format": formatValues.reverse[format], | |
| 255 | + "legality": legalityEnumValues.reverse[legality], | |
| 256 | + }; | |
| 257 | +} | |
| 258 | + | |
| 259 | +enum Format { | |
| 260 | + COMMANDER, | |
| 261 | + LEGACY, | |
| 262 | + MODERN, | |
| 263 | + VINTAGE, | |
| 264 | + TIME_SPIRAL_BLOCK, | |
| 265 | + RAVNICA_BLOCK, | |
| 266 | + ICE_AGE_BLOCK, | |
| 267 | + TEMPEST_BLOCK, | |
| 268 | + ONSLAUGHT_BLOCK, | |
| 269 | + MASQUES_BLOCK, | |
| 270 | + MIRAGE_BLOCK, | |
| 271 | + URZA_BLOCK, | |
| 272 | + SCARS_OF_MIRRODIN_BLOCK, | |
| 273 | + MIRRODIN_BLOCK, | |
| 274 | + AMONKHET_BLOCK, | |
| 275 | + BATTLE_FOR_ZENDIKAR_BLOCK, | |
| 276 | + INNISTRAD_BLOCK, | |
| 277 | + INVASION_BLOCK, | |
| 278 | + KALADESH_BLOCK, | |
| 279 | + KAMIGAWA_BLOCK, | |
| 280 | + KHANS_OF_TARKIR_BLOCK, | |
| 281 | + LORWYN_SHADOWMOOR_BLOCK, | |
| 282 | + ODYSSEY_BLOCK, | |
| 283 | + RETURN_TO_RAVNICA_BLOCK, | |
| 284 | + SHADOWS_OVER_INNISTRAD_BLOCK, | |
| 285 | + SHARDS_OF_ALARA_BLOCK, | |
| 286 | + STANDARD, | |
| 287 | + THEROS_BLOCK, | |
| 288 | + UN_SETS, | |
| 289 | + ZENDIKAR_BLOCK | |
| 290 | +} | |
| 291 | + | |
| 292 | +final formatValues = EnumValues({ | |
| 293 | + "Commander": Format.COMMANDER, | |
| 294 | + "Legacy": Format.LEGACY, | |
| 295 | + "Modern": Format.MODERN, | |
| 296 | + "Vintage": Format.VINTAGE, | |
| 297 | + "Time Spiral Block": Format.TIME_SPIRAL_BLOCK, | |
| 298 | + "Ravnica Block": Format.RAVNICA_BLOCK, | |
| 299 | + "Ice Age Block": Format.ICE_AGE_BLOCK, | |
| 300 | + "Tempest Block": Format.TEMPEST_BLOCK, | |
| 301 | + "Onslaught Block": Format.ONSLAUGHT_BLOCK, | |
| 302 | + "Masques Block": Format.MASQUES_BLOCK, | |
| 303 | + "Mirage Block": Format.MIRAGE_BLOCK, | |
| 304 | + "Urza Block": Format.URZA_BLOCK, | |
| 305 | + "Scars of Mirrodin Block": Format.SCARS_OF_MIRRODIN_BLOCK, | |
| 306 | + "Mirrodin Block": Format.MIRRODIN_BLOCK, | |
| 307 | + "Amonkhet Block": Format.AMONKHET_BLOCK, | |
| 308 | + "Battle for Zendikar Block": Format.BATTLE_FOR_ZENDIKAR_BLOCK, | |
| 309 | + "Innistrad Block": Format.INNISTRAD_BLOCK, | |
| 310 | + "Invasion Block": Format.INVASION_BLOCK, | |
| 311 | + "Kaladesh Block": Format.KALADESH_BLOCK, | |
| 312 | + "Kamigawa Block": Format.KAMIGAWA_BLOCK, | |
| 313 | + "Khans of Tarkir Block": Format.KHANS_OF_TARKIR_BLOCK, | |
| 314 | + "Lorwyn-Shadowmoor Block": Format.LORWYN_SHADOWMOOR_BLOCK, | |
| 315 | + "Odyssey Block": Format.ODYSSEY_BLOCK, | |
| 316 | + "Return to Ravnica Block": Format.RETURN_TO_RAVNICA_BLOCK, | |
| 317 | + "Shadows over Innistrad Block": Format.SHADOWS_OVER_INNISTRAD_BLOCK, | |
| 318 | + "Shards of Alara Block": Format.SHARDS_OF_ALARA_BLOCK, | |
| 319 | + "Standard": Format.STANDARD, | |
| 320 | + "Theros Block": Format.THEROS_BLOCK, | |
| 321 | + "Un-Sets": Format.UN_SETS, | |
| 322 | + "Zendikar Block": Format.ZENDIKAR_BLOCK | |
| 323 | +}); | |
| 324 | + | |
| 325 | +enum LegalityEnum { | |
| 326 | + LEGAL, | |
| 327 | + BANNED, | |
| 328 | + RESTRICTED | |
| 329 | +} | |
| 330 | + | |
| 331 | +final legalityEnumValues = EnumValues({ | |
| 332 | + "Legal": LegalityEnum.LEGAL, | |
| 333 | + "Banned": LegalityEnum.BANNED, | |
| 334 | + "Restricted": LegalityEnum.RESTRICTED | |
| 335 | +}); | |
| 336 | + | |
| 337 | +enum Rarity { | |
| 338 | + UNCOMMON, | |
| 339 | + RARE, | |
| 340 | + COMMON, | |
| 341 | + BASIC_LAND | |
| 342 | +} | |
| 343 | + | |
| 344 | +final rarityValues = EnumValues({ | |
| 345 | + "Uncommon": Rarity.UNCOMMON, | |
| 346 | + "Rare": Rarity.RARE, | |
| 347 | + "Common": Rarity.COMMON, | |
| 348 | + "Basic Land": Rarity.BASIC_LAND | |
| 349 | +}); | |
| 350 | + | |
| 351 | +class Ruling { | |
| 352 | + final DateTime date; | |
| 353 | + final String text; | |
| 354 | + | |
| 355 | + Ruling({ | |
| 356 | + required this.date, | |
| 357 | + required this.text, | |
| 358 | + }); | |
| 359 | + | |
| 360 | + factory Ruling.fromJson(Map<String, dynamic> json) => Ruling( | |
| 361 | + date: DateTime.parse(json["date"]), | |
| 362 | + text: json["text"], | |
| 363 | + ); | |
| 364 | + | |
| 365 | + Map<String, dynamic> toJson() => { | |
| 366 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 367 | + "text": text, | |
| 368 | + }; | |
| 369 | +} | |
| 370 | + | |
| 371 | +enum Supertype { | |
| 372 | + BASIC | |
| 373 | +} | |
| 374 | + | |
| 375 | +final supertypeValues = EnumValues({ | |
| 376 | + "Basic": Supertype.BASIC | |
| 377 | +}); | |
| 378 | + | |
| 379 | +enum Type { | |
| 380 | + CREATURE, | |
| 381 | + INSTANT, | |
| 382 | + ENCHANTMENT, | |
| 383 | + ARTIFACT, | |
| 384 | + SORCERY, | |
| 385 | + LAND | |
| 386 | +} | |
| 387 | + | |
| 388 | +final typeValues = EnumValues({ | |
| 389 | + "Creature": Type.CREATURE, | |
| 390 | + "Instant": Type.INSTANT, | |
| 391 | + "Enchantment": Type.ENCHANTMENT, | |
| 392 | + "Artifact": Type.ARTIFACT, | |
| 393 | + "Sorcery": Type.SORCERY, | |
| 394 | + "Land": Type.LAND | |
| 395 | +}); | |
| 396 | + | |
| 397 | +class EnumValues<T> { | |
| 398 | + Map<String, T> map; | |
| 399 | + late Map<T, String> reverseMap; | |
| 400 | + | |
| 401 | + EnumValues(this.map); | |
| 402 | + | |
| 403 | + Map<T, String> get reverse { | |
| 404 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 405 | + return reverseMap; | |
| 406 | + } | |
| 407 | +} |
Test case
1 generated file · +407 −0test/inputs/json/misc/dd1ce.json
Adartdefault / TopLevel.dart+407 −0
| @@ -0,0 +1,407 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Booster> booster; | |
| 13 | + final String border; | |
| 14 | + final List<Card> cards; | |
| 15 | + final String code; | |
| 16 | + final String gathererCode; | |
| 17 | + final String magicCardsInfoCode; | |
| 18 | + final int mkmId; | |
| 19 | + final String mkmName; | |
| 20 | + final String name; | |
| 21 | + final DateTime releaseDate; | |
| 22 | + final String type; | |
| 23 | + | |
| 24 | + TopLevel({ | |
| 25 | + required this.booster, | |
| 26 | + required this.border, | |
| 27 | + required this.cards, | |
| 28 | + required this.code, | |
| 29 | + required this.gathererCode, | |
| 30 | + required this.magicCardsInfoCode, | |
| 31 | + required this.mkmId, | |
| 32 | + required this.mkmName, | |
| 33 | + required this.name, | |
| 34 | + required this.releaseDate, | |
| 35 | + required this.type, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 39 | + booster: List<Booster>.from(json["booster"].map((x) => boosterValues.map[x]!)), | |
| 40 | + border: json["border"], | |
| 41 | + cards: List<Card>.from(json["cards"].map((x) => Card.fromJson(x))), | |
| 42 | + code: json["code"], | |
| 43 | + gathererCode: json["gathererCode"], | |
| 44 | + magicCardsInfoCode: json["magicCardsInfoCode"], | |
| 45 | + mkmId: json["mkm_id"], | |
| 46 | + mkmName: json["mkm_name"], | |
| 47 | + name: json["name"], | |
| 48 | + releaseDate: DateTime.parse(json["releaseDate"]), | |
| 49 | + type: json["type"], | |
| 50 | + ); | |
| 51 | + | |
| 52 | + Map<String, dynamic> toJson() => { | |
| 53 | + "booster": List<dynamic>.from(booster.map((x) => boosterValues.reverse[x])), | |
| 54 | + "border": border, | |
| 55 | + "cards": List<dynamic>.from(cards.map((x) => x.toJson())), | |
| 56 | + "code": code, | |
| 57 | + "gathererCode": gathererCode, | |
| 58 | + "magicCardsInfoCode": magicCardsInfoCode, | |
| 59 | + "mkm_id": mkmId, | |
| 60 | + "mkm_name": mkmName, | |
| 61 | + "name": name, | |
| 62 | + "releaseDate": "${releaseDate.year.toString().padLeft(4, '0')}-${releaseDate.month.toString().padLeft(2, '0')}-${releaseDate.day.toString().padLeft(2, '0')}", | |
| 63 | + "type": type, | |
| 64 | + }; | |
| 65 | +} | |
| 66 | + | |
| 67 | +enum Booster { | |
| 68 | + RARE, | |
| 69 | + UNCOMMON, | |
| 70 | + COMMON | |
| 71 | +} | |
| 72 | + | |
| 73 | +final boosterValues = EnumValues({ | |
| 74 | + "rare": Booster.RARE, | |
| 75 | + "uncommon": Booster.UNCOMMON, | |
| 76 | + "common": Booster.COMMON | |
| 77 | +}); | |
| 78 | + | |
| 79 | +class Card { | |
| 80 | + final String artist; | |
| 81 | + final int cmc; | |
| 82 | + final List<ColorIdentity>? colorIdentity; | |
| 83 | + final List<Color>? colors; | |
| 84 | + final String? flavor; | |
| 85 | + final String id; | |
| 86 | + final String imageName; | |
| 87 | + final Layout layout; | |
| 88 | + final List<LegalityElement> legalities; | |
| 89 | + final String? manaCost; | |
| 90 | + final String? mciNumber; | |
| 91 | + final int multiverseid; | |
| 92 | + final String name; | |
| 93 | + final String? originalText; | |
| 94 | + final String originalType; | |
| 95 | + final String? power; | |
| 96 | + final List<String> printings; | |
| 97 | + final Rarity rarity; | |
| 98 | + final bool? reserved; | |
| 99 | + final List<Ruling>? rulings; | |
| 100 | + final List<String>? subtypes; | |
| 101 | + final List<Supertype>? supertypes; | |
| 102 | + final String? text; | |
| 103 | + final String? toughness; | |
| 104 | + final String type; | |
| 105 | + final List<Type> types; | |
| 106 | + final List<int>? variations; | |
| 107 | + | |
| 108 | + Card({ | |
| 109 | + required this.artist, | |
| 110 | + required this.cmc, | |
| 111 | + this.colorIdentity, | |
| 112 | + this.colors, | |
| 113 | + this.flavor, | |
| 114 | + required this.id, | |
| 115 | + required this.imageName, | |
| 116 | + required this.layout, | |
| 117 | + required this.legalities, | |
| 118 | + this.manaCost, | |
| 119 | + this.mciNumber, | |
| 120 | + required this.multiverseid, | |
| 121 | + required this.name, | |
| 122 | + this.originalText, | |
| 123 | + required this.originalType, | |
| 124 | + this.power, | |
| 125 | + required this.printings, | |
| 126 | + required this.rarity, | |
| 127 | + this.reserved, | |
| 128 | + this.rulings, | |
| 129 | + this.subtypes, | |
| 130 | + this.supertypes, | |
| 131 | + this.text, | |
| 132 | + this.toughness, | |
| 133 | + required this.type, | |
| 134 | + required this.types, | |
| 135 | + this.variations, | |
| 136 | + }); | |
| 137 | + | |
| 138 | + factory Card.fromJson(Map<String, dynamic> json) => Card( | |
| 139 | + artist: json["artist"], | |
| 140 | + cmc: json["cmc"], | |
| 141 | + colorIdentity: json["colorIdentity"] == null ? null : List<ColorIdentity>.from(json["colorIdentity"]!.map((x) => colorIdentityValues.map[x]!)), | |
| 142 | + colors: json["colors"] == null ? null : List<Color>.from(json["colors"]!.map((x) => colorValues.map[x]!)), | |
| 143 | + flavor: json["flavor"], | |
| 144 | + id: json["id"], | |
| 145 | + imageName: json["imageName"], | |
| 146 | + layout: layoutValues.map[json["layout"]]!, | |
| 147 | + legalities: List<LegalityElement>.from(json["legalities"].map((x) => LegalityElement.fromJson(x))), | |
| 148 | + manaCost: json["manaCost"], | |
| 149 | + mciNumber: json["mciNumber"], | |
| 150 | + multiverseid: json["multiverseid"], | |
| 151 | + name: json["name"], | |
| 152 | + originalText: json["originalText"], | |
| 153 | + originalType: json["originalType"], | |
| 154 | + power: json["power"], | |
| 155 | + printings: List<String>.from(json["printings"].map((x) => x)), | |
| 156 | + rarity: rarityValues.map[json["rarity"]]!, | |
| 157 | + reserved: json["reserved"], | |
| 158 | + rulings: json["rulings"] == null ? null : List<Ruling>.from(json["rulings"]!.map((x) => Ruling.fromJson(x))), | |
| 159 | + subtypes: json["subtypes"] == null ? null : List<String>.from(json["subtypes"]!.map((x) => x)), | |
| 160 | + supertypes: json["supertypes"] == null ? null : List<Supertype>.from(json["supertypes"]!.map((x) => supertypeValues.map[x]!)), | |
| 161 | + text: json["text"], | |
| 162 | + toughness: json["toughness"], | |
| 163 | + type: json["type"], | |
| 164 | + types: List<Type>.from(json["types"].map((x) => typeValues.map[x]!)), | |
| 165 | + variations: json["variations"] == null ? null : List<int>.from(json["variations"]!.map((x) => x)), | |
| 166 | + ); | |
| 167 | + | |
| 168 | + Map<String, dynamic> toJson() => { | |
| 169 | + "artist": artist, | |
| 170 | + "cmc": cmc, | |
| 171 | + "colorIdentity": colorIdentity == null ? null : List<dynamic>.from(colorIdentity!.map((x) => colorIdentityValues.reverse[x])), | |
| 172 | + "colors": colors == null ? null : List<dynamic>.from(colors!.map((x) => colorValues.reverse[x])), | |
| 173 | + "flavor": flavor, | |
| 174 | + "id": id, | |
| 175 | + "imageName": imageName, | |
| 176 | + "layout": layoutValues.reverse[layout], | |
| 177 | + "legalities": List<dynamic>.from(legalities.map((x) => x.toJson())), | |
| 178 | + "manaCost": manaCost, | |
| 179 | + "mciNumber": mciNumber, | |
| 180 | + "multiverseid": multiverseid, | |
| 181 | + "name": name, | |
| 182 | + "originalText": originalText, | |
| 183 | + "originalType": originalType, | |
| 184 | + "power": power, | |
| 185 | + "printings": List<dynamic>.from(printings.map((x) => x)), | |
| 186 | + "rarity": rarityValues.reverse[rarity], | |
| 187 | + "reserved": reserved, | |
| 188 | + "rulings": rulings == null ? null : List<dynamic>.from(rulings!.map((x) => x.toJson())), | |
| 189 | + "subtypes": subtypes == null ? null : List<dynamic>.from(subtypes!.map((x) => x)), | |
| 190 | + "supertypes": supertypes == null ? null : List<dynamic>.from(supertypes!.map((x) => supertypeValues.reverse[x])), | |
| 191 | + "text": text, | |
| 192 | + "toughness": toughness, | |
| 193 | + "type": type, | |
| 194 | + "types": List<dynamic>.from(types.map((x) => typeValues.reverse[x])), | |
| 195 | + "variations": variations == null ? null : List<dynamic>.from(variations!.map((x) => x)), | |
| 196 | + }; | |
| 197 | +} | |
| 198 | + | |
| 199 | +enum ColorIdentity { | |
| 200 | + U, | |
| 201 | + B, | |
| 202 | + W, | |
| 203 | + G, | |
| 204 | + R | |
| 205 | +} | |
| 206 | + | |
| 207 | +final colorIdentityValues = EnumValues({ | |
| 208 | + "U": ColorIdentity.U, | |
| 209 | + "B": ColorIdentity.B, | |
| 210 | + "W": ColorIdentity.W, | |
| 211 | + "G": ColorIdentity.G, | |
| 212 | + "R": ColorIdentity.R | |
| 213 | +}); | |
| 214 | + | |
| 215 | +enum Color { | |
| 216 | + BLUE, | |
| 217 | + BLACK, | |
| 218 | + WHITE, | |
| 219 | + GREEN, | |
| 220 | + RED | |
| 221 | +} | |
| 222 | + | |
| 223 | +final colorValues = EnumValues({ | |
| 224 | + "Blue": Color.BLUE, | |
| 225 | + "Black": Color.BLACK, | |
| 226 | + "White": Color.WHITE, | |
| 227 | + "Green": Color.GREEN, | |
| 228 | + "Red": Color.RED | |
| 229 | +}); | |
| 230 | + | |
| 231 | +enum Layout { | |
| 232 | + NORMAL | |
| 233 | +} | |
| 234 | + | |
| 235 | +final layoutValues = EnumValues({ | |
| 236 | + "normal": Layout.NORMAL | |
| 237 | +}); | |
| 238 | + | |
| 239 | +class LegalityElement { | |
| 240 | + final Format format; | |
| 241 | + final LegalityEnum legality; | |
| 242 | + | |
| 243 | + LegalityElement({ | |
| 244 | + required this.format, | |
| 245 | + required this.legality, | |
| 246 | + }); | |
| 247 | + | |
| 248 | + factory LegalityElement.fromJson(Map<String, dynamic> json) => LegalityElement( | |
| 249 | + format: formatValues.map[json["format"]]!, | |
| 250 | + legality: legalityEnumValues.map[json["legality"]]!, | |
| 251 | + ); | |
| 252 | + | |
| 253 | + Map<String, dynamic> toJson() => { | |
| 254 | + "format": formatValues.reverse[format], | |
| 255 | + "legality": legalityEnumValues.reverse[legality], | |
| 256 | + }; | |
| 257 | +} | |
| 258 | + | |
| 259 | +enum Format { | |
| 260 | + COMMANDER, | |
| 261 | + LEGACY, | |
| 262 | + MODERN, | |
| 263 | + VINTAGE, | |
| 264 | + TIME_SPIRAL_BLOCK, | |
| 265 | + RAVNICA_BLOCK, | |
| 266 | + ICE_AGE_BLOCK, | |
| 267 | + TEMPEST_BLOCK, | |
| 268 | + ONSLAUGHT_BLOCK, | |
| 269 | + MASQUES_BLOCK, | |
| 270 | + MIRAGE_BLOCK, | |
| 271 | + URZA_BLOCK, | |
| 272 | + SCARS_OF_MIRRODIN_BLOCK, | |
| 273 | + MIRRODIN_BLOCK, | |
| 274 | + AMONKHET_BLOCK, | |
| 275 | + BATTLE_FOR_ZENDIKAR_BLOCK, | |
| 276 | + INNISTRAD_BLOCK, | |
| 277 | + INVASION_BLOCK, | |
| 278 | + KALADESH_BLOCK, | |
| 279 | + KAMIGAWA_BLOCK, | |
| 280 | + KHANS_OF_TARKIR_BLOCK, | |
| 281 | + LORWYN_SHADOWMOOR_BLOCK, | |
| 282 | + ODYSSEY_BLOCK, | |
| 283 | + RETURN_TO_RAVNICA_BLOCK, | |
| 284 | + SHADOWS_OVER_INNISTRAD_BLOCK, | |
| 285 | + SHARDS_OF_ALARA_BLOCK, | |
| 286 | + STANDARD, | |
| 287 | + THEROS_BLOCK, | |
| 288 | + UN_SETS, | |
| 289 | + ZENDIKAR_BLOCK | |
| 290 | +} | |
| 291 | + | |
| 292 | +final formatValues = EnumValues({ | |
| 293 | + "Commander": Format.COMMANDER, | |
| 294 | + "Legacy": Format.LEGACY, | |
| 295 | + "Modern": Format.MODERN, | |
| 296 | + "Vintage": Format.VINTAGE, | |
| 297 | + "Time Spiral Block": Format.TIME_SPIRAL_BLOCK, | |
| 298 | + "Ravnica Block": Format.RAVNICA_BLOCK, | |
| 299 | + "Ice Age Block": Format.ICE_AGE_BLOCK, | |
| 300 | + "Tempest Block": Format.TEMPEST_BLOCK, | |
| 301 | + "Onslaught Block": Format.ONSLAUGHT_BLOCK, | |
| 302 | + "Masques Block": Format.MASQUES_BLOCK, | |
| 303 | + "Mirage Block": Format.MIRAGE_BLOCK, | |
| 304 | + "Urza Block": Format.URZA_BLOCK, | |
| 305 | + "Scars of Mirrodin Block": Format.SCARS_OF_MIRRODIN_BLOCK, | |
| 306 | + "Mirrodin Block": Format.MIRRODIN_BLOCK, | |
| 307 | + "Amonkhet Block": Format.AMONKHET_BLOCK, | |
| 308 | + "Battle for Zendikar Block": Format.BATTLE_FOR_ZENDIKAR_BLOCK, | |
| 309 | + "Innistrad Block": Format.INNISTRAD_BLOCK, | |
| 310 | + "Invasion Block": Format.INVASION_BLOCK, | |
| 311 | + "Kaladesh Block": Format.KALADESH_BLOCK, | |
| 312 | + "Kamigawa Block": Format.KAMIGAWA_BLOCK, | |
| 313 | + "Khans of Tarkir Block": Format.KHANS_OF_TARKIR_BLOCK, | |
| 314 | + "Lorwyn-Shadowmoor Block": Format.LORWYN_SHADOWMOOR_BLOCK, | |
| 315 | + "Odyssey Block": Format.ODYSSEY_BLOCK, | |
| 316 | + "Return to Ravnica Block": Format.RETURN_TO_RAVNICA_BLOCK, | |
| 317 | + "Shadows over Innistrad Block": Format.SHADOWS_OVER_INNISTRAD_BLOCK, | |
| 318 | + "Shards of Alara Block": Format.SHARDS_OF_ALARA_BLOCK, | |
| 319 | + "Standard": Format.STANDARD, | |
| 320 | + "Theros Block": Format.THEROS_BLOCK, | |
| 321 | + "Un-Sets": Format.UN_SETS, | |
| 322 | + "Zendikar Block": Format.ZENDIKAR_BLOCK | |
| 323 | +}); | |
| 324 | + | |
| 325 | +enum LegalityEnum { | |
| 326 | + LEGAL, | |
| 327 | + BANNED, | |
| 328 | + RESTRICTED | |
| 329 | +} | |
| 330 | + | |
| 331 | +final legalityEnumValues = EnumValues({ | |
| 332 | + "Legal": LegalityEnum.LEGAL, | |
| 333 | + "Banned": LegalityEnum.BANNED, | |
| 334 | + "Restricted": LegalityEnum.RESTRICTED | |
| 335 | +}); | |
| 336 | + | |
| 337 | +enum Rarity { | |
| 338 | + UNCOMMON, | |
| 339 | + RARE, | |
| 340 | + COMMON, | |
| 341 | + BASIC_LAND | |
| 342 | +} | |
| 343 | + | |
| 344 | +final rarityValues = EnumValues({ | |
| 345 | + "Uncommon": Rarity.UNCOMMON, | |
| 346 | + "Rare": Rarity.RARE, | |
| 347 | + "Common": Rarity.COMMON, | |
| 348 | + "Basic Land": Rarity.BASIC_LAND | |
| 349 | +}); | |
| 350 | + | |
| 351 | +class Ruling { | |
| 352 | + final DateTime date; | |
| 353 | + final String text; | |
| 354 | + | |
| 355 | + Ruling({ | |
| 356 | + required this.date, | |
| 357 | + required this.text, | |
| 358 | + }); | |
| 359 | + | |
| 360 | + factory Ruling.fromJson(Map<String, dynamic> json) => Ruling( | |
| 361 | + date: DateTime.parse(json["date"]), | |
| 362 | + text: json["text"], | |
| 363 | + ); | |
| 364 | + | |
| 365 | + Map<String, dynamic> toJson() => { | |
| 366 | + "date": "${date.year.toString().padLeft(4, '0')}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}", | |
| 367 | + "text": text, | |
| 368 | + }; | |
| 369 | +} | |
| 370 | + | |
| 371 | +enum Supertype { | |
| 372 | + BASIC | |
| 373 | +} | |
| 374 | + | |
| 375 | +final supertypeValues = EnumValues({ | |
| 376 | + "Basic": Supertype.BASIC | |
| 377 | +}); | |
| 378 | + | |
| 379 | +enum Type { | |
| 380 | + CREATURE, | |
| 381 | + INSTANT, | |
| 382 | + ENCHANTMENT, | |
| 383 | + ARTIFACT, | |
| 384 | + SORCERY, | |
| 385 | + LAND | |
| 386 | +} | |
| 387 | + | |
| 388 | +final typeValues = EnumValues({ | |
| 389 | + "Creature": Type.CREATURE, | |
| 390 | + "Instant": Type.INSTANT, | |
| 391 | + "Enchantment": Type.ENCHANTMENT, | |
| 392 | + "Artifact": Type.ARTIFACT, | |
| 393 | + "Sorcery": Type.SORCERY, | |
| 394 | + "Land": Type.LAND | |
| 395 | +}); | |
| 396 | + | |
| 397 | +class EnumValues<T> { | |
| 398 | + Map<String, T> map; | |
| 399 | + late Map<T, String> reverseMap; | |
| 400 | + | |
| 401 | + EnumValues(this.map); | |
| 402 | + | |
| 403 | + Map<T, String> get reverse { | |
| 404 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 405 | + return reverseMap; | |
| 406 | + } | |
| 407 | +} |
Test case
1 generated file · +269 −0test/inputs/json/misc/dec3a.json
Adartdefault / TopLevel.dart+269 −0
| @@ -0,0 +1,269 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Metadata metadata; | |
| 13 | + final List<Result> results; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.metadata, | |
| 17 | + required this.results, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 22 | + results: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "metadata": metadata.toJson(), | |
| 27 | + "results": List<dynamic>.from(results.map((x) => x.toJson())), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Metadata { | |
| 32 | + final double executionTime; | |
| 33 | + final ResponseInfo responseInfo; | |
| 34 | + final Resultset resultset; | |
| 35 | + | |
| 36 | + Metadata({ | |
| 37 | + required this.executionTime, | |
| 38 | + required this.responseInfo, | |
| 39 | + required this.resultset, | |
| 40 | + }); | |
| 41 | + | |
| 42 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 43 | + executionTime: json["executionTime"]?.toDouble(), | |
| 44 | + responseInfo: ResponseInfo.fromJson(json["responseInfo"]), | |
| 45 | + resultset: Resultset.fromJson(json["resultset"]), | |
| 46 | + ); | |
| 47 | + | |
| 48 | + Map<String, dynamic> toJson() => { | |
| 49 | + "executionTime": executionTime, | |
| 50 | + "responseInfo": responseInfo.toJson(), | |
| 51 | + "resultset": resultset.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class ResponseInfo { | |
| 56 | + final String developerMessage; | |
| 57 | + final int status; | |
| 58 | + | |
| 59 | + ResponseInfo({ | |
| 60 | + required this.developerMessage, | |
| 61 | + required this.status, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory ResponseInfo.fromJson(Map<String, dynamic> json) => ResponseInfo( | |
| 65 | + developerMessage: json["developerMessage"], | |
| 66 | + status: json["status"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "developerMessage": developerMessage, | |
| 71 | + "status": status, | |
| 72 | + }; | |
| 73 | +} | |
| 74 | + | |
| 75 | +class Resultset { | |
| 76 | + final int count; | |
| 77 | + final int page; | |
| 78 | + final int pagesize; | |
| 79 | + | |
| 80 | + Resultset({ | |
| 81 | + required this.count, | |
| 82 | + required this.page, | |
| 83 | + required this.pagesize, | |
| 84 | + }); | |
| 85 | + | |
| 86 | + factory Resultset.fromJson(Map<String, dynamic> json) => Resultset( | |
| 87 | + count: json["count"], | |
| 88 | + page: json["page"], | |
| 89 | + pagesize: json["pagesize"], | |
| 90 | + ); | |
| 91 | + | |
| 92 | + Map<String, dynamic> toJson() => { | |
| 93 | + "count": count, | |
| 94 | + "page": page, | |
| 95 | + "pagesize": pagesize, | |
| 96 | + }; | |
| 97 | +} | |
| 98 | + | |
| 99 | +class Result { | |
| 100 | + final String aboutOffice; | |
| 101 | + final String applicationProcess; | |
| 102 | + final String body; | |
| 103 | + final String changed; | |
| 104 | + final String created; | |
| 105 | + final dynamic deadline; | |
| 106 | + final dynamic hiringOffice; | |
| 107 | + final HiringOrg hiringOrg; | |
| 108 | + final dynamic jobId; | |
| 109 | + final String language; | |
| 110 | + final Location location; | |
| 111 | + final String numPositions; | |
| 112 | + final String position; | |
| 113 | + final String practiceArea; | |
| 114 | + final String qualifications; | |
| 115 | + final dynamic relocationExpenses; | |
| 116 | + final String salary; | |
| 117 | + final String title; | |
| 118 | + final String travel; | |
| 119 | + final String url; | |
| 120 | + final String uuid; | |
| 121 | + final String vuuid; | |
| 122 | + | |
| 123 | + Result({ | |
| 124 | + required this.aboutOffice, | |
| 125 | + required this.applicationProcess, | |
| 126 | + required this.body, | |
| 127 | + required this.changed, | |
| 128 | + required this.created, | |
| 129 | + required this.deadline, | |
| 130 | + required this.hiringOffice, | |
| 131 | + required this.hiringOrg, | |
| 132 | + required this.jobId, | |
| 133 | + required this.language, | |
| 134 | + required this.location, | |
| 135 | + required this.numPositions, | |
| 136 | + required this.position, | |
| 137 | + required this.practiceArea, | |
| 138 | + required this.qualifications, | |
| 139 | + required this.relocationExpenses, | |
| 140 | + required this.salary, | |
| 141 | + required this.title, | |
| 142 | + required this.travel, | |
| 143 | + required this.url, | |
| 144 | + required this.uuid, | |
| 145 | + required this.vuuid, | |
| 146 | + }); | |
| 147 | + | |
| 148 | + factory Result.fromJson(Map<String, dynamic> json) => Result( | |
| 149 | + aboutOffice: json["about_office"], | |
| 150 | + applicationProcess: json["application_process"], | |
| 151 | + body: json["body"], | |
| 152 | + changed: json["changed"], | |
| 153 | + created: json["created"], | |
| 154 | + deadline: json["deadline"], | |
| 155 | + hiringOffice: json["hiring_office"], | |
| 156 | + hiringOrg: HiringOrg.fromJson(json["hiring_org"]), | |
| 157 | + jobId: json["job_id"], | |
| 158 | + language: json["language"], | |
| 159 | + location: Location.fromJson(json["location"]), | |
| 160 | + numPositions: json["num_positions"], | |
| 161 | + position: json["position"], | |
| 162 | + practiceArea: json["practice_area"], | |
| 163 | + qualifications: json["qualifications"], | |
| 164 | + relocationExpenses: json["relocation_expenses"], | |
| 165 | + salary: json["salary"], | |
| 166 | + title: json["title"], | |
| 167 | + travel: json["travel"], | |
| 168 | + url: json["url"], | |
| 169 | + uuid: json["uuid"], | |
| 170 | + vuuid: json["vuuid"], | |
| 171 | + ); | |
| 172 | + | |
| 173 | + Map<String, dynamic> toJson() => { | |
| 174 | + "about_office": aboutOffice, | |
| 175 | + "application_process": applicationProcess, | |
| 176 | + "body": body, | |
| 177 | + "changed": changed, | |
| 178 | + "created": created, | |
| 179 | + "deadline": deadline, | |
| 180 | + "hiring_office": hiringOffice, | |
| 181 | + "hiring_org": hiringOrg.toJson(), | |
| 182 | + "job_id": jobId, | |
| 183 | + "language": language, | |
| 184 | + "location": location.toJson(), | |
| 185 | + "num_positions": numPositions, | |
| 186 | + "position": position, | |
| 187 | + "practice_area": practiceArea, | |
| 188 | + "qualifications": qualifications, | |
| 189 | + "relocation_expenses": relocationExpenses, | |
| 190 | + "salary": salary, | |
| 191 | + "title": title, | |
| 192 | + "travel": travel, | |
| 193 | + "url": url, | |
| 194 | + "uuid": uuid, | |
| 195 | + "vuuid": vuuid, | |
| 196 | + }; | |
| 197 | +} | |
| 198 | + | |
| 199 | +class HiringOrg { | |
| 200 | + final String name; | |
| 201 | + final String uuid; | |
| 202 | + | |
| 203 | + HiringOrg({ | |
| 204 | + required this.name, | |
| 205 | + required this.uuid, | |
| 206 | + }); | |
| 207 | + | |
| 208 | + factory HiringOrg.fromJson(Map<String, dynamic> json) => HiringOrg( | |
| 209 | + name: json["name"], | |
| 210 | + uuid: json["uuid"], | |
| 211 | + ); | |
| 212 | + | |
| 213 | + Map<String, dynamic> toJson() => { | |
| 214 | + "name": name, | |
| 215 | + "uuid": uuid, | |
| 216 | + }; | |
| 217 | +} | |
| 218 | + | |
| 219 | +class Location { | |
| 220 | + final String administrativeArea; | |
| 221 | + final String country; | |
| 222 | + final String faxNumber; | |
| 223 | + final String locality; | |
| 224 | + final String mobileNumber; | |
| 225 | + final String phoneNumber; | |
| 226 | + final String phoneNumberExtension; | |
| 227 | + final String postalCode; | |
| 228 | + final dynamic subPremise; | |
| 229 | + final String thoroughfare; | |
| 230 | + | |
| 231 | + Location({ | |
| 232 | + required this.administrativeArea, | |
| 233 | + required this.country, | |
| 234 | + required this.faxNumber, | |
| 235 | + required this.locality, | |
| 236 | + required this.mobileNumber, | |
| 237 | + required this.phoneNumber, | |
| 238 | + required this.phoneNumberExtension, | |
| 239 | + required this.postalCode, | |
| 240 | + required this.subPremise, | |
| 241 | + required this.thoroughfare, | |
| 242 | + }); | |
| 243 | + | |
| 244 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 245 | + administrativeArea: json["administrative_area"], | |
| 246 | + country: json["country"], | |
| 247 | + faxNumber: json["fax_number"], | |
| 248 | + locality: json["locality"], | |
| 249 | + mobileNumber: json["mobile_number"], | |
| 250 | + phoneNumber: json["phone_number"], | |
| 251 | + phoneNumberExtension: json["phone_number_extension"], | |
| 252 | + postalCode: json["postal_code"], | |
| 253 | + subPremise: json["sub_premise"], | |
| 254 | + thoroughfare: json["thoroughfare"], | |
| 255 | + ); | |
| 256 | + | |
| 257 | + Map<String, dynamic> toJson() => { | |
| 258 | + "administrative_area": administrativeArea, | |
| 259 | + "country": country, | |
| 260 | + "fax_number": faxNumber, | |
| 261 | + "locality": locality, | |
| 262 | + "mobile_number": mobileNumber, | |
| 263 | + "phone_number": phoneNumber, | |
| 264 | + "phone_number_extension": phoneNumberExtension, | |
| 265 | + "postal_code": postalCode, | |
| 266 | + "sub_premise": subPremise, | |
| 267 | + "thoroughfare": thoroughfare, | |
| 268 | + }; | |
| 269 | +} |
Test case
1 generated file · +417 −0test/inputs/json/misc/df957.json
Adartdefault / TopLevel.dart+417 −0
| @@ -0,0 +1,417 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final String text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: json["text"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": text, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Guid { | |
| 328 | + final String isPermaLink; | |
| 329 | + | |
| 330 | + Guid({ | |
| 331 | + required this.isPermaLink, | |
| 332 | + }); | |
| 333 | + | |
| 334 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 335 | + isPermaLink: json["isPermaLink"], | |
| 336 | + ); | |
| 337 | + | |
| 338 | + Map<String, dynamic> toJson() => { | |
| 339 | + "isPermaLink": isPermaLink, | |
| 340 | + }; | |
| 341 | +} | |
| 342 | + | |
| 343 | +class Location { | |
| 344 | + final String city; | |
| 345 | + final String country; | |
| 346 | + final String region; | |
| 347 | + | |
| 348 | + Location({ | |
| 349 | + required this.city, | |
| 350 | + required this.country, | |
| 351 | + required this.region, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 355 | + city: json["city"], | |
| 356 | + country: json["country"], | |
| 357 | + region: json["region"], | |
| 358 | + ); | |
| 359 | + | |
| 360 | + Map<String, dynamic> toJson() => { | |
| 361 | + "city": city, | |
| 362 | + "country": country, | |
| 363 | + "region": region, | |
| 364 | + }; | |
| 365 | +} | |
| 366 | + | |
| 367 | +class Units { | |
| 368 | + final String distance; | |
| 369 | + final String pressure; | |
| 370 | + final String speed; | |
| 371 | + final String temperature; | |
| 372 | + | |
| 373 | + Units({ | |
| 374 | + required this.distance, | |
| 375 | + required this.pressure, | |
| 376 | + required this.speed, | |
| 377 | + required this.temperature, | |
| 378 | + }); | |
| 379 | + | |
| 380 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 381 | + distance: json["distance"], | |
| 382 | + pressure: json["pressure"], | |
| 383 | + speed: json["speed"], | |
| 384 | + temperature: json["temperature"], | |
| 385 | + ); | |
| 386 | + | |
| 387 | + Map<String, dynamic> toJson() => { | |
| 388 | + "distance": distance, | |
| 389 | + "pressure": pressure, | |
| 390 | + "speed": speed, | |
| 391 | + "temperature": temperature, | |
| 392 | + }; | |
| 393 | +} | |
| 394 | + | |
| 395 | +class Wind { | |
| 396 | + final String chill; | |
| 397 | + final String direction; | |
| 398 | + final String speed; | |
| 399 | + | |
| 400 | + Wind({ | |
| 401 | + required this.chill, | |
| 402 | + required this.direction, | |
| 403 | + required this.speed, | |
| 404 | + }); | |
| 405 | + | |
| 406 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 407 | + chill: json["chill"], | |
| 408 | + direction: json["direction"], | |
| 409 | + speed: json["speed"], | |
| 410 | + ); | |
| 411 | + | |
| 412 | + Map<String, dynamic> toJson() => { | |
| 413 | + "chill": chill, | |
| 414 | + "direction": direction, | |
| 415 | + "speed": speed, | |
| 416 | + }; | |
| 417 | +} |
Test case
1 generated file · +465 −0test/inputs/json/misc/e0ac7.json
Adartdefault / TopLevel.dart+465 −0
| @@ -0,0 +1,465 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final String username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: json["username"], | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": username, | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final DownsizedSmall? hd; | |
| 136 | + final Looping looping; | |
| 137 | + final FixedHeight original; | |
| 138 | + final DownsizedSmall originalMp4; | |
| 139 | + final Downsized originalStill; | |
| 140 | + final DownsizedSmall preview; | |
| 141 | + final Downsized previewGif; | |
| 142 | + final Downsized previewWebp; | |
| 143 | + | |
| 144 | + Images({ | |
| 145 | + required this.downsized, | |
| 146 | + required this.downsizedLarge, | |
| 147 | + required this.downsizedMedium, | |
| 148 | + required this.downsizedSmall, | |
| 149 | + required this.downsizedStill, | |
| 150 | + required this.fixedHeight, | |
| 151 | + required this.fixedHeightDownsampled, | |
| 152 | + required this.fixedHeightSmall, | |
| 153 | + required this.fixedHeightSmallStill, | |
| 154 | + required this.fixedHeightStill, | |
| 155 | + required this.fixedWidth, | |
| 156 | + required this.fixedWidthDownsampled, | |
| 157 | + required this.fixedWidthSmall, | |
| 158 | + required this.fixedWidthSmallStill, | |
| 159 | + required this.fixedWidthStill, | |
| 160 | + this.hd, | |
| 161 | + required this.looping, | |
| 162 | + required this.original, | |
| 163 | + required this.originalMp4, | |
| 164 | + required this.originalStill, | |
| 165 | + required this.preview, | |
| 166 | + required this.previewGif, | |
| 167 | + required this.previewWebp, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 171 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 172 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 173 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 174 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 175 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 176 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 177 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 178 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 179 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 180 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 181 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 182 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 183 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 184 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 185 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 186 | + hd: json["hd"] == null ? null : DownsizedSmall.fromJson(json["hd"]), | |
| 187 | + looping: Looping.fromJson(json["looping"]), | |
| 188 | + original: FixedHeight.fromJson(json["original"]), | |
| 189 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 190 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 191 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 192 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 193 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "downsized": downsized.toJson(), | |
| 198 | + "downsized_large": downsizedLarge.toJson(), | |
| 199 | + "downsized_medium": downsizedMedium.toJson(), | |
| 200 | + "downsized_small": downsizedSmall.toJson(), | |
| 201 | + "downsized_still": downsizedStill.toJson(), | |
| 202 | + "fixed_height": fixedHeight.toJson(), | |
| 203 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 204 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 205 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 206 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 207 | + "fixed_width": fixedWidth.toJson(), | |
| 208 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 209 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 210 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 211 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 212 | + "hd": hd?.toJson(), | |
| 213 | + "looping": looping.toJson(), | |
| 214 | + "original": original.toJson(), | |
| 215 | + "original_mp4": originalMp4.toJson(), | |
| 216 | + "original_still": originalStill.toJson(), | |
| 217 | + "preview": preview.toJson(), | |
| 218 | + "preview_gif": previewGif.toJson(), | |
| 219 | + "preview_webp": previewWebp.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Downsized { | |
| 224 | + final String height; | |
| 225 | + final String? size; | |
| 226 | + final String url; | |
| 227 | + final String width; | |
| 228 | + | |
| 229 | + Downsized({ | |
| 230 | + required this.height, | |
| 231 | + this.size, | |
| 232 | + required this.url, | |
| 233 | + required this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 237 | + height: json["height"], | |
| 238 | + size: json["size"], | |
| 239 | + url: json["url"], | |
| 240 | + width: json["width"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "height": height, | |
| 245 | + "size": size, | |
| 246 | + "url": url, | |
| 247 | + "width": width, | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +class DownsizedSmall { | |
| 252 | + final String height; | |
| 253 | + final String mp4; | |
| 254 | + final String mp4Size; | |
| 255 | + final String width; | |
| 256 | + | |
| 257 | + DownsizedSmall({ | |
| 258 | + required this.height, | |
| 259 | + required this.mp4, | |
| 260 | + required this.mp4Size, | |
| 261 | + required this.width, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 265 | + height: json["height"], | |
| 266 | + mp4: json["mp4"], | |
| 267 | + mp4Size: json["mp4_size"], | |
| 268 | + width: json["width"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "height": height, | |
| 273 | + "mp4": mp4, | |
| 274 | + "mp4_size": mp4Size, | |
| 275 | + "width": width, | |
| 276 | + }; | |
| 277 | +} | |
| 278 | + | |
| 279 | +class FixedHeight { | |
| 280 | + final String? frames; | |
| 281 | + final String? hash; | |
| 282 | + final String height; | |
| 283 | + final String? mp4; | |
| 284 | + final String? mp4Size; | |
| 285 | + final String size; | |
| 286 | + final String url; | |
| 287 | + final String webp; | |
| 288 | + final String webpSize; | |
| 289 | + final String width; | |
| 290 | + | |
| 291 | + FixedHeight({ | |
| 292 | + this.frames, | |
| 293 | + this.hash, | |
| 294 | + required this.height, | |
| 295 | + this.mp4, | |
| 296 | + this.mp4Size, | |
| 297 | + required this.size, | |
| 298 | + required this.url, | |
| 299 | + required this.webp, | |
| 300 | + required this.webpSize, | |
| 301 | + required this.width, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 305 | + frames: json["frames"], | |
| 306 | + hash: json["hash"], | |
| 307 | + height: json["height"], | |
| 308 | + mp4: json["mp4"], | |
| 309 | + mp4Size: json["mp4_size"], | |
| 310 | + size: json["size"], | |
| 311 | + url: json["url"], | |
| 312 | + webp: json["webp"], | |
| 313 | + webpSize: json["webp_size"], | |
| 314 | + width: json["width"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "frames": frames, | |
| 319 | + "hash": hash, | |
| 320 | + "height": height, | |
| 321 | + "mp4": mp4, | |
| 322 | + "mp4_size": mp4Size, | |
| 323 | + "size": size, | |
| 324 | + "url": url, | |
| 325 | + "webp": webp, | |
| 326 | + "webp_size": webpSize, | |
| 327 | + "width": width, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class Looping { | |
| 332 | + final String mp4; | |
| 333 | + final String mp4Size; | |
| 334 | + | |
| 335 | + Looping({ | |
| 336 | + required this.mp4, | |
| 337 | + required this.mp4Size, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 341 | + mp4: json["mp4"], | |
| 342 | + mp4Size: json["mp4_size"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "mp4": mp4, | |
| 347 | + "mp4_size": mp4Size, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +enum Rating { | |
| 352 | + G, | |
| 353 | + PG, | |
| 354 | + Y | |
| 355 | +} | |
| 356 | + | |
| 357 | +final ratingValues = EnumValues({ | |
| 358 | + "g": Rating.G, | |
| 359 | + "pg": Rating.PG, | |
| 360 | + "y": Rating.Y | |
| 361 | +}); | |
| 362 | + | |
| 363 | +enum Type { | |
| 364 | + GIF | |
| 365 | +} | |
| 366 | + | |
| 367 | +final typeValues = EnumValues({ | |
| 368 | + "gif": Type.GIF | |
| 369 | +}); | |
| 370 | + | |
| 371 | +class User { | |
| 372 | + final String avatarUrl; | |
| 373 | + final String bannerUrl; | |
| 374 | + final String displayName; | |
| 375 | + final String profileUrl; | |
| 376 | + final String twitter; | |
| 377 | + final String username; | |
| 378 | + | |
| 379 | + User({ | |
| 380 | + required this.avatarUrl, | |
| 381 | + required this.bannerUrl, | |
| 382 | + required this.displayName, | |
| 383 | + required this.profileUrl, | |
| 384 | + required this.twitter, | |
| 385 | + required this.username, | |
| 386 | + }); | |
| 387 | + | |
| 388 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 389 | + avatarUrl: json["avatar_url"], | |
| 390 | + bannerUrl: json["banner_url"], | |
| 391 | + displayName: json["display_name"], | |
| 392 | + profileUrl: json["profile_url"], | |
| 393 | + twitter: json["twitter"], | |
| 394 | + username: json["username"], | |
| 395 | + ); | |
| 396 | + | |
| 397 | + Map<String, dynamic> toJson() => { | |
| 398 | + "avatar_url": avatarUrl, | |
| 399 | + "banner_url": bannerUrl, | |
| 400 | + "display_name": displayName, | |
| 401 | + "profile_url": profileUrl, | |
| 402 | + "twitter": twitter, | |
| 403 | + "username": username, | |
| 404 | + }; | |
| 405 | +} | |
| 406 | + | |
| 407 | +class Meta { | |
| 408 | + final String msg; | |
| 409 | + final String responseId; | |
| 410 | + final int status; | |
| 411 | + | |
| 412 | + Meta({ | |
| 413 | + required this.msg, | |
| 414 | + required this.responseId, | |
| 415 | + required this.status, | |
| 416 | + }); | |
| 417 | + | |
| 418 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 419 | + msg: json["msg"], | |
| 420 | + responseId: json["response_id"], | |
| 421 | + status: json["status"], | |
| 422 | + ); | |
| 423 | + | |
| 424 | + Map<String, dynamic> toJson() => { | |
| 425 | + "msg": msg, | |
| 426 | + "response_id": responseId, | |
| 427 | + "status": status, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class Pagination { | |
| 432 | + final int count; | |
| 433 | + final int offset; | |
| 434 | + final int totalCount; | |
| 435 | + | |
| 436 | + Pagination({ | |
| 437 | + required this.count, | |
| 438 | + required this.offset, | |
| 439 | + required this.totalCount, | |
| 440 | + }); | |
| 441 | + | |
| 442 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 443 | + count: json["count"], | |
| 444 | + offset: json["offset"], | |
| 445 | + totalCount: json["total_count"], | |
| 446 | + ); | |
| 447 | + | |
| 448 | + Map<String, dynamic> toJson() => { | |
| 449 | + "count": count, | |
| 450 | + "offset": offset, | |
| 451 | + "total_count": totalCount, | |
| 452 | + }; | |
| 453 | +} | |
| 454 | + | |
| 455 | +class EnumValues<T> { | |
| 456 | + Map<String, T> map; | |
| 457 | + late Map<T, String> reverseMap; | |
| 458 | + | |
| 459 | + EnumValues(this.map); | |
| 460 | + | |
| 461 | + Map<T, String> get reverse { | |
| 462 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 463 | + return reverseMap; | |
| 464 | + } | |
| 465 | +} |
Test case
1 generated file · +437 −0test/inputs/json/misc/e2915.json
Adartdefault / TopLevel.dart+437 −0
| @@ -0,0 +1,437 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Query query; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.query, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + query: Query.fromJson(json["query"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "query": query.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Query { | |
| 28 | + final int count; | |
| 29 | + final DateTime created; | |
| 30 | + final String lang; | |
| 31 | + final Results results; | |
| 32 | + | |
| 33 | + Query({ | |
| 34 | + required this.count, | |
| 35 | + required this.created, | |
| 36 | + required this.lang, | |
| 37 | + required this.results, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 41 | + count: json["count"], | |
| 42 | + created: DateTime.parse(json["created"]), | |
| 43 | + lang: json["lang"], | |
| 44 | + results: Results.fromJson(json["results"]), | |
| 45 | + ); | |
| 46 | + | |
| 47 | + Map<String, dynamic> toJson() => { | |
| 48 | + "count": count, | |
| 49 | + "created": created.toIso8601String(), | |
| 50 | + "lang": lang, | |
| 51 | + "results": results.toJson(), | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Results { | |
| 56 | + final Channel channel; | |
| 57 | + | |
| 58 | + Results({ | |
| 59 | + required this.channel, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Results.fromJson(Map<String, dynamic> json) => Results( | |
| 63 | + channel: Channel.fromJson(json["channel"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "channel": channel.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Channel { | |
| 72 | + final Astronomy astronomy; | |
| 73 | + final Atmosphere atmosphere; | |
| 74 | + final String description; | |
| 75 | + final Image image; | |
| 76 | + final Item item; | |
| 77 | + final String language; | |
| 78 | + final String lastBuildDate; | |
| 79 | + final String link; | |
| 80 | + final Location location; | |
| 81 | + final String title; | |
| 82 | + final String ttl; | |
| 83 | + final Units units; | |
| 84 | + final Wind wind; | |
| 85 | + | |
| 86 | + Channel({ | |
| 87 | + required this.astronomy, | |
| 88 | + required this.atmosphere, | |
| 89 | + required this.description, | |
| 90 | + required this.image, | |
| 91 | + required this.item, | |
| 92 | + required this.language, | |
| 93 | + required this.lastBuildDate, | |
| 94 | + required this.link, | |
| 95 | + required this.location, | |
| 96 | + required this.title, | |
| 97 | + required this.ttl, | |
| 98 | + required this.units, | |
| 99 | + required this.wind, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory Channel.fromJson(Map<String, dynamic> json) => Channel( | |
| 103 | + astronomy: Astronomy.fromJson(json["astronomy"]), | |
| 104 | + atmosphere: Atmosphere.fromJson(json["atmosphere"]), | |
| 105 | + description: json["description"], | |
| 106 | + image: Image.fromJson(json["image"]), | |
| 107 | + item: Item.fromJson(json["item"]), | |
| 108 | + language: json["language"], | |
| 109 | + lastBuildDate: json["lastBuildDate"], | |
| 110 | + link: json["link"], | |
| 111 | + location: Location.fromJson(json["location"]), | |
| 112 | + title: json["title"], | |
| 113 | + ttl: json["ttl"], | |
| 114 | + units: Units.fromJson(json["units"]), | |
| 115 | + wind: Wind.fromJson(json["wind"]), | |
| 116 | + ); | |
| 117 | + | |
| 118 | + Map<String, dynamic> toJson() => { | |
| 119 | + "astronomy": astronomy.toJson(), | |
| 120 | + "atmosphere": atmosphere.toJson(), | |
| 121 | + "description": description, | |
| 122 | + "image": image.toJson(), | |
| 123 | + "item": item.toJson(), | |
| 124 | + "language": language, | |
| 125 | + "lastBuildDate": lastBuildDate, | |
| 126 | + "link": link, | |
| 127 | + "location": location.toJson(), | |
| 128 | + "title": title, | |
| 129 | + "ttl": ttl, | |
| 130 | + "units": units.toJson(), | |
| 131 | + "wind": wind.toJson(), | |
| 132 | + }; | |
| 133 | +} | |
| 134 | + | |
| 135 | +class Astronomy { | |
| 136 | + final String sunrise; | |
| 137 | + final String sunset; | |
| 138 | + | |
| 139 | + Astronomy({ | |
| 140 | + required this.sunrise, | |
| 141 | + required this.sunset, | |
| 142 | + }); | |
| 143 | + | |
| 144 | + factory Astronomy.fromJson(Map<String, dynamic> json) => Astronomy( | |
| 145 | + sunrise: json["sunrise"], | |
| 146 | + sunset: json["sunset"], | |
| 147 | + ); | |
| 148 | + | |
| 149 | + Map<String, dynamic> toJson() => { | |
| 150 | + "sunrise": sunrise, | |
| 151 | + "sunset": sunset, | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class Atmosphere { | |
| 156 | + final String humidity; | |
| 157 | + final String pressure; | |
| 158 | + final String rising; | |
| 159 | + final String visibility; | |
| 160 | + | |
| 161 | + Atmosphere({ | |
| 162 | + required this.humidity, | |
| 163 | + required this.pressure, | |
| 164 | + required this.rising, | |
| 165 | + required this.visibility, | |
| 166 | + }); | |
| 167 | + | |
| 168 | + factory Atmosphere.fromJson(Map<String, dynamic> json) => Atmosphere( | |
| 169 | + humidity: json["humidity"], | |
| 170 | + pressure: json["pressure"], | |
| 171 | + rising: json["rising"], | |
| 172 | + visibility: json["visibility"], | |
| 173 | + ); | |
| 174 | + | |
| 175 | + Map<String, dynamic> toJson() => { | |
| 176 | + "humidity": humidity, | |
| 177 | + "pressure": pressure, | |
| 178 | + "rising": rising, | |
| 179 | + "visibility": visibility, | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +class Image { | |
| 184 | + final String height; | |
| 185 | + final String link; | |
| 186 | + final String title; | |
| 187 | + final String url; | |
| 188 | + final String width; | |
| 189 | + | |
| 190 | + Image({ | |
| 191 | + required this.height, | |
| 192 | + required this.link, | |
| 193 | + required this.title, | |
| 194 | + required this.url, | |
| 195 | + required this.width, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Image.fromJson(Map<String, dynamic> json) => Image( | |
| 199 | + height: json["height"], | |
| 200 | + link: json["link"], | |
| 201 | + title: json["title"], | |
| 202 | + url: json["url"], | |
| 203 | + width: json["width"], | |
| 204 | + ); | |
| 205 | + | |
| 206 | + Map<String, dynamic> toJson() => { | |
| 207 | + "height": height, | |
| 208 | + "link": link, | |
| 209 | + "title": title, | |
| 210 | + "url": url, | |
| 211 | + "width": width, | |
| 212 | + }; | |
| 213 | +} | |
| 214 | + | |
| 215 | +class Item { | |
| 216 | + final Condition condition; | |
| 217 | + final String description; | |
| 218 | + final List<Forecast> forecast; | |
| 219 | + final Guid guid; | |
| 220 | + final String lat; | |
| 221 | + final String link; | |
| 222 | + final String long; | |
| 223 | + final String pubDate; | |
| 224 | + final String title; | |
| 225 | + | |
| 226 | + Item({ | |
| 227 | + required this.condition, | |
| 228 | + required this.description, | |
| 229 | + required this.forecast, | |
| 230 | + required this.guid, | |
| 231 | + required this.lat, | |
| 232 | + required this.link, | |
| 233 | + required this.long, | |
| 234 | + required this.pubDate, | |
| 235 | + required this.title, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Item.fromJson(Map<String, dynamic> json) => Item( | |
| 239 | + condition: Condition.fromJson(json["condition"]), | |
| 240 | + description: json["description"], | |
| 241 | + forecast: List<Forecast>.from(json["forecast"].map((x) => Forecast.fromJson(x))), | |
| 242 | + guid: Guid.fromJson(json["guid"]), | |
| 243 | + lat: json["lat"], | |
| 244 | + link: json["link"], | |
| 245 | + long: json["long"], | |
| 246 | + pubDate: json["pubDate"], | |
| 247 | + title: json["title"], | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "condition": condition.toJson(), | |
| 252 | + "description": description, | |
| 253 | + "forecast": List<dynamic>.from(forecast.map((x) => x.toJson())), | |
| 254 | + "guid": guid.toJson(), | |
| 255 | + "lat": lat, | |
| 256 | + "link": link, | |
| 257 | + "long": long, | |
| 258 | + "pubDate": pubDate, | |
| 259 | + "title": title, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class Condition { | |
| 264 | + final String code; | |
| 265 | + final String date; | |
| 266 | + final String temp; | |
| 267 | + final String text; | |
| 268 | + | |
| 269 | + Condition({ | |
| 270 | + required this.code, | |
| 271 | + required this.date, | |
| 272 | + required this.temp, | |
| 273 | + required this.text, | |
| 274 | + }); | |
| 275 | + | |
| 276 | + factory Condition.fromJson(Map<String, dynamic> json) => Condition( | |
| 277 | + code: json["code"], | |
| 278 | + date: json["date"], | |
| 279 | + temp: json["temp"], | |
| 280 | + text: json["text"], | |
| 281 | + ); | |
| 282 | + | |
| 283 | + Map<String, dynamic> toJson() => { | |
| 284 | + "code": code, | |
| 285 | + "date": date, | |
| 286 | + "temp": temp, | |
| 287 | + "text": text, | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Forecast { | |
| 292 | + final String code; | |
| 293 | + final String date; | |
| 294 | + final String day; | |
| 295 | + final String high; | |
| 296 | + final String low; | |
| 297 | + final Text text; | |
| 298 | + | |
| 299 | + Forecast({ | |
| 300 | + required this.code, | |
| 301 | + required this.date, | |
| 302 | + required this.day, | |
| 303 | + required this.high, | |
| 304 | + required this.low, | |
| 305 | + required this.text, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory Forecast.fromJson(Map<String, dynamic> json) => Forecast( | |
| 309 | + code: json["code"], | |
| 310 | + date: json["date"], | |
| 311 | + day: json["day"], | |
| 312 | + high: json["high"], | |
| 313 | + low: json["low"], | |
| 314 | + text: textValues.map[json["text"]]!, | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "code": code, | |
| 319 | + "date": date, | |
| 320 | + "day": day, | |
| 321 | + "high": high, | |
| 322 | + "low": low, | |
| 323 | + "text": textValues.reverse[text], | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +enum Text { | |
| 328 | + SUNNY | |
| 329 | +} | |
| 330 | + | |
| 331 | +final textValues = EnumValues({ | |
| 332 | + "Sunny": Text.SUNNY | |
| 333 | +}); | |
| 334 | + | |
| 335 | +class Guid { | |
| 336 | + final String isPermaLink; | |
| 337 | + | |
| 338 | + Guid({ | |
| 339 | + required this.isPermaLink, | |
| 340 | + }); | |
| 341 | + | |
| 342 | + factory Guid.fromJson(Map<String, dynamic> json) => Guid( | |
| 343 | + isPermaLink: json["isPermaLink"], | |
| 344 | + ); | |
| 345 | + | |
| 346 | + Map<String, dynamic> toJson() => { | |
| 347 | + "isPermaLink": isPermaLink, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +class Location { | |
| 352 | + final String city; | |
| 353 | + final String country; | |
| 354 | + final String region; | |
| 355 | + | |
| 356 | + Location({ | |
| 357 | + required this.city, | |
| 358 | + required this.country, | |
| 359 | + required this.region, | |
| 360 | + }); | |
| 361 | + | |
| 362 | + factory Location.fromJson(Map<String, dynamic> json) => Location( | |
| 363 | + city: json["city"], | |
| 364 | + country: json["country"], | |
| 365 | + region: json["region"], | |
| 366 | + ); | |
| 367 | + | |
| 368 | + Map<String, dynamic> toJson() => { | |
| 369 | + "city": city, | |
| 370 | + "country": country, | |
| 371 | + "region": region, | |
| 372 | + }; | |
| 373 | +} | |
| 374 | + | |
| 375 | +class Units { | |
| 376 | + final String distance; | |
| 377 | + final String pressure; | |
| 378 | + final String speed; | |
| 379 | + final String temperature; | |
| 380 | + | |
| 381 | + Units({ | |
| 382 | + required this.distance, | |
| 383 | + required this.pressure, | |
| 384 | + required this.speed, | |
| 385 | + required this.temperature, | |
| 386 | + }); | |
| 387 | + | |
| 388 | + factory Units.fromJson(Map<String, dynamic> json) => Units( | |
| 389 | + distance: json["distance"], | |
| 390 | + pressure: json["pressure"], | |
| 391 | + speed: json["speed"], | |
| 392 | + temperature: json["temperature"], | |
| 393 | + ); | |
| 394 | + | |
| 395 | + Map<String, dynamic> toJson() => { | |
| 396 | + "distance": distance, | |
| 397 | + "pressure": pressure, | |
| 398 | + "speed": speed, | |
| 399 | + "temperature": temperature, | |
| 400 | + }; | |
| 401 | +} | |
| 402 | + | |
| 403 | +class Wind { | |
| 404 | + final String chill; | |
| 405 | + final String direction; | |
| 406 | + final String speed; | |
| 407 | + | |
| 408 | + Wind({ | |
| 409 | + required this.chill, | |
| 410 | + required this.direction, | |
| 411 | + required this.speed, | |
| 412 | + }); | |
| 413 | + | |
| 414 | + factory Wind.fromJson(Map<String, dynamic> json) => Wind( | |
| 415 | + chill: json["chill"], | |
| 416 | + direction: json["direction"], | |
| 417 | + speed: json["speed"], | |
| 418 | + ); | |
| 419 | + | |
| 420 | + Map<String, dynamic> toJson() => { | |
| 421 | + "chill": chill, | |
| 422 | + "direction": direction, | |
| 423 | + "speed": speed, | |
| 424 | + }; | |
| 425 | +} | |
| 426 | + | |
| 427 | +class EnumValues<T> { | |
| 428 | + Map<String, T> map; | |
| 429 | + late Map<T, String> reverseMap; | |
| 430 | + | |
| 431 | + EnumValues(this.map); | |
| 432 | + | |
| 433 | + Map<T, String> get reverse { | |
| 434 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 435 | + return reverseMap; | |
| 436 | + } | |
| 437 | +} |
Test case
1 generated file · +29 −0test/inputs/json/misc/e2a58.json
Adartdefault / TopLevel.dart+29 −0
| @@ -0,0 +1,29 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String date; | |
| 13 | + final List<String> stopAndSearch; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.date, | |
| 17 | + required this.stopAndSearch, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + date: json["date"], | |
| 22 | + stopAndSearch: List<String>.from(json["stop-and-search"].map((x) => x)), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "date": date, | |
| 27 | + "stop-and-search": List<dynamic>.from(stopAndSearch.map((x) => x)), | |
| 28 | + }; | |
| 29 | +} |
Test case
1 generated file · +321 −0test/inputs/json/misc/e324e.json
Adartdefault / TopLevel.dart+321 −0
| @@ -0,0 +1,321 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String basePath; | |
| 13 | + final Definitions definitions; | |
| 14 | + final String host; | |
| 15 | + final Info info; | |
| 16 | + final Paths paths; | |
| 17 | + final List<String> produces; | |
| 18 | + final List<String> schemes; | |
| 19 | + final String swagger; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.basePath, | |
| 23 | + required this.definitions, | |
| 24 | + required this.host, | |
| 25 | + required this.info, | |
| 26 | + required this.paths, | |
| 27 | + required this.produces, | |
| 28 | + required this.schemes, | |
| 29 | + required this.swagger, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + basePath: json["basePath"], | |
| 34 | + definitions: Definitions.fromJson(json["definitions"]), | |
| 35 | + host: json["host"], | |
| 36 | + info: Info.fromJson(json["info"]), | |
| 37 | + paths: Paths.fromJson(json["paths"]), | |
| 38 | + produces: List<String>.from(json["produces"].map((x) => x)), | |
| 39 | + schemes: List<String>.from(json["schemes"].map((x) => x)), | |
| 40 | + swagger: json["swagger"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "basePath": basePath, | |
| 45 | + "definitions": definitions.toJson(), | |
| 46 | + "host": host, | |
| 47 | + "info": info.toJson(), | |
| 48 | + "paths": paths.toJson(), | |
| 49 | + "produces": List<dynamic>.from(produces.map((x) => x)), | |
| 50 | + "schemes": List<dynamic>.from(schemes.map((x) => x)), | |
| 51 | + "swagger": swagger, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Definitions { | |
| 56 | + final Rate rate; | |
| 57 | + | |
| 58 | + Definitions({ | |
| 59 | + required this.rate, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Definitions.fromJson(Map<String, dynamic> json) => Definitions( | |
| 63 | + rate: Rate.fromJson(json["Rate"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "Rate": rate.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Rate { | |
| 72 | + final Map<String, Property> properties; | |
| 73 | + | |
| 74 | + Rate({ | |
| 75 | + required this.properties, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Rate.fromJson(Map<String, dynamic> json) => Rate( | |
| 79 | + properties: Map.from(json["properties"]).map((k, v) => MapEntry<String, Property>(k, Property.fromJson(v))), | |
| 80 | + ); | |
| 81 | + | |
| 82 | + Map<String, dynamic> toJson() => { | |
| 83 | + "properties": Map.from(properties).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class Property { | |
| 88 | + final String description; | |
| 89 | + final Type type; | |
| 90 | + | |
| 91 | + Property({ | |
| 92 | + required this.description, | |
| 93 | + required this.type, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory Property.fromJson(Map<String, dynamic> json) => Property( | |
| 97 | + description: json["description"], | |
| 98 | + type: typeValues.map[json["type"]]!, | |
| 99 | + ); | |
| 100 | + | |
| 101 | + Map<String, dynamic> toJson() => { | |
| 102 | + "description": description, | |
| 103 | + "type": typeValues.reverse[type], | |
| 104 | + }; | |
| 105 | +} | |
| 106 | + | |
| 107 | +enum Type { | |
| 108 | + STRING | |
| 109 | +} | |
| 110 | + | |
| 111 | +final typeValues = EnumValues({ | |
| 112 | + "string": Type.STRING | |
| 113 | +}); | |
| 114 | + | |
| 115 | +class Info { | |
| 116 | + final String description; | |
| 117 | + final String title; | |
| 118 | + final String version; | |
| 119 | + | |
| 120 | + Info({ | |
| 121 | + required this.description, | |
| 122 | + required this.title, | |
| 123 | + required this.version, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory Info.fromJson(Map<String, dynamic> json) => Info( | |
| 127 | + description: json["description"], | |
| 128 | + title: json["title"], | |
| 129 | + version: json["version"], | |
| 130 | + ); | |
| 131 | + | |
| 132 | + Map<String, dynamic> toJson() => { | |
| 133 | + "description": description, | |
| 134 | + "title": title, | |
| 135 | + "version": version, | |
| 136 | + }; | |
| 137 | +} | |
| 138 | + | |
| 139 | +class Paths { | |
| 140 | + final TariffRatesSearch tariffRatesSearch; | |
| 141 | + | |
| 142 | + Paths({ | |
| 143 | + required this.tariffRatesSearch, | |
| 144 | + }); | |
| 145 | + | |
| 146 | + factory Paths.fromJson(Map<String, dynamic> json) => Paths( | |
| 147 | + tariffRatesSearch: TariffRatesSearch.fromJson(json["/tariff_rates/search"]), | |
| 148 | + ); | |
| 149 | + | |
| 150 | + Map<String, dynamic> toJson() => { | |
| 151 | + "/tariff_rates/search": tariffRatesSearch.toJson(), | |
| 152 | + }; | |
| 153 | +} | |
| 154 | + | |
| 155 | +class TariffRatesSearch { | |
| 156 | + final Get tariffRatesSearchGet; | |
| 157 | + | |
| 158 | + TariffRatesSearch({ | |
| 159 | + required this.tariffRatesSearchGet, | |
| 160 | + }); | |
| 161 | + | |
| 162 | + factory TariffRatesSearch.fromJson(Map<String, dynamic> json) => TariffRatesSearch( | |
| 163 | + tariffRatesSearchGet: Get.fromJson(json["get"]), | |
| 164 | + ); | |
| 165 | + | |
| 166 | + Map<String, dynamic> toJson() => { | |
| 167 | + "get": tariffRatesSearchGet.toJson(), | |
| 168 | + }; | |
| 169 | +} | |
| 170 | + | |
| 171 | +class Get { | |
| 172 | + final String description; | |
| 173 | + final List<Parameter> parameters; | |
| 174 | + final Responses responses; | |
| 175 | + final String summary; | |
| 176 | + final List<String> tags; | |
| 177 | + | |
| 178 | + Get({ | |
| 179 | + required this.description, | |
| 180 | + required this.parameters, | |
| 181 | + required this.responses, | |
| 182 | + required this.summary, | |
| 183 | + required this.tags, | |
| 184 | + }); | |
| 185 | + | |
| 186 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 187 | + description: json["description"], | |
| 188 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 189 | + responses: Responses.fromJson(json["responses"]), | |
| 190 | + summary: json["summary"], | |
| 191 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 192 | + ); | |
| 193 | + | |
| 194 | + Map<String, dynamic> toJson() => { | |
| 195 | + "description": description, | |
| 196 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 197 | + "responses": responses.toJson(), | |
| 198 | + "summary": summary, | |
| 199 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 200 | + }; | |
| 201 | +} | |
| 202 | + | |
| 203 | +class Parameter { | |
| 204 | + final String description; | |
| 205 | + final Type format; | |
| 206 | + final String name; | |
| 207 | + final String parameterIn; | |
| 208 | + final bool required; | |
| 209 | + final Type type; | |
| 210 | + | |
| 211 | + Parameter({ | |
| 212 | + required this.description, | |
| 213 | + required this.format, | |
| 214 | + required this.name, | |
| 215 | + required this.parameterIn, | |
| 216 | + required this.required, | |
| 217 | + required this.type, | |
| 218 | + }); | |
| 219 | + | |
| 220 | + factory Parameter.fromJson(Map<String, dynamic> json) => Parameter( | |
| 221 | + description: json["description"], | |
| 222 | + format: typeValues.map[json["format"]]!, | |
| 223 | + name: json["name"], | |
| 224 | + parameterIn: json["in"], | |
| 225 | + required: json["required"], | |
| 226 | + type: typeValues.map[json["type"]]!, | |
| 227 | + ); | |
| 228 | + | |
| 229 | + Map<String, dynamic> toJson() => { | |
| 230 | + "description": description, | |
| 231 | + "format": typeValues.reverse[format], | |
| 232 | + "name": name, | |
| 233 | + "in": parameterIn, | |
| 234 | + "required": required, | |
| 235 | + "type": typeValues.reverse[type], | |
| 236 | + }; | |
| 237 | +} | |
| 238 | + | |
| 239 | +class Responses { | |
| 240 | + final The200 the200; | |
| 241 | + | |
| 242 | + Responses({ | |
| 243 | + required this.the200, | |
| 244 | + }); | |
| 245 | + | |
| 246 | + factory Responses.fromJson(Map<String, dynamic> json) => Responses( | |
| 247 | + the200: The200.fromJson(json["200"]), | |
| 248 | + ); | |
| 249 | + | |
| 250 | + Map<String, dynamic> toJson() => { | |
| 251 | + "200": the200.toJson(), | |
| 252 | + }; | |
| 253 | +} | |
| 254 | + | |
| 255 | +class The200 { | |
| 256 | + final String description; | |
| 257 | + final Schema schema; | |
| 258 | + | |
| 259 | + The200({ | |
| 260 | + required this.description, | |
| 261 | + required this.schema, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory The200.fromJson(Map<String, dynamic> json) => The200( | |
| 265 | + description: json["description"], | |
| 266 | + schema: Schema.fromJson(json["schema"]), | |
| 267 | + ); | |
| 268 | + | |
| 269 | + Map<String, dynamic> toJson() => { | |
| 270 | + "description": description, | |
| 271 | + "schema": schema.toJson(), | |
| 272 | + }; | |
| 273 | +} | |
| 274 | + | |
| 275 | +class Schema { | |
| 276 | + final Items items; | |
| 277 | + final String type; | |
| 278 | + | |
| 279 | + Schema({ | |
| 280 | + required this.items, | |
| 281 | + required this.type, | |
| 282 | + }); | |
| 283 | + | |
| 284 | + factory Schema.fromJson(Map<String, dynamic> json) => Schema( | |
| 285 | + items: Items.fromJson(json["items"]), | |
| 286 | + type: json["type"], | |
| 287 | + ); | |
| 288 | + | |
| 289 | + Map<String, dynamic> toJson() => { | |
| 290 | + "items": items.toJson(), | |
| 291 | + "type": type, | |
| 292 | + }; | |
| 293 | +} | |
| 294 | + | |
| 295 | +class Items { | |
| 296 | + final String ref; | |
| 297 | + | |
| 298 | + Items({ | |
| 299 | + required this.ref, | |
| 300 | + }); | |
| 301 | + | |
| 302 | + factory Items.fromJson(Map<String, dynamic> json) => Items( | |
| 303 | + ref: json["\u0024ref"], | |
| 304 | + ); | |
| 305 | + | |
| 306 | + Map<String, dynamic> toJson() => { | |
| 307 | + "\u0024ref": ref, | |
| 308 | + }; | |
| 309 | +} | |
| 310 | + | |
| 311 | +class EnumValues<T> { | |
| 312 | + Map<String, T> map; | |
| 313 | + late Map<T, String> reverseMap; | |
| 314 | + | |
| 315 | + EnumValues(this.map); | |
| 316 | + | |
| 317 | + Map<T, String> get reverse { | |
| 318 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 319 | + return reverseMap; | |
| 320 | + } | |
| 321 | +} |
Test case
1 generated file · +121 −0test/inputs/json/misc/e53b5.json
Adartdefault / TopLevel.dart+121 −0
| @@ -0,0 +1,121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<dynamic> topLevelFromJson(String str) => List<dynamic>.from(json.decode(str).map((x) => x)); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<dynamic> data) => json.encode(List<dynamic>.from(data.map((x) => x))); | |
| 10 | + | |
| 11 | +class TopLevelElement { | |
| 12 | + final Country country; | |
| 13 | + final String date; | |
| 14 | + final String decimal; | |
| 15 | + final Country indicator; | |
| 16 | + final String value; | |
| 17 | + | |
| 18 | + TopLevelElement({ | |
| 19 | + required this.country, | |
| 20 | + required this.date, | |
| 21 | + required this.decimal, | |
| 22 | + required this.indicator, | |
| 23 | + required this.value, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevelElement.fromJson(Map<String, dynamic> json) => TopLevelElement( | |
| 27 | + country: Country.fromJson(json["country"]), | |
| 28 | + date: json["date"], | |
| 29 | + decimal: json["decimal"], | |
| 30 | + indicator: Country.fromJson(json["indicator"]), | |
| 31 | + value: json["value"], | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "country": country.toJson(), | |
| 36 | + "date": date, | |
| 37 | + "decimal": decimal, | |
| 38 | + "indicator": indicator.toJson(), | |
| 39 | + "value": value, | |
| 40 | + }; | |
| 41 | +} | |
| 42 | + | |
| 43 | +class Country { | |
| 44 | + final Id id; | |
| 45 | + final Value value; | |
| 46 | + | |
| 47 | + Country({ | |
| 48 | + required this.id, | |
| 49 | + required this.value, | |
| 50 | + }); | |
| 51 | + | |
| 52 | + factory Country.fromJson(Map<String, dynamic> json) => Country( | |
| 53 | + id: idValues.map[json["id"]]!, | |
| 54 | + value: valueValues.map[json["value"]]!, | |
| 55 | + ); | |
| 56 | + | |
| 57 | + Map<String, dynamic> toJson() => { | |
| 58 | + "id": idValues.reverse[id], | |
| 59 | + "value": valueValues.reverse[value], | |
| 60 | + }; | |
| 61 | +} | |
| 62 | + | |
| 63 | +enum Id { | |
| 64 | + IN, | |
| 65 | + SP_POP_TOTL | |
| 66 | +} | |
| 67 | + | |
| 68 | +final idValues = EnumValues({ | |
| 69 | + "IN": Id.IN, | |
| 70 | + "SP.POP.TOTL": Id.SP_POP_TOTL | |
| 71 | +}); | |
| 72 | + | |
| 73 | +enum Value { | |
| 74 | + INDIA, | |
| 75 | + POPULATION_TOTAL | |
| 76 | +} | |
| 77 | + | |
| 78 | +final valueValues = EnumValues({ | |
| 79 | + "India": Value.INDIA, | |
| 80 | + "Population, total": Value.POPULATION_TOTAL | |
| 81 | +}); | |
| 82 | + | |
| 83 | +class PurpleTopLevel { | |
| 84 | + final int page; | |
| 85 | + final int pages; | |
| 86 | + final String perPage; | |
| 87 | + final int total; | |
| 88 | + | |
| 89 | + PurpleTopLevel({ | |
| 90 | + required this.page, | |
| 91 | + required this.pages, | |
| 92 | + required this.perPage, | |
| 93 | + required this.total, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory PurpleTopLevel.fromJson(Map<String, dynamic> json) => PurpleTopLevel( | |
| 97 | + page: json["page"], | |
| 98 | + pages: json["pages"], | |
| 99 | + perPage: json["per_page"], | |
| 100 | + total: json["total"], | |
| 101 | + ); | |
| 102 | + | |
| 103 | + Map<String, dynamic> toJson() => { | |
| 104 | + "page": page, | |
| 105 | + "pages": pages, | |
| 106 | + "per_page": perPage, | |
| 107 | + "total": total, | |
| 108 | + }; | |
| 109 | +} | |
| 110 | + | |
| 111 | +class EnumValues<T> { | |
| 112 | + Map<String, T> map; | |
| 113 | + late Map<T, String> reverseMap; | |
| 114 | + | |
| 115 | + EnumValues(this.map); | |
| 116 | + | |
| 117 | + Map<T, String> get reverse { | |
| 118 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 119 | + return reverseMap; | |
| 120 | + } | |
| 121 | +} |
Test case
1 generated file · +75 −0test/inputs/json/misc/e64a0.json
Adartdefault / TopLevel.dart+75 −0
| @@ -0,0 +1,75 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Args args; | |
| 13 | + final Headers headers; | |
| 14 | + final String origin; | |
| 15 | + final String url; | |
| 16 | + | |
| 17 | + TopLevel({ | |
| 18 | + required this.args, | |
| 19 | + required this.headers, | |
| 20 | + required this.origin, | |
| 21 | + required this.url, | |
| 22 | + }); | |
| 23 | + | |
| 24 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 25 | + args: Args.fromJson(json["args"]), | |
| 26 | + headers: Headers.fromJson(json["headers"]), | |
| 27 | + origin: json["origin"], | |
| 28 | + url: json["url"], | |
| 29 | + ); | |
| 30 | + | |
| 31 | + Map<String, dynamic> toJson() => { | |
| 32 | + "args": args.toJson(), | |
| 33 | + "headers": headers.toJson(), | |
| 34 | + "origin": origin, | |
| 35 | + "url": url, | |
| 36 | + }; | |
| 37 | +} | |
| 38 | + | |
| 39 | +class Args { | |
| 40 | + Args(); | |
| 41 | + | |
| 42 | + factory Args.fromJson(Map<String, dynamic> json) => Args( | |
| 43 | + ); | |
| 44 | + | |
| 45 | + Map<String, dynamic> toJson() => { | |
| 46 | + }; | |
| 47 | +} | |
| 48 | + | |
| 49 | +class Headers { | |
| 50 | + final String acceptEncoding; | |
| 51 | + final String connection; | |
| 52 | + final String host; | |
| 53 | + final String userAgent; | |
| 54 | + | |
| 55 | + Headers({ | |
| 56 | + required this.acceptEncoding, | |
| 57 | + required this.connection, | |
| 58 | + required this.host, | |
| 59 | + required this.userAgent, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Headers.fromJson(Map<String, dynamic> json) => Headers( | |
| 63 | + acceptEncoding: json["Accept-Encoding"], | |
| 64 | + connection: json["Connection"], | |
| 65 | + host: json["Host"], | |
| 66 | + userAgent: json["User-Agent"], | |
| 67 | + ); | |
| 68 | + | |
| 69 | + Map<String, dynamic> toJson() => { | |
| 70 | + "Accept-Encoding": acceptEncoding, | |
| 71 | + "Connection": connection, | |
| 72 | + "Host": host, | |
| 73 | + "User-Agent": userAgent, | |
| 74 | + }; | |
| 75 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/e8a0b.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +995 −0test/inputs/json/misc/e8b04.json
Adartdefault / TopLevel.dart+995 −0
| @@ -0,0 +1,995 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int averageRating; | |
| 13 | + final String? category; | |
| 14 | + final int createdAt; | |
| 15 | + final String? description; | |
| 16 | + final DisplayType? displayType; | |
| 17 | + final int downloadCount; | |
| 18 | + final List<TopLevelFlag>? flags; | |
| 19 | + final List<Grant> grants; | |
| 20 | + final bool hideFromCatalog; | |
| 21 | + final bool hideFromDataJson; | |
| 22 | + final String id; | |
| 23 | + final int? indexUpdatedAt; | |
| 24 | + final String locale; | |
| 25 | + final TopLevelMetadata metadata; | |
| 26 | + final bool? moderationStatus; | |
| 27 | + final ModifyingViewUid? modifyingViewUid; | |
| 28 | + final String name; | |
| 29 | + final bool newBackend; | |
| 30 | + final int numberOfComments; | |
| 31 | + final int oid; | |
| 32 | + final Owner owner; | |
| 33 | + final Provenance provenance; | |
| 34 | + final bool publicationAppendEnabled; | |
| 35 | + final int? publicationDate; | |
| 36 | + final int publicationGroup; | |
| 37 | + final PublicationStage publicationStage; | |
| 38 | + final Ratings? ratings; | |
| 39 | + final String? resourceName; | |
| 40 | + final List<Right> rights; | |
| 41 | + final String? rowClass; | |
| 42 | + final int? rowIdentifierColumnId; | |
| 43 | + final int? rowsUpdatedAt; | |
| 44 | + final RowsUpdatedBy? rowsUpdatedBy; | |
| 45 | + final TableAuthor tableAuthor; | |
| 46 | + final int tableId; | |
| 47 | + final List<String>? tags; | |
| 48 | + final int totalTimesRated; | |
| 49 | + final int viewCount; | |
| 50 | + final int viewLastModified; | |
| 51 | + final ViewType viewType; | |
| 52 | + | |
| 53 | + TopLevel({ | |
| 54 | + required this.averageRating, | |
| 55 | + this.category, | |
| 56 | + required this.createdAt, | |
| 57 | + this.description, | |
| 58 | + this.displayType, | |
| 59 | + required this.downloadCount, | |
| 60 | + this.flags, | |
| 61 | + required this.grants, | |
| 62 | + required this.hideFromCatalog, | |
| 63 | + required this.hideFromDataJson, | |
| 64 | + required this.id, | |
| 65 | + this.indexUpdatedAt, | |
| 66 | + required this.locale, | |
| 67 | + required this.metadata, | |
| 68 | + this.moderationStatus, | |
| 69 | + this.modifyingViewUid, | |
| 70 | + required this.name, | |
| 71 | + required this.newBackend, | |
| 72 | + required this.numberOfComments, | |
| 73 | + required this.oid, | |
| 74 | + required this.owner, | |
| 75 | + required this.provenance, | |
| 76 | + required this.publicationAppendEnabled, | |
| 77 | + this.publicationDate, | |
| 78 | + required this.publicationGroup, | |
| 79 | + required this.publicationStage, | |
| 80 | + this.ratings, | |
| 81 | + this.resourceName, | |
| 82 | + required this.rights, | |
| 83 | + this.rowClass, | |
| 84 | + this.rowIdentifierColumnId, | |
| 85 | + this.rowsUpdatedAt, | |
| 86 | + this.rowsUpdatedBy, | |
| 87 | + required this.tableAuthor, | |
| 88 | + required this.tableId, | |
| 89 | + this.tags, | |
| 90 | + required this.totalTimesRated, | |
| 91 | + required this.viewCount, | |
| 92 | + required this.viewLastModified, | |
| 93 | + required this.viewType, | |
| 94 | + }); | |
| 95 | + | |
| 96 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 97 | + averageRating: json["averageRating"], | |
| 98 | + category: json["category"], | |
| 99 | + createdAt: json["createdAt"], | |
| 100 | + description: json["description"], | |
| 101 | + displayType: displayTypeValues.map[json["displayType"]], | |
| 102 | + downloadCount: json["downloadCount"], | |
| 103 | + flags: json["flags"] == null ? null : List<TopLevelFlag>.from(json["flags"]!.map((x) => topLevelFlagValues.map[x]!)), | |
| 104 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 105 | + hideFromCatalog: json["hideFromCatalog"], | |
| 106 | + hideFromDataJson: json["hideFromDataJson"], | |
| 107 | + id: json["id"], | |
| 108 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 109 | + locale: json["locale"], | |
| 110 | + metadata: TopLevelMetadata.fromJson(json["metadata"]), | |
| 111 | + moderationStatus: json["moderationStatus"], | |
| 112 | + modifyingViewUid: modifyingViewUidValues.map[json["modifyingViewUid"]], | |
| 113 | + name: json["name"], | |
| 114 | + newBackend: json["newBackend"], | |
| 115 | + numberOfComments: json["numberOfComments"], | |
| 116 | + oid: json["oid"], | |
| 117 | + owner: Owner.fromJson(json["owner"]), | |
| 118 | + provenance: provenanceValues.map[json["provenance"]]!, | |
| 119 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 120 | + publicationDate: json["publicationDate"], | |
| 121 | + publicationGroup: json["publicationGroup"], | |
| 122 | + publicationStage: publicationStageValues.map[json["publicationStage"]]!, | |
| 123 | + ratings: json["ratings"] == null ? null : Ratings.fromJson(json["ratings"]), | |
| 124 | + resourceName: json["resourceName"], | |
| 125 | + rights: List<Right>.from(json["rights"].map((x) => rightValues.map[x]!)), | |
| 126 | + rowClass: json["rowClass"], | |
| 127 | + rowIdentifierColumnId: json["rowIdentifierColumnId"], | |
| 128 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 129 | + rowsUpdatedBy: rowsUpdatedByValues.map[json["rowsUpdatedBy"]], | |
| 130 | + tableAuthor: TableAuthor.fromJson(json["tableAuthor"]), | |
| 131 | + tableId: json["tableId"], | |
| 132 | + tags: json["tags"] == null ? null : List<String>.from(json["tags"]!.map((x) => x)), | |
| 133 | + totalTimesRated: json["totalTimesRated"], | |
| 134 | + viewCount: json["viewCount"], | |
| 135 | + viewLastModified: json["viewLastModified"], | |
| 136 | + viewType: viewTypeValues.map[json["viewType"]]!, | |
| 137 | + ); | |
| 138 | + | |
| 139 | + Map<String, dynamic> toJson() => { | |
| 140 | + "averageRating": averageRating, | |
| 141 | + "category": category, | |
| 142 | + "createdAt": createdAt, | |
| 143 | + "description": description, | |
| 144 | + "displayType": displayTypeValues.reverse[displayType], | |
| 145 | + "downloadCount": downloadCount, | |
| 146 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => topLevelFlagValues.reverse[x])), | |
| 147 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 148 | + "hideFromCatalog": hideFromCatalog, | |
| 149 | + "hideFromDataJson": hideFromDataJson, | |
| 150 | + "id": id, | |
| 151 | + "indexUpdatedAt": indexUpdatedAt, | |
| 152 | + "locale": locale, | |
| 153 | + "metadata": metadata.toJson(), | |
| 154 | + "moderationStatus": moderationStatus, | |
| 155 | + "modifyingViewUid": modifyingViewUidValues.reverse[modifyingViewUid], | |
| 156 | + "name": name, | |
| 157 | + "newBackend": newBackend, | |
| 158 | + "numberOfComments": numberOfComments, | |
| 159 | + "oid": oid, | |
| 160 | + "owner": owner.toJson(), | |
| 161 | + "provenance": provenanceValues.reverse[provenance], | |
| 162 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 163 | + "publicationDate": publicationDate, | |
| 164 | + "publicationGroup": publicationGroup, | |
| 165 | + "publicationStage": publicationStageValues.reverse[publicationStage], | |
| 166 | + "ratings": ratings?.toJson(), | |
| 167 | + "resourceName": resourceName, | |
| 168 | + "rights": List<dynamic>.from(rights.map((x) => rightValues.reverse[x])), | |
| 169 | + "rowClass": rowClass, | |
| 170 | + "rowIdentifierColumnId": rowIdentifierColumnId, | |
| 171 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 172 | + "rowsUpdatedBy": rowsUpdatedByValues.reverse[rowsUpdatedBy], | |
| 173 | + "tableAuthor": tableAuthor.toJson(), | |
| 174 | + "tableId": tableId, | |
| 175 | + "tags": tags == null ? null : List<dynamic>.from(tags!.map((x) => x)), | |
| 176 | + "totalTimesRated": totalTimesRated, | |
| 177 | + "viewCount": viewCount, | |
| 178 | + "viewLastModified": viewLastModified, | |
| 179 | + "viewType": viewTypeValues.reverse[viewType], | |
| 180 | + }; | |
| 181 | +} | |
| 182 | + | |
| 183 | +enum DisplayType { | |
| 184 | + TABLE, | |
| 185 | + DATA_LENS, | |
| 186 | + FATROW, | |
| 187 | + PAGE | |
| 188 | +} | |
| 189 | + | |
| 190 | +final displayTypeValues = EnumValues({ | |
| 191 | + "table": DisplayType.TABLE, | |
| 192 | + "data_lens": DisplayType.DATA_LENS, | |
| 193 | + "fatrow": DisplayType.FATROW, | |
| 194 | + "page": DisplayType.PAGE | |
| 195 | +}); | |
| 196 | + | |
| 197 | +enum TopLevelFlag { | |
| 198 | + DEFAULT, | |
| 199 | + RESTORABLE, | |
| 200 | + RESTORE_POSSIBLE_FOR_TYPE | |
| 201 | +} | |
| 202 | + | |
| 203 | +final topLevelFlagValues = EnumValues({ | |
| 204 | + "default": TopLevelFlag.DEFAULT, | |
| 205 | + "restorable": TopLevelFlag.RESTORABLE, | |
| 206 | + "restorePossibleForType": TopLevelFlag.RESTORE_POSSIBLE_FOR_TYPE | |
| 207 | +}); | |
| 208 | + | |
| 209 | +class Grant { | |
| 210 | + final List<GrantFlag> flags; | |
| 211 | + final bool inherited; | |
| 212 | + final GrantType type; | |
| 213 | + | |
| 214 | + Grant({ | |
| 215 | + required this.flags, | |
| 216 | + required this.inherited, | |
| 217 | + required this.type, | |
| 218 | + }); | |
| 219 | + | |
| 220 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 221 | + flags: List<GrantFlag>.from(json["flags"].map((x) => grantFlagValues.map[x]!)), | |
| 222 | + inherited: json["inherited"], | |
| 223 | + type: grantTypeValues.map[json["type"]]!, | |
| 224 | + ); | |
| 225 | + | |
| 226 | + Map<String, dynamic> toJson() => { | |
| 227 | + "flags": List<dynamic>.from(flags.map((x) => grantFlagValues.reverse[x])), | |
| 228 | + "inherited": inherited, | |
| 229 | + "type": grantTypeValues.reverse[type], | |
| 230 | + }; | |
| 231 | +} | |
| 232 | + | |
| 233 | +enum GrantFlag { | |
| 234 | + PUBLIC | |
| 235 | +} | |
| 236 | + | |
| 237 | +final grantFlagValues = EnumValues({ | |
| 238 | + "public": GrantFlag.PUBLIC | |
| 239 | +}); | |
| 240 | + | |
| 241 | +enum GrantType { | |
| 242 | + VIEWER | |
| 243 | +} | |
| 244 | + | |
| 245 | +final grantTypeValues = EnumValues({ | |
| 246 | + "viewer": GrantType.VIEWER | |
| 247 | +}); | |
| 248 | + | |
| 249 | +class TopLevelMetadata { | |
| 250 | + final List<DisplayType>? availableDisplayTypes; | |
| 251 | + final CustomFields? customFields; | |
| 252 | + final JsonQuery? jsonQuery; | |
| 253 | + final String? rdfClass; | |
| 254 | + final String? rdfSubject; | |
| 255 | + final MetadataRenderTypeConfig? renderTypeConfig; | |
| 256 | + final RichRendererConfigs? richRendererConfigs; | |
| 257 | + final String? rowIdentifier; | |
| 258 | + final String? rowLabel; | |
| 259 | + final V1ArchivedProperties? v1ArchivedProperties; | |
| 260 | + | |
| 261 | + TopLevelMetadata({ | |
| 262 | + this.availableDisplayTypes, | |
| 263 | + this.customFields, | |
| 264 | + this.jsonQuery, | |
| 265 | + this.rdfClass, | |
| 266 | + this.rdfSubject, | |
| 267 | + this.renderTypeConfig, | |
| 268 | + this.richRendererConfigs, | |
| 269 | + this.rowIdentifier, | |
| 270 | + this.rowLabel, | |
| 271 | + this.v1ArchivedProperties, | |
| 272 | + }); | |
| 273 | + | |
| 274 | + factory TopLevelMetadata.fromJson(Map<String, dynamic> json) => TopLevelMetadata( | |
| 275 | + availableDisplayTypes: json["availableDisplayTypes"] == null ? null : List<DisplayType>.from(json["availableDisplayTypes"]!.map((x) => displayTypeValues.map[x]!)), | |
| 276 | + customFields: json["custom_fields"] == null ? null : CustomFields.fromJson(json["custom_fields"]), | |
| 277 | + jsonQuery: json["jsonQuery"] == null ? null : JsonQuery.fromJson(json["jsonQuery"]), | |
| 278 | + rdfClass: json["rdfClass"], | |
| 279 | + rdfSubject: json["rdfSubject"], | |
| 280 | + renderTypeConfig: json["renderTypeConfig"] == null ? null : MetadataRenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 281 | + richRendererConfigs: json["richRendererConfigs"] == null ? null : RichRendererConfigs.fromJson(json["richRendererConfigs"]), | |
| 282 | + rowIdentifier: json["rowIdentifier"], | |
| 283 | + rowLabel: json["rowLabel"], | |
| 284 | + v1ArchivedProperties: json["v1_archived_properties"] == null ? null : V1ArchivedProperties.fromJson(json["v1_archived_properties"]), | |
| 285 | + ); | |
| 286 | + | |
| 287 | + Map<String, dynamic> toJson() => { | |
| 288 | + "availableDisplayTypes": availableDisplayTypes == null ? null : List<dynamic>.from(availableDisplayTypes!.map((x) => displayTypeValues.reverse[x])), | |
| 289 | + "custom_fields": customFields?.toJson(), | |
| 290 | + "jsonQuery": jsonQuery?.toJson(), | |
| 291 | + "rdfClass": rdfClass, | |
| 292 | + "rdfSubject": rdfSubject, | |
| 293 | + "renderTypeConfig": renderTypeConfig?.toJson(), | |
| 294 | + "richRendererConfigs": richRendererConfigs?.toJson(), | |
| 295 | + "rowIdentifier": rowIdentifier, | |
| 296 | + "rowLabel": rowLabel, | |
| 297 | + "v1_archived_properties": v1ArchivedProperties?.toJson(), | |
| 298 | + }; | |
| 299 | +} | |
| 300 | + | |
| 301 | +class CustomFields { | |
| 302 | + final Test test; | |
| 303 | + | |
| 304 | + CustomFields({ | |
| 305 | + required this.test, | |
| 306 | + }); | |
| 307 | + | |
| 308 | + factory CustomFields.fromJson(Map<String, dynamic> json) => CustomFields( | |
| 309 | + test: Test.fromJson(json["TEST"]), | |
| 310 | + ); | |
| 311 | + | |
| 312 | + Map<String, dynamic> toJson() => { | |
| 313 | + "TEST": test.toJson(), | |
| 314 | + }; | |
| 315 | +} | |
| 316 | + | |
| 317 | +class Test { | |
| 318 | + final String cfpb1; | |
| 319 | + | |
| 320 | + Test({ | |
| 321 | + required this.cfpb1, | |
| 322 | + }); | |
| 323 | + | |
| 324 | + factory Test.fromJson(Map<String, dynamic> json) => Test( | |
| 325 | + cfpb1: json["CFPB1"], | |
| 326 | + ); | |
| 327 | + | |
| 328 | + Map<String, dynamic> toJson() => { | |
| 329 | + "CFPB1": cfpb1, | |
| 330 | + }; | |
| 331 | +} | |
| 332 | + | |
| 333 | +class JsonQuery { | |
| 334 | + final List<Group>? group; | |
| 335 | + final List<Order>? order; | |
| 336 | + final List<Select>? select; | |
| 337 | + final Where? where; | |
| 338 | + | |
| 339 | + JsonQuery({ | |
| 340 | + this.group, | |
| 341 | + this.order, | |
| 342 | + this.select, | |
| 343 | + this.where, | |
| 344 | + }); | |
| 345 | + | |
| 346 | + factory JsonQuery.fromJson(Map<String, dynamic> json) => JsonQuery( | |
| 347 | + group: json["group"] == null ? null : List<Group>.from(json["group"]!.map((x) => Group.fromJson(x))), | |
| 348 | + order: json["order"] == null ? null : List<Order>.from(json["order"]!.map((x) => Order.fromJson(x))), | |
| 349 | + select: json["select"] == null ? null : List<Select>.from(json["select"]!.map((x) => Select.fromJson(x))), | |
| 350 | + where: json["where"] == null ? null : Where.fromJson(json["where"]), | |
| 351 | + ); | |
| 352 | + | |
| 353 | + Map<String, dynamic> toJson() => { | |
| 354 | + "group": group == null ? null : List<dynamic>.from(group!.map((x) => x.toJson())), | |
| 355 | + "order": order == null ? null : List<dynamic>.from(order!.map((x) => x.toJson())), | |
| 356 | + "select": select == null ? null : List<dynamic>.from(select!.map((x) => x.toJson())), | |
| 357 | + "where": where?.toJson(), | |
| 358 | + }; | |
| 359 | +} | |
| 360 | + | |
| 361 | +class Group { | |
| 362 | + final String columnFieldName; | |
| 363 | + | |
| 364 | + Group({ | |
| 365 | + required this.columnFieldName, | |
| 366 | + }); | |
| 367 | + | |
| 368 | + factory Group.fromJson(Map<String, dynamic> json) => Group( | |
| 369 | + columnFieldName: json["columnFieldName"], | |
| 370 | + ); | |
| 371 | + | |
| 372 | + Map<String, dynamic> toJson() => { | |
| 373 | + "columnFieldName": columnFieldName, | |
| 374 | + }; | |
| 375 | +} | |
| 376 | + | |
| 377 | +class Order { | |
| 378 | + final bool ascending; | |
| 379 | + final OrderColumnFieldName columnFieldName; | |
| 380 | + | |
| 381 | + Order({ | |
| 382 | + required this.ascending, | |
| 383 | + required this.columnFieldName, | |
| 384 | + }); | |
| 385 | + | |
| 386 | + factory Order.fromJson(Map<String, dynamic> json) => Order( | |
| 387 | + ascending: json["ascending"], | |
| 388 | + columnFieldName: orderColumnFieldNameValues.map[json["columnFieldName"]]!, | |
| 389 | + ); | |
| 390 | + | |
| 391 | + Map<String, dynamic> toJson() => { | |
| 392 | + "ascending": ascending, | |
| 393 | + "columnFieldName": orderColumnFieldNameValues.reverse[columnFieldName], | |
| 394 | + }; | |
| 395 | +} | |
| 396 | + | |
| 397 | +enum OrderColumnFieldName { | |
| 398 | + DATE_RECEIVED, | |
| 399 | + AGREEMENT_DATE, | |
| 400 | + IN_EFFECT_AS_OF_112012 | |
| 401 | +} | |
| 402 | + | |
| 403 | +final orderColumnFieldNameValues = EnumValues({ | |
| 404 | + "date_received": OrderColumnFieldName.DATE_RECEIVED, | |
| 405 | + "agreement_date": OrderColumnFieldName.AGREEMENT_DATE, | |
| 406 | + "in_effect_as_of_1_1_2012": OrderColumnFieldName.IN_EFFECT_AS_OF_112012 | |
| 407 | +}); | |
| 408 | + | |
| 409 | +class Select { | |
| 410 | + final String? aggregate; | |
| 411 | + final String columnFieldName; | |
| 412 | + | |
| 413 | + Select({ | |
| 414 | + this.aggregate, | |
| 415 | + required this.columnFieldName, | |
| 416 | + }); | |
| 417 | + | |
| 418 | + factory Select.fromJson(Map<String, dynamic> json) => Select( | |
| 419 | + aggregate: json["aggregate"], | |
| 420 | + columnFieldName: json["columnFieldName"], | |
| 421 | + ); | |
| 422 | + | |
| 423 | + Map<String, dynamic> toJson() => { | |
| 424 | + "aggregate": aggregate, | |
| 425 | + "columnFieldName": columnFieldName, | |
| 426 | + }; | |
| 427 | +} | |
| 428 | + | |
| 429 | +class Where { | |
| 430 | + final List<Child>? children; | |
| 431 | + final ChildColumnFieldName? columnFieldName; | |
| 432 | + final ChildMetadata? metadata; | |
| 433 | + final String? value; | |
| 434 | + final WhereOperator whereOperator; | |
| 435 | + | |
| 436 | + Where({ | |
| 437 | + this.children, | |
| 438 | + this.columnFieldName, | |
| 439 | + this.metadata, | |
| 440 | + this.value, | |
| 441 | + required this.whereOperator, | |
| 442 | + }); | |
| 443 | + | |
| 444 | + factory Where.fromJson(Map<String, dynamic> json) => Where( | |
| 445 | + children: json["children"] == null ? null : List<Child>.from(json["children"]!.map((x) => Child.fromJson(x))), | |
| 446 | + columnFieldName: childColumnFieldNameValues.map[json["columnFieldName"]], | |
| 447 | + metadata: json["metadata"] == null ? null : ChildMetadata.fromJson(json["metadata"]), | |
| 448 | + value: json["value"], | |
| 449 | + whereOperator: whereOperatorValues.map[json["operator"]]!, | |
| 450 | + ); | |
| 451 | + | |
| 452 | + Map<String, dynamic> toJson() => { | |
| 453 | + "children": children == null ? null : List<dynamic>.from(children!.map((x) => x.toJson())), | |
| 454 | + "columnFieldName": childColumnFieldNameValues.reverse[columnFieldName], | |
| 455 | + "metadata": metadata?.toJson(), | |
| 456 | + "value": value, | |
| 457 | + "operator": whereOperatorValues.reverse[whereOperator], | |
| 458 | + }; | |
| 459 | +} | |
| 460 | + | |
| 461 | +class Child { | |
| 462 | + final ChildOperator childOperator; | |
| 463 | + final ChildColumnFieldName columnFieldName; | |
| 464 | + final ChildMetadata? metadata; | |
| 465 | + final String? value; | |
| 466 | + | |
| 467 | + Child({ | |
| 468 | + required this.childOperator, | |
| 469 | + required this.columnFieldName, | |
| 470 | + this.metadata, | |
| 471 | + this.value, | |
| 472 | + }); | |
| 473 | + | |
| 474 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 475 | + childOperator: childOperatorValues.map[json["operator"]]!, | |
| 476 | + columnFieldName: childColumnFieldNameValues.map[json["columnFieldName"]]!, | |
| 477 | + metadata: json["metadata"] == null ? null : ChildMetadata.fromJson(json["metadata"]), | |
| 478 | + value: json["value"], | |
| 479 | + ); | |
| 480 | + | |
| 481 | + Map<String, dynamic> toJson() => { | |
| 482 | + "operator": childOperatorValues.reverse[childOperator], | |
| 483 | + "columnFieldName": childColumnFieldNameValues.reverse[columnFieldName], | |
| 484 | + "metadata": metadata?.toJson(), | |
| 485 | + "value": value, | |
| 486 | + }; | |
| 487 | +} | |
| 488 | + | |
| 489 | +enum ChildOperator { | |
| 490 | + EQUALS, | |
| 491 | + IS_NOT_BLANK | |
| 492 | +} | |
| 493 | + | |
| 494 | +final childOperatorValues = EnumValues({ | |
| 495 | + "EQUALS": ChildOperator.EQUALS, | |
| 496 | + "IS_NOT_BLANK": ChildOperator.IS_NOT_BLANK | |
| 497 | +}); | |
| 498 | + | |
| 499 | +enum ChildColumnFieldName { | |
| 500 | + PRODUCT, | |
| 501 | + COMPLAINT_WHAT_HAPPENED, | |
| 502 | + SUB_PRODUCT, | |
| 503 | + ISSUE | |
| 504 | +} | |
| 505 | + | |
| 506 | +final childColumnFieldNameValues = EnumValues({ | |
| 507 | + "product": ChildColumnFieldName.PRODUCT, | |
| 508 | + "complaint_what_happened": ChildColumnFieldName.COMPLAINT_WHAT_HAPPENED, | |
| 509 | + "sub_product": ChildColumnFieldName.SUB_PRODUCT, | |
| 510 | + "issue": ChildColumnFieldName.ISSUE | |
| 511 | +}); | |
| 512 | + | |
| 513 | +class ChildMetadata { | |
| 514 | + final List<String>? customValues; | |
| 515 | + final bool? freeform; | |
| 516 | + final int? includeAuto; | |
| 517 | + final MetadataOperator? metadataOperator; | |
| 518 | + final TableColumnId? tableColumnId; | |
| 519 | + final int? unifiedVersion; | |
| 520 | + | |
| 521 | + ChildMetadata({ | |
| 522 | + this.customValues, | |
| 523 | + this.freeform, | |
| 524 | + this.includeAuto, | |
| 525 | + this.metadataOperator, | |
| 526 | + this.tableColumnId, | |
| 527 | + this.unifiedVersion, | |
| 528 | + }); | |
| 529 | + | |
| 530 | + factory ChildMetadata.fromJson(Map<String, dynamic> json) => ChildMetadata( | |
| 531 | + customValues: json["customValues"] == null ? null : List<String>.from(json["customValues"]!.map((x) => x)), | |
| 532 | + freeform: json["freeform"], | |
| 533 | + includeAuto: json["includeAuto"], | |
| 534 | + metadataOperator: metadataOperatorValues.map[json["operator"]], | |
| 535 | + tableColumnId: json["tableColumnId"] == null ? null : TableColumnId.fromJson(json["tableColumnId"]), | |
| 536 | + unifiedVersion: json["unifiedVersion"], | |
| 537 | + ); | |
| 538 | + | |
| 539 | + Map<String, dynamic> toJson() => { | |
| 540 | + "customValues": customValues == null ? null : List<dynamic>.from(customValues!.map((x) => x)), | |
| 541 | + "freeform": freeform, | |
| 542 | + "includeAuto": includeAuto, | |
| 543 | + "operator": metadataOperatorValues.reverse[metadataOperator], | |
| 544 | + "tableColumnId": tableColumnId?.toJson(), | |
| 545 | + "unifiedVersion": unifiedVersion, | |
| 546 | + }; | |
| 547 | +} | |
| 548 | + | |
| 549 | +enum MetadataOperator { | |
| 550 | + EQUALS, | |
| 551 | + BLANK | |
| 552 | +} | |
| 553 | + | |
| 554 | +final metadataOperatorValues = EnumValues({ | |
| 555 | + "EQUALS": MetadataOperator.EQUALS, | |
| 556 | + "blank?": MetadataOperator.BLANK | |
| 557 | +}); | |
| 558 | + | |
| 559 | +class TableColumnId { | |
| 560 | + final int the2819740; | |
| 561 | + | |
| 562 | + TableColumnId({ | |
| 563 | + required this.the2819740, | |
| 564 | + }); | |
| 565 | + | |
| 566 | + factory TableColumnId.fromJson(Map<String, dynamic> json) => TableColumnId( | |
| 567 | + the2819740: json["2819740"], | |
| 568 | + ); | |
| 569 | + | |
| 570 | + Map<String, dynamic> toJson() => { | |
| 571 | + "2819740": the2819740, | |
| 572 | + }; | |
| 573 | +} | |
| 574 | + | |
| 575 | +enum WhereOperator { | |
| 576 | + EQUALS, | |
| 577 | + AND | |
| 578 | +} | |
| 579 | + | |
| 580 | +final whereOperatorValues = EnumValues({ | |
| 581 | + "EQUALS": WhereOperator.EQUALS, | |
| 582 | + "AND": WhereOperator.AND | |
| 583 | +}); | |
| 584 | + | |
| 585 | +class MetadataRenderTypeConfig { | |
| 586 | + final PurpleVisible visible; | |
| 587 | + | |
| 588 | + MetadataRenderTypeConfig({ | |
| 589 | + required this.visible, | |
| 590 | + }); | |
| 591 | + | |
| 592 | + factory MetadataRenderTypeConfig.fromJson(Map<String, dynamic> json) => MetadataRenderTypeConfig( | |
| 593 | + visible: PurpleVisible.fromJson(json["visible"]), | |
| 594 | + ); | |
| 595 | + | |
| 596 | + Map<String, dynamic> toJson() => { | |
| 597 | + "visible": visible.toJson(), | |
| 598 | + }; | |
| 599 | +} | |
| 600 | + | |
| 601 | +class PurpleVisible { | |
| 602 | + final bool? fatrow; | |
| 603 | + final bool? table; | |
| 604 | + | |
| 605 | + PurpleVisible({ | |
| 606 | + this.fatrow, | |
| 607 | + this.table, | |
| 608 | + }); | |
| 609 | + | |
| 610 | + factory PurpleVisible.fromJson(Map<String, dynamic> json) => PurpleVisible( | |
| 611 | + fatrow: json["fatrow"], | |
| 612 | + table: json["table"], | |
| 613 | + ); | |
| 614 | + | |
| 615 | + Map<String, dynamic> toJson() => { | |
| 616 | + "fatrow": fatrow, | |
| 617 | + "table": table, | |
| 618 | + }; | |
| 619 | +} | |
| 620 | + | |
| 621 | +class RichRendererConfigs { | |
| 622 | + final FatRow fatRow; | |
| 623 | + | |
| 624 | + RichRendererConfigs({ | |
| 625 | + required this.fatRow, | |
| 626 | + }); | |
| 627 | + | |
| 628 | + factory RichRendererConfigs.fromJson(Map<String, dynamic> json) => RichRendererConfigs( | |
| 629 | + fatRow: FatRow.fromJson(json["fatRow"]), | |
| 630 | + ); | |
| 631 | + | |
| 632 | + Map<String, dynamic> toJson() => { | |
| 633 | + "fatRow": fatRow.toJson(), | |
| 634 | + }; | |
| 635 | +} | |
| 636 | + | |
| 637 | +class FatRow { | |
| 638 | + final List<Column> columns; | |
| 639 | + | |
| 640 | + FatRow({ | |
| 641 | + required this.columns, | |
| 642 | + }); | |
| 643 | + | |
| 644 | + factory FatRow.fromJson(Map<String, dynamic> json) => FatRow( | |
| 645 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 646 | + ); | |
| 647 | + | |
| 648 | + Map<String, dynamic> toJson() => { | |
| 649 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 650 | + }; | |
| 651 | +} | |
| 652 | + | |
| 653 | +class Column { | |
| 654 | + final List<Row> rows; | |
| 655 | + final Styles styles; | |
| 656 | + | |
| 657 | + Column({ | |
| 658 | + required this.rows, | |
| 659 | + required this.styles, | |
| 660 | + }); | |
| 661 | + | |
| 662 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 663 | + rows: List<Row>.from(json["rows"].map((x) => Row.fromJson(x))), | |
| 664 | + styles: Styles.fromJson(json["styles"]), | |
| 665 | + ); | |
| 666 | + | |
| 667 | + Map<String, dynamic> toJson() => { | |
| 668 | + "rows": List<dynamic>.from(rows.map((x) => x.toJson())), | |
| 669 | + "styles": styles.toJson(), | |
| 670 | + }; | |
| 671 | +} | |
| 672 | + | |
| 673 | +class Row { | |
| 674 | + final List<Field> fields; | |
| 675 | + | |
| 676 | + Row({ | |
| 677 | + required this.fields, | |
| 678 | + }); | |
| 679 | + | |
| 680 | + factory Row.fromJson(Map<String, dynamic> json) => Row( | |
| 681 | + fields: List<Field>.from(json["fields"].map((x) => Field.fromJson(x))), | |
| 682 | + ); | |
| 683 | + | |
| 684 | + Map<String, dynamic> toJson() => { | |
| 685 | + "fields": List<dynamic>.from(fields.map((x) => x.toJson())), | |
| 686 | + }; | |
| 687 | +} | |
| 688 | + | |
| 689 | +class Field { | |
| 690 | + final int tableColumnId; | |
| 691 | + final FieldType type; | |
| 692 | + | |
| 693 | + Field({ | |
| 694 | + required this.tableColumnId, | |
| 695 | + required this.type, | |
| 696 | + }); | |
| 697 | + | |
| 698 | + factory Field.fromJson(Map<String, dynamic> json) => Field( | |
| 699 | + tableColumnId: json["tableColumnId"], | |
| 700 | + type: fieldTypeValues.map[json["type"]]!, | |
| 701 | + ); | |
| 702 | + | |
| 703 | + Map<String, dynamic> toJson() => { | |
| 704 | + "tableColumnId": tableColumnId, | |
| 705 | + "type": fieldTypeValues.reverse[type], | |
| 706 | + }; | |
| 707 | +} | |
| 708 | + | |
| 709 | +enum FieldType { | |
| 710 | + COLUMN_LABEL, | |
| 711 | + COLUMN_DATA | |
| 712 | +} | |
| 713 | + | |
| 714 | +final fieldTypeValues = EnumValues({ | |
| 715 | + "columnLabel": FieldType.COLUMN_LABEL, | |
| 716 | + "columnData": FieldType.COLUMN_DATA | |
| 717 | +}); | |
| 718 | + | |
| 719 | +class Styles { | |
| 720 | + final Width width; | |
| 721 | + | |
| 722 | + Styles({ | |
| 723 | + required this.width, | |
| 724 | + }); | |
| 725 | + | |
| 726 | + factory Styles.fromJson(Map<String, dynamic> json) => Styles( | |
| 727 | + width: widthValues.map[json["width"]]!, | |
| 728 | + ); | |
| 729 | + | |
| 730 | + Map<String, dynamic> toJson() => { | |
| 731 | + "width": widthValues.reverse[width], | |
| 732 | + }; | |
| 733 | +} | |
| 734 | + | |
| 735 | +enum Width { | |
| 736 | + THE_27, | |
| 737 | + THE_40, | |
| 738 | + THE_30, | |
| 739 | + THE_33 | |
| 740 | +} | |
| 741 | + | |
| 742 | +final widthValues = EnumValues({ | |
| 743 | + "27%": Width.THE_27, | |
| 744 | + "40%": Width.THE_40, | |
| 745 | + "30%": Width.THE_30, | |
| 746 | + "33%": Width.THE_33 | |
| 747 | +}); | |
| 748 | + | |
| 749 | +class V1ArchivedProperties { | |
| 750 | + final AccessPoints accessPoints; | |
| 751 | + final String blistId; | |
| 752 | + final V1ArchivedPropertiesRenderTypeConfig renderTypeConfig; | |
| 753 | + | |
| 754 | + V1ArchivedProperties({ | |
| 755 | + required this.accessPoints, | |
| 756 | + required this.blistId, | |
| 757 | + required this.renderTypeConfig, | |
| 758 | + }); | |
| 759 | + | |
| 760 | + factory V1ArchivedProperties.fromJson(Map<String, dynamic> json) => V1ArchivedProperties( | |
| 761 | + accessPoints: AccessPoints.fromJson(json["accessPoints"]), | |
| 762 | + blistId: json["blist_id"], | |
| 763 | + renderTypeConfig: V1ArchivedPropertiesRenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 764 | + ); | |
| 765 | + | |
| 766 | + Map<String, dynamic> toJson() => { | |
| 767 | + "accessPoints": accessPoints.toJson(), | |
| 768 | + "blist_id": blistId, | |
| 769 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 770 | + }; | |
| 771 | +} | |
| 772 | + | |
| 773 | +class AccessPoints { | |
| 774 | + final String newView; | |
| 775 | + | |
| 776 | + AccessPoints({ | |
| 777 | + required this.newView, | |
| 778 | + }); | |
| 779 | + | |
| 780 | + factory AccessPoints.fromJson(Map<String, dynamic> json) => AccessPoints( | |
| 781 | + newView: json["new_view"], | |
| 782 | + ); | |
| 783 | + | |
| 784 | + Map<String, dynamic> toJson() => { | |
| 785 | + "new_view": newView, | |
| 786 | + }; | |
| 787 | +} | |
| 788 | + | |
| 789 | +class V1ArchivedPropertiesRenderTypeConfig { | |
| 790 | + final FluffyVisible visible; | |
| 791 | + | |
| 792 | + V1ArchivedPropertiesRenderTypeConfig({ | |
| 793 | + required this.visible, | |
| 794 | + }); | |
| 795 | + | |
| 796 | + factory V1ArchivedPropertiesRenderTypeConfig.fromJson(Map<String, dynamic> json) => V1ArchivedPropertiesRenderTypeConfig( | |
| 797 | + visible: FluffyVisible.fromJson(json["visible"]), | |
| 798 | + ); | |
| 799 | + | |
| 800 | + Map<String, dynamic> toJson() => { | |
| 801 | + "visible": visible.toJson(), | |
| 802 | + }; | |
| 803 | +} | |
| 804 | + | |
| 805 | +class FluffyVisible { | |
| 806 | + final bool href; | |
| 807 | + | |
| 808 | + FluffyVisible({ | |
| 809 | + required this.href, | |
| 810 | + }); | |
| 811 | + | |
| 812 | + factory FluffyVisible.fromJson(Map<String, dynamic> json) => FluffyVisible( | |
| 813 | + href: json["href"], | |
| 814 | + ); | |
| 815 | + | |
| 816 | + Map<String, dynamic> toJson() => { | |
| 817 | + "href": href, | |
| 818 | + }; | |
| 819 | +} | |
| 820 | + | |
| 821 | +enum ModifyingViewUid { | |
| 822 | + S6_EW_H6_MP | |
| 823 | +} | |
| 824 | + | |
| 825 | +final modifyingViewUidValues = EnumValues({ | |
| 826 | + "s6ew-h6mp": ModifyingViewUid.S6_EW_H6_MP | |
| 827 | +}); | |
| 828 | + | |
| 829 | +class Owner { | |
| 830 | + final String displayName; | |
| 831 | + final List<String>? flags; | |
| 832 | + final String id; | |
| 833 | + final int? lastNotificationSeenAt; | |
| 834 | + final String? profileImageUrlLarge; | |
| 835 | + final String? profileImageUrlMedium; | |
| 836 | + final String? profileImageUrlSmall; | |
| 837 | + final List<String>? rights; | |
| 838 | + final RoleName? roleName; | |
| 839 | + final String screenName; | |
| 840 | + | |
| 841 | + Owner({ | |
| 842 | + required this.displayName, | |
| 843 | + this.flags, | |
| 844 | + required this.id, | |
| 845 | + this.lastNotificationSeenAt, | |
| 846 | + this.profileImageUrlLarge, | |
| 847 | + this.profileImageUrlMedium, | |
| 848 | + this.profileImageUrlSmall, | |
| 849 | + this.rights, | |
| 850 | + this.roleName, | |
| 851 | + required this.screenName, | |
| 852 | + }); | |
| 853 | + | |
| 854 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 855 | + displayName: json["displayName"], | |
| 856 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 857 | + id: json["id"], | |
| 858 | + lastNotificationSeenAt: json["lastNotificationSeenAt"], | |
| 859 | + profileImageUrlLarge: json["profileImageUrlLarge"], | |
| 860 | + profileImageUrlMedium: json["profileImageUrlMedium"], | |
| 861 | + profileImageUrlSmall: json["profileImageUrlSmall"], | |
| 862 | + rights: json["rights"] == null ? null : List<String>.from(json["rights"]!.map((x) => x)), | |
| 863 | + roleName: roleNameValues.map[json["roleName"]], | |
| 864 | + screenName: json["screenName"], | |
| 865 | + ); | |
| 866 | + | |
| 867 | + Map<String, dynamic> toJson() => { | |
| 868 | + "displayName": displayName, | |
| 869 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 870 | + "id": id, | |
| 871 | + "lastNotificationSeenAt": lastNotificationSeenAt, | |
| 872 | + "profileImageUrlLarge": profileImageUrlLarge, | |
| 873 | + "profileImageUrlMedium": profileImageUrlMedium, | |
| 874 | + "profileImageUrlSmall": profileImageUrlSmall, | |
| 875 | + "rights": rights == null ? null : List<dynamic>.from(rights!.map((x) => x)), | |
| 876 | + "roleName": roleNameValues.reverse[roleName], | |
| 877 | + "screenName": screenName, | |
| 878 | + }; | |
| 879 | +} | |
| 880 | + | |
| 881 | +enum RoleName { | |
| 882 | + ADMINISTRATOR, | |
| 883 | + PUBLISHER | |
| 884 | +} | |
| 885 | + | |
| 886 | +final roleNameValues = EnumValues({ | |
| 887 | + "administrator": RoleName.ADMINISTRATOR, | |
| 888 | + "publisher": RoleName.PUBLISHER | |
| 889 | +}); | |
| 890 | + | |
| 891 | +enum Provenance { | |
| 892 | + OFFICIAL | |
| 893 | +} | |
| 894 | + | |
| 895 | +final provenanceValues = EnumValues({ | |
| 896 | + "official": Provenance.OFFICIAL | |
| 897 | +}); | |
| 898 | + | |
| 899 | +enum PublicationStage { | |
| 900 | + PUBLISHED | |
| 901 | +} | |
| 902 | + | |
| 903 | +final publicationStageValues = EnumValues({ | |
| 904 | + "published": PublicationStage.PUBLISHED | |
| 905 | +}); | |
| 906 | + | |
| 907 | +class Ratings { | |
| 908 | + final int rating; | |
| 909 | + | |
| 910 | + Ratings({ | |
| 911 | + required this.rating, | |
| 912 | + }); | |
| 913 | + | |
| 914 | + factory Ratings.fromJson(Map<String, dynamic> json) => Ratings( | |
| 915 | + rating: json["rating"], | |
| 916 | + ); | |
| 917 | + | |
| 918 | + Map<String, dynamic> toJson() => { | |
| 919 | + "rating": rating, | |
| 920 | + }; | |
| 921 | +} | |
| 922 | + | |
| 923 | +enum Right { | |
| 924 | + READ | |
| 925 | +} | |
| 926 | + | |
| 927 | +final rightValues = EnumValues({ | |
| 928 | + "read": Right.READ | |
| 929 | +}); | |
| 930 | + | |
| 931 | +enum RowsUpdatedBy { | |
| 932 | + PJXG_VE4_M, | |
| 933 | + THE_54_A3_QYUN, | |
| 934 | + THE_9_E3_M_2843, | |
| 935 | + VVCA_FR6_G | |
| 936 | +} | |
| 937 | + | |
| 938 | +final rowsUpdatedByValues = EnumValues({ | |
| 939 | + "pjxg-ve4m": RowsUpdatedBy.PJXG_VE4_M, | |
| 940 | + "54a3-qyun": RowsUpdatedBy.THE_54_A3_QYUN, | |
| 941 | + "9e3m-2843": RowsUpdatedBy.THE_9_E3_M_2843, | |
| 942 | + "vvca-fr6g": RowsUpdatedBy.VVCA_FR6_G | |
| 943 | +}); | |
| 944 | + | |
| 945 | +class TableAuthor { | |
| 946 | + final String displayName; | |
| 947 | + final String id; | |
| 948 | + final List<String>? rights; | |
| 949 | + final RoleName? roleName; | |
| 950 | + final String screenName; | |
| 951 | + | |
| 952 | + TableAuthor({ | |
| 953 | + required this.displayName, | |
| 954 | + required this.id, | |
| 955 | + this.rights, | |
| 956 | + this.roleName, | |
| 957 | + required this.screenName, | |
| 958 | + }); | |
| 959 | + | |
| 960 | + factory TableAuthor.fromJson(Map<String, dynamic> json) => TableAuthor( | |
| 961 | + displayName: json["displayName"], | |
| 962 | + id: json["id"], | |
| 963 | + rights: json["rights"] == null ? null : List<String>.from(json["rights"]!.map((x) => x)), | |
| 964 | + roleName: roleNameValues.map[json["roleName"]], | |
| 965 | + screenName: json["screenName"], | |
| 966 | + ); | |
| 967 | + | |
| 968 | + Map<String, dynamic> toJson() => { | |
| 969 | + "displayName": displayName, | |
| 970 | + "id": id, | |
| 971 | + "rights": rights == null ? null : List<dynamic>.from(rights!.map((x) => x)), | |
| 972 | + "roleName": roleNameValues.reverse[roleName], | |
| 973 | + "screenName": screenName, | |
| 974 | + }; | |
| 975 | +} | |
| 976 | + | |
| 977 | +enum ViewType { | |
| 978 | + TABULAR | |
| 979 | +} | |
| 980 | + | |
| 981 | +final viewTypeValues = EnumValues({ | |
| 982 | + "tabular": ViewType.TABULAR | |
| 983 | +}); | |
| 984 | + | |
| 985 | +class EnumValues<T> { | |
| 986 | + Map<String, T> map; | |
| 987 | + late Map<T, String> reverseMap; | |
| 988 | + | |
| 989 | + EnumValues(this.map); | |
| 990 | + | |
| 991 | + Map<T, String> get reverse { | |
| 992 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 993 | + return reverseMap; | |
| 994 | + } | |
| 995 | +} |
Test case
1 generated file · +9 −0test/inputs/json/misc/ed095.json
Adartdefault / TopLevel.dart+9 −0
| @@ -0,0 +1,9 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +Map<String, String> topLevelFromJson(String str) => Map.from(json.decode(str)).map((k, v) => MapEntry<String, String>(k, v)); | |
| 8 | + | |
| 9 | +String topLevelToJson(Map<String, String> data) => json.encode(Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v))); |
Test case
1 generated file · +391 −0test/inputs/json/misc/f22f5.json
Adartdefault / TopLevel.dart+391 −0
| @@ -0,0 +1,391 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final TopLevelData data; | |
| 13 | + final String kind; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.kind, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: TopLevelData.fromJson(json["data"]), | |
| 22 | + kind: json["kind"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": data.toJson(), | |
| 27 | + "kind": kind, | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class TopLevelData { | |
| 32 | + final String after; | |
| 33 | + final dynamic before; | |
| 34 | + final List<Child> children; | |
| 35 | + final String modhash; | |
| 36 | + | |
| 37 | + TopLevelData({ | |
| 38 | + required this.after, | |
| 39 | + required this.before, | |
| 40 | + required this.children, | |
| 41 | + required this.modhash, | |
| 42 | + }); | |
| 43 | + | |
| 44 | + factory TopLevelData.fromJson(Map<String, dynamic> json) => TopLevelData( | |
| 45 | + after: json["after"], | |
| 46 | + before: json["before"], | |
| 47 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 48 | + modhash: json["modhash"], | |
| 49 | + ); | |
| 50 | + | |
| 51 | + Map<String, dynamic> toJson() => { | |
| 52 | + "after": after, | |
| 53 | + "before": before, | |
| 54 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 55 | + "modhash": modhash, | |
| 56 | + }; | |
| 57 | +} | |
| 58 | + | |
| 59 | +class Child { | |
| 60 | + final ChildData data; | |
| 61 | + final Kind kind; | |
| 62 | + | |
| 63 | + Child({ | |
| 64 | + required this.data, | |
| 65 | + required this.kind, | |
| 66 | + }); | |
| 67 | + | |
| 68 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 69 | + data: ChildData.fromJson(json["data"]), | |
| 70 | + kind: kindValues.map[json["kind"]]!, | |
| 71 | + ); | |
| 72 | + | |
| 73 | + Map<String, dynamic> toJson() => { | |
| 74 | + "data": data.toJson(), | |
| 75 | + "kind": kindValues.reverse[kind], | |
| 76 | + }; | |
| 77 | +} | |
| 78 | + | |
| 79 | +class ChildData { | |
| 80 | + final dynamic approvedAtUtc; | |
| 81 | + final dynamic approvedBy; | |
| 82 | + final bool archived; | |
| 83 | + final String author; | |
| 84 | + final dynamic authorFlairCssClass; | |
| 85 | + final dynamic authorFlairText; | |
| 86 | + final dynamic bannedAtUtc; | |
| 87 | + final dynamic bannedBy; | |
| 88 | + final bool brandSafe; | |
| 89 | + final bool canGild; | |
| 90 | + final bool canModPost; | |
| 91 | + final bool clicked; | |
| 92 | + final bool contestMode; | |
| 93 | + final double created; | |
| 94 | + final double createdUtc; | |
| 95 | + final dynamic distinguished; | |
| 96 | + final String domain; | |
| 97 | + final int downs; | |
| 98 | + final bool edited; | |
| 99 | + final int gilded; | |
| 100 | + final bool hidden; | |
| 101 | + final bool hideScore; | |
| 102 | + final String id; | |
| 103 | + final bool isSelf; | |
| 104 | + final bool isVideo; | |
| 105 | + final dynamic likes; | |
| 106 | + final String? linkFlairCssClass; | |
| 107 | + final String? linkFlairText; | |
| 108 | + final bool locked; | |
| 109 | + final dynamic media; | |
| 110 | + final MediaEmbed mediaEmbed; | |
| 111 | + final List<dynamic> modReports; | |
| 112 | + final String name; | |
| 113 | + final int numComments; | |
| 114 | + final dynamic numReports; | |
| 115 | + final bool over18; | |
| 116 | + final String permalink; | |
| 117 | + final bool quarantine; | |
| 118 | + final dynamic removalReason; | |
| 119 | + final dynamic reportReasons; | |
| 120 | + final bool saved; | |
| 121 | + final int score; | |
| 122 | + final dynamic secureMedia; | |
| 123 | + final MediaEmbed secureMediaEmbed; | |
| 124 | + final String selftext; | |
| 125 | + final dynamic selftextHtml; | |
| 126 | + final bool spoiler; | |
| 127 | + final bool stickied; | |
| 128 | + final Subreddit subreddit; | |
| 129 | + final SubredditId subredditId; | |
| 130 | + final SubredditNamePrefixed subredditNamePrefixed; | |
| 131 | + final SubredditType subredditType; | |
| 132 | + final dynamic suggestedSort; | |
| 133 | + final String thumbnail; | |
| 134 | + final String title; | |
| 135 | + final int ups; | |
| 136 | + final String url; | |
| 137 | + final List<dynamic> userReports; | |
| 138 | + final dynamic viewCount; | |
| 139 | + final bool visited; | |
| 140 | + | |
| 141 | + ChildData({ | |
| 142 | + required this.approvedAtUtc, | |
| 143 | + required this.approvedBy, | |
| 144 | + required this.archived, | |
| 145 | + required this.author, | |
| 146 | + required this.authorFlairCssClass, | |
| 147 | + required this.authorFlairText, | |
| 148 | + required this.bannedAtUtc, | |
| 149 | + required this.bannedBy, | |
| 150 | + required this.brandSafe, | |
| 151 | + required this.canGild, | |
| 152 | + required this.canModPost, | |
| 153 | + required this.clicked, | |
| 154 | + required this.contestMode, | |
| 155 | + required this.created, | |
| 156 | + required this.createdUtc, | |
| 157 | + required this.distinguished, | |
| 158 | + required this.domain, | |
| 159 | + required this.downs, | |
| 160 | + required this.edited, | |
| 161 | + required this.gilded, | |
| 162 | + required this.hidden, | |
| 163 | + required this.hideScore, | |
| 164 | + required this.id, | |
| 165 | + required this.isSelf, | |
| 166 | + required this.isVideo, | |
| 167 | + required this.likes, | |
| 168 | + required this.linkFlairCssClass, | |
| 169 | + required this.linkFlairText, | |
| 170 | + required this.locked, | |
| 171 | + required this.media, | |
| 172 | + required this.mediaEmbed, | |
| 173 | + required this.modReports, | |
| 174 | + required this.name, | |
| 175 | + required this.numComments, | |
| 176 | + required this.numReports, | |
| 177 | + required this.over18, | |
| 178 | + required this.permalink, | |
| 179 | + required this.quarantine, | |
| 180 | + required this.removalReason, | |
| 181 | + required this.reportReasons, | |
| 182 | + required this.saved, | |
| 183 | + required this.score, | |
| 184 | + required this.secureMedia, | |
| 185 | + required this.secureMediaEmbed, | |
| 186 | + required this.selftext, | |
| 187 | + required this.selftextHtml, | |
| 188 | + required this.spoiler, | |
| 189 | + required this.stickied, | |
| 190 | + required this.subreddit, | |
| 191 | + required this.subredditId, | |
| 192 | + required this.subredditNamePrefixed, | |
| 193 | + required this.subredditType, | |
| 194 | + required this.suggestedSort, | |
| 195 | + required this.thumbnail, | |
| 196 | + required this.title, | |
| 197 | + required this.ups, | |
| 198 | + required this.url, | |
| 199 | + required this.userReports, | |
| 200 | + required this.viewCount, | |
| 201 | + required this.visited, | |
| 202 | + }); | |
| 203 | + | |
| 204 | + factory ChildData.fromJson(Map<String, dynamic> json) => ChildData( | |
| 205 | + approvedAtUtc: json["approved_at_utc"], | |
| 206 | + approvedBy: json["approved_by"], | |
| 207 | + archived: json["archived"], | |
| 208 | + author: json["author"], | |
| 209 | + authorFlairCssClass: json["author_flair_css_class"], | |
| 210 | + authorFlairText: json["author_flair_text"], | |
| 211 | + bannedAtUtc: json["banned_at_utc"], | |
| 212 | + bannedBy: json["banned_by"], | |
| 213 | + brandSafe: json["brand_safe"], | |
| 214 | + canGild: json["can_gild"], | |
| 215 | + canModPost: json["can_mod_post"], | |
| 216 | + clicked: json["clicked"], | |
| 217 | + contestMode: json["contest_mode"], | |
| 218 | + created: json["created"]?.toDouble(), | |
| 219 | + createdUtc: json["created_utc"]?.toDouble(), | |
| 220 | + distinguished: json["distinguished"], | |
| 221 | + domain: json["domain"], | |
| 222 | + downs: json["downs"], | |
| 223 | + edited: json["edited"], | |
| 224 | + gilded: json["gilded"], | |
| 225 | + hidden: json["hidden"], | |
| 226 | + hideScore: json["hide_score"], | |
| 227 | + id: json["id"], | |
| 228 | + isSelf: json["is_self"], | |
| 229 | + isVideo: json["is_video"], | |
| 230 | + likes: json["likes"], | |
| 231 | + linkFlairCssClass: json["link_flair_css_class"], | |
| 232 | + linkFlairText: json["link_flair_text"], | |
| 233 | + locked: json["locked"], | |
| 234 | + media: json["media"], | |
| 235 | + mediaEmbed: MediaEmbed.fromJson(json["media_embed"]), | |
| 236 | + modReports: List<dynamic>.from(json["mod_reports"].map((x) => x)), | |
| 237 | + name: json["name"], | |
| 238 | + numComments: json["num_comments"], | |
| 239 | + numReports: json["num_reports"], | |
| 240 | + over18: json["over_18"], | |
| 241 | + permalink: json["permalink"], | |
| 242 | + quarantine: json["quarantine"], | |
| 243 | + removalReason: json["removal_reason"], | |
| 244 | + reportReasons: json["report_reasons"], | |
| 245 | + saved: json["saved"], | |
| 246 | + score: json["score"], | |
| 247 | + secureMedia: json["secure_media"], | |
| 248 | + secureMediaEmbed: MediaEmbed.fromJson(json["secure_media_embed"]), | |
| 249 | + selftext: json["selftext"], | |
| 250 | + selftextHtml: json["selftext_html"], | |
| 251 | + spoiler: json["spoiler"], | |
| 252 | + stickied: json["stickied"], | |
| 253 | + subreddit: subredditValues.map[json["subreddit"]]!, | |
| 254 | + subredditId: subredditIdValues.map[json["subreddit_id"]]!, | |
| 255 | + subredditNamePrefixed: subredditNamePrefixedValues.map[json["subreddit_name_prefixed"]]!, | |
| 256 | + subredditType: subredditTypeValues.map[json["subreddit_type"]]!, | |
| 257 | + suggestedSort: json["suggested_sort"], | |
| 258 | + thumbnail: json["thumbnail"], | |
| 259 | + title: json["title"], | |
| 260 | + ups: json["ups"], | |
| 261 | + url: json["url"], | |
| 262 | + userReports: List<dynamic>.from(json["user_reports"].map((x) => x)), | |
| 263 | + viewCount: json["view_count"], | |
| 264 | + visited: json["visited"], | |
| 265 | + ); | |
| 266 | + | |
| 267 | + Map<String, dynamic> toJson() => { | |
| 268 | + "approved_at_utc": approvedAtUtc, | |
| 269 | + "approved_by": approvedBy, | |
| 270 | + "archived": archived, | |
| 271 | + "author": author, | |
| 272 | + "author_flair_css_class": authorFlairCssClass, | |
| 273 | + "author_flair_text": authorFlairText, | |
| 274 | + "banned_at_utc": bannedAtUtc, | |
| 275 | + "banned_by": bannedBy, | |
| 276 | + "brand_safe": brandSafe, | |
| 277 | + "can_gild": canGild, | |
| 278 | + "can_mod_post": canModPost, | |
| 279 | + "clicked": clicked, | |
| 280 | + "contest_mode": contestMode, | |
| 281 | + "created": created, | |
| 282 | + "created_utc": createdUtc, | |
| 283 | + "distinguished": distinguished, | |
| 284 | + "domain": domain, | |
| 285 | + "downs": downs, | |
| 286 | + "edited": edited, | |
| 287 | + "gilded": gilded, | |
| 288 | + "hidden": hidden, | |
| 289 | + "hide_score": hideScore, | |
| 290 | + "id": id, | |
| 291 | + "is_self": isSelf, | |
| 292 | + "is_video": isVideo, | |
| 293 | + "likes": likes, | |
| 294 | + "link_flair_css_class": linkFlairCssClass, | |
| 295 | + "link_flair_text": linkFlairText, | |
| 296 | + "locked": locked, | |
| 297 | + "media": media, | |
| 298 | + "media_embed": mediaEmbed.toJson(), | |
| 299 | + "mod_reports": List<dynamic>.from(modReports.map((x) => x)), | |
| 300 | + "name": name, | |
| 301 | + "num_comments": numComments, | |
| 302 | + "num_reports": numReports, | |
| 303 | + "over_18": over18, | |
| 304 | + "permalink": permalink, | |
| 305 | + "quarantine": quarantine, | |
| 306 | + "removal_reason": removalReason, | |
| 307 | + "report_reasons": reportReasons, | |
| 308 | + "saved": saved, | |
| 309 | + "score": score, | |
| 310 | + "secure_media": secureMedia, | |
| 311 | + "secure_media_embed": secureMediaEmbed.toJson(), | |
| 312 | + "selftext": selftext, | |
| 313 | + "selftext_html": selftextHtml, | |
| 314 | + "spoiler": spoiler, | |
| 315 | + "stickied": stickied, | |
| 316 | + "subreddit": subredditValues.reverse[subreddit], | |
| 317 | + "subreddit_id": subredditIdValues.reverse[subredditId], | |
| 318 | + "subreddit_name_prefixed": subredditNamePrefixedValues.reverse[subredditNamePrefixed], | |
| 319 | + "subreddit_type": subredditTypeValues.reverse[subredditType], | |
| 320 | + "suggested_sort": suggestedSort, | |
| 321 | + "thumbnail": thumbnail, | |
| 322 | + "title": title, | |
| 323 | + "ups": ups, | |
| 324 | + "url": url, | |
| 325 | + "user_reports": List<dynamic>.from(userReports.map((x) => x)), | |
| 326 | + "view_count": viewCount, | |
| 327 | + "visited": visited, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class MediaEmbed { | |
| 332 | + MediaEmbed(); | |
| 333 | + | |
| 334 | + factory MediaEmbed.fromJson(Map<String, dynamic> json) => MediaEmbed( | |
| 335 | + ); | |
| 336 | + | |
| 337 | + Map<String, dynamic> toJson() => { | |
| 338 | + }; | |
| 339 | +} | |
| 340 | + | |
| 341 | +enum Subreddit { | |
| 342 | + WORLDNEWS | |
| 343 | +} | |
| 344 | + | |
| 345 | +final subredditValues = EnumValues({ | |
| 346 | + "worldnews": Subreddit.WORLDNEWS | |
| 347 | +}); | |
| 348 | + | |
| 349 | +enum SubredditId { | |
| 350 | + T5_2_QH13 | |
| 351 | +} | |
| 352 | + | |
| 353 | +final subredditIdValues = EnumValues({ | |
| 354 | + "t5_2qh13": SubredditId.T5_2_QH13 | |
| 355 | +}); | |
| 356 | + | |
| 357 | +enum SubredditNamePrefixed { | |
| 358 | + R_WORLDNEWS | |
| 359 | +} | |
| 360 | + | |
| 361 | +final subredditNamePrefixedValues = EnumValues({ | |
| 362 | + "r/worldnews": SubredditNamePrefixed.R_WORLDNEWS | |
| 363 | +}); | |
| 364 | + | |
| 365 | +enum SubredditType { | |
| 366 | + PUBLIC | |
| 367 | +} | |
| 368 | + | |
| 369 | +final subredditTypeValues = EnumValues({ | |
| 370 | + "public": SubredditType.PUBLIC | |
| 371 | +}); | |
| 372 | + | |
| 373 | +enum Kind { | |
| 374 | + T3 | |
| 375 | +} | |
| 376 | + | |
| 377 | +final kindValues = EnumValues({ | |
| 378 | + "t3": Kind.T3 | |
| 379 | +}); | |
| 380 | + | |
| 381 | +class EnumValues<T> { | |
| 382 | + Map<String, T> map; | |
| 383 | + late Map<T, String> reverseMap; | |
| 384 | + | |
| 385 | + EnumValues(this.map); | |
| 386 | + | |
| 387 | + Map<T, String> get reverse { | |
| 388 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 389 | + return reverseMap; | |
| 390 | + } | |
| 391 | +} |
Test case
1 generated file · +29 −0test/inputs/json/misc/f3139.json
Adartdefault / TopLevel.dart+29 −0
| @@ -0,0 +1,29 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String id; | |
| 13 | + final String name; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.id, | |
| 17 | + required this.name, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + id: json["id"], | |
| 22 | + name: json["name"], | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "id": id, | |
| 27 | + "name": name, | |
| 28 | + }; | |
| 29 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/f3edf.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +65 −0test/inputs/json/misc/f466a.json
Adartdefault / TopLevel.dart+65 −0
| @@ -0,0 +1,65 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +List<TopLevel> topLevelFromJson(String str) => List<TopLevel>.from(json.decode(str).map((x) => TopLevel.fromJson(x))); | |
| 8 | + | |
| 9 | +String topLevelToJson(List<TopLevel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int age; | |
| 13 | + final Country country; | |
| 14 | + final int females; | |
| 15 | + final int males; | |
| 16 | + final int total; | |
| 17 | + final int year; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.age, | |
| 21 | + required this.country, | |
| 22 | + required this.females, | |
| 23 | + required this.males, | |
| 24 | + required this.total, | |
| 25 | + required this.year, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + age: json["age"], | |
| 30 | + country: countryValues.map[json["country"]]!, | |
| 31 | + females: json["females"], | |
| 32 | + males: json["males"], | |
| 33 | + total: json["total"], | |
| 34 | + year: json["year"], | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "age": age, | |
| 39 | + "country": countryValues.reverse[country], | |
| 40 | + "females": females, | |
| 41 | + "males": males, | |
| 42 | + "total": total, | |
| 43 | + "year": year, | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +enum Country { | |
| 48 | + UNITED_STATES | |
| 49 | +} | |
| 50 | + | |
| 51 | +final countryValues = EnumValues({ | |
| 52 | + "United States": Country.UNITED_STATES | |
| 53 | +}); | |
| 54 | + | |
| 55 | +class EnumValues<T> { | |
| 56 | + Map<String, T> map; | |
| 57 | + late Map<T, String> reverseMap; | |
| 58 | + | |
| 59 | + EnumValues(this.map); | |
| 60 | + | |
| 61 | + Map<T, String> get reverse { | |
| 62 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 63 | + return reverseMap; | |
| 64 | + } | |
| 65 | +} |
Test case
1 generated file · +481 −0test/inputs/json/misc/f6a65.json
Adartdefault / TopLevel.dart+481 −0
| @@ -0,0 +1,481 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<Datum> data; | |
| 13 | + final Meta meta; | |
| 14 | + final Pagination pagination; | |
| 15 | + | |
| 16 | + TopLevel({ | |
| 17 | + required this.data, | |
| 18 | + required this.meta, | |
| 19 | + required this.pagination, | |
| 20 | + }); | |
| 21 | + | |
| 22 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 23 | + data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))), | |
| 24 | + meta: Meta.fromJson(json["meta"]), | |
| 25 | + pagination: Pagination.fromJson(json["pagination"]), | |
| 26 | + ); | |
| 27 | + | |
| 28 | + Map<String, dynamic> toJson() => { | |
| 29 | + "data": List<dynamic>.from(data.map((x) => x.toJson())), | |
| 30 | + "meta": meta.toJson(), | |
| 31 | + "pagination": pagination.toJson(), | |
| 32 | + }; | |
| 33 | +} | |
| 34 | + | |
| 35 | +class Datum { | |
| 36 | + final String bitlyGifUrl; | |
| 37 | + final String bitlyUrl; | |
| 38 | + final String contentUrl; | |
| 39 | + final String embedUrl; | |
| 40 | + final String id; | |
| 41 | + final Images images; | |
| 42 | + final String importDatetime; | |
| 43 | + final int isIndexable; | |
| 44 | + final Rating rating; | |
| 45 | + final String slug; | |
| 46 | + final String source; | |
| 47 | + final String sourcePostUrl; | |
| 48 | + final String sourceTld; | |
| 49 | + final String trendingDatetime; | |
| 50 | + final Type type; | |
| 51 | + final String url; | |
| 52 | + final User? user; | |
| 53 | + final Username username; | |
| 54 | + | |
| 55 | + Datum({ | |
| 56 | + required this.bitlyGifUrl, | |
| 57 | + required this.bitlyUrl, | |
| 58 | + required this.contentUrl, | |
| 59 | + required this.embedUrl, | |
| 60 | + required this.id, | |
| 61 | + required this.images, | |
| 62 | + required this.importDatetime, | |
| 63 | + required this.isIndexable, | |
| 64 | + required this.rating, | |
| 65 | + required this.slug, | |
| 66 | + required this.source, | |
| 67 | + required this.sourcePostUrl, | |
| 68 | + required this.sourceTld, | |
| 69 | + required this.trendingDatetime, | |
| 70 | + required this.type, | |
| 71 | + required this.url, | |
| 72 | + this.user, | |
| 73 | + required this.username, | |
| 74 | + }); | |
| 75 | + | |
| 76 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 77 | + bitlyGifUrl: json["bitly_gif_url"], | |
| 78 | + bitlyUrl: json["bitly_url"], | |
| 79 | + contentUrl: json["content_url"], | |
| 80 | + embedUrl: json["embed_url"], | |
| 81 | + id: json["id"], | |
| 82 | + images: Images.fromJson(json["images"]), | |
| 83 | + importDatetime: json["import_datetime"], | |
| 84 | + isIndexable: json["is_indexable"], | |
| 85 | + rating: ratingValues.map[json["rating"]]!, | |
| 86 | + slug: json["slug"], | |
| 87 | + source: json["source"], | |
| 88 | + sourcePostUrl: json["source_post_url"], | |
| 89 | + sourceTld: json["source_tld"], | |
| 90 | + trendingDatetime: json["trending_datetime"], | |
| 91 | + type: typeValues.map[json["type"]]!, | |
| 92 | + url: json["url"], | |
| 93 | + user: json["user"] == null ? null : User.fromJson(json["user"]), | |
| 94 | + username: usernameValues.map[json["username"]]!, | |
| 95 | + ); | |
| 96 | + | |
| 97 | + Map<String, dynamic> toJson() => { | |
| 98 | + "bitly_gif_url": bitlyGifUrl, | |
| 99 | + "bitly_url": bitlyUrl, | |
| 100 | + "content_url": contentUrl, | |
| 101 | + "embed_url": embedUrl, | |
| 102 | + "id": id, | |
| 103 | + "images": images.toJson(), | |
| 104 | + "import_datetime": importDatetime, | |
| 105 | + "is_indexable": isIndexable, | |
| 106 | + "rating": ratingValues.reverse[rating], | |
| 107 | + "slug": slug, | |
| 108 | + "source": source, | |
| 109 | + "source_post_url": sourcePostUrl, | |
| 110 | + "source_tld": sourceTld, | |
| 111 | + "trending_datetime": trendingDatetime, | |
| 112 | + "type": typeValues.reverse[type], | |
| 113 | + "url": url, | |
| 114 | + "user": user?.toJson(), | |
| 115 | + "username": usernameValues.reverse[username], | |
| 116 | + }; | |
| 117 | +} | |
| 118 | + | |
| 119 | +class Images { | |
| 120 | + final Downsized downsized; | |
| 121 | + final Downsized downsizedLarge; | |
| 122 | + final Downsized downsizedMedium; | |
| 123 | + final DownsizedSmall downsizedSmall; | |
| 124 | + final Downsized downsizedStill; | |
| 125 | + final FixedHeight fixedHeight; | |
| 126 | + final FixedHeight fixedHeightDownsampled; | |
| 127 | + final FixedHeight fixedHeightSmall; | |
| 128 | + final Downsized fixedHeightSmallStill; | |
| 129 | + final Downsized fixedHeightStill; | |
| 130 | + final FixedHeight fixedWidth; | |
| 131 | + final FixedHeight fixedWidthDownsampled; | |
| 132 | + final FixedHeight fixedWidthSmall; | |
| 133 | + final Downsized fixedWidthSmallStill; | |
| 134 | + final Downsized fixedWidthStill; | |
| 135 | + final Looping looping; | |
| 136 | + final FixedHeight original; | |
| 137 | + final DownsizedSmall originalMp4; | |
| 138 | + final Downsized originalStill; | |
| 139 | + final DownsizedSmall preview; | |
| 140 | + final Downsized previewGif; | |
| 141 | + final Downsized previewWebp; | |
| 142 | + final Downsized? the480WStill; | |
| 143 | + | |
| 144 | + Images({ | |
| 145 | + required this.downsized, | |
| 146 | + required this.downsizedLarge, | |
| 147 | + required this.downsizedMedium, | |
| 148 | + required this.downsizedSmall, | |
| 149 | + required this.downsizedStill, | |
| 150 | + required this.fixedHeight, | |
| 151 | + required this.fixedHeightDownsampled, | |
| 152 | + required this.fixedHeightSmall, | |
| 153 | + required this.fixedHeightSmallStill, | |
| 154 | + required this.fixedHeightStill, | |
| 155 | + required this.fixedWidth, | |
| 156 | + required this.fixedWidthDownsampled, | |
| 157 | + required this.fixedWidthSmall, | |
| 158 | + required this.fixedWidthSmallStill, | |
| 159 | + required this.fixedWidthStill, | |
| 160 | + required this.looping, | |
| 161 | + required this.original, | |
| 162 | + required this.originalMp4, | |
| 163 | + required this.originalStill, | |
| 164 | + required this.preview, | |
| 165 | + required this.previewGif, | |
| 166 | + required this.previewWebp, | |
| 167 | + this.the480WStill, | |
| 168 | + }); | |
| 169 | + | |
| 170 | + factory Images.fromJson(Map<String, dynamic> json) => Images( | |
| 171 | + downsized: Downsized.fromJson(json["downsized"]), | |
| 172 | + downsizedLarge: Downsized.fromJson(json["downsized_large"]), | |
| 173 | + downsizedMedium: Downsized.fromJson(json["downsized_medium"]), | |
| 174 | + downsizedSmall: DownsizedSmall.fromJson(json["downsized_small"]), | |
| 175 | + downsizedStill: Downsized.fromJson(json["downsized_still"]), | |
| 176 | + fixedHeight: FixedHeight.fromJson(json["fixed_height"]), | |
| 177 | + fixedHeightDownsampled: FixedHeight.fromJson(json["fixed_height_downsampled"]), | |
| 178 | + fixedHeightSmall: FixedHeight.fromJson(json["fixed_height_small"]), | |
| 179 | + fixedHeightSmallStill: Downsized.fromJson(json["fixed_height_small_still"]), | |
| 180 | + fixedHeightStill: Downsized.fromJson(json["fixed_height_still"]), | |
| 181 | + fixedWidth: FixedHeight.fromJson(json["fixed_width"]), | |
| 182 | + fixedWidthDownsampled: FixedHeight.fromJson(json["fixed_width_downsampled"]), | |
| 183 | + fixedWidthSmall: FixedHeight.fromJson(json["fixed_width_small"]), | |
| 184 | + fixedWidthSmallStill: Downsized.fromJson(json["fixed_width_small_still"]), | |
| 185 | + fixedWidthStill: Downsized.fromJson(json["fixed_width_still"]), | |
| 186 | + looping: Looping.fromJson(json["looping"]), | |
| 187 | + original: FixedHeight.fromJson(json["original"]), | |
| 188 | + originalMp4: DownsizedSmall.fromJson(json["original_mp4"]), | |
| 189 | + originalStill: Downsized.fromJson(json["original_still"]), | |
| 190 | + preview: DownsizedSmall.fromJson(json["preview"]), | |
| 191 | + previewGif: Downsized.fromJson(json["preview_gif"]), | |
| 192 | + previewWebp: Downsized.fromJson(json["preview_webp"]), | |
| 193 | + the480WStill: json["480w_still"] == null ? null : Downsized.fromJson(json["480w_still"]), | |
| 194 | + ); | |
| 195 | + | |
| 196 | + Map<String, dynamic> toJson() => { | |
| 197 | + "downsized": downsized.toJson(), | |
| 198 | + "downsized_large": downsizedLarge.toJson(), | |
| 199 | + "downsized_medium": downsizedMedium.toJson(), | |
| 200 | + "downsized_small": downsizedSmall.toJson(), | |
| 201 | + "downsized_still": downsizedStill.toJson(), | |
| 202 | + "fixed_height": fixedHeight.toJson(), | |
| 203 | + "fixed_height_downsampled": fixedHeightDownsampled.toJson(), | |
| 204 | + "fixed_height_small": fixedHeightSmall.toJson(), | |
| 205 | + "fixed_height_small_still": fixedHeightSmallStill.toJson(), | |
| 206 | + "fixed_height_still": fixedHeightStill.toJson(), | |
| 207 | + "fixed_width": fixedWidth.toJson(), | |
| 208 | + "fixed_width_downsampled": fixedWidthDownsampled.toJson(), | |
| 209 | + "fixed_width_small": fixedWidthSmall.toJson(), | |
| 210 | + "fixed_width_small_still": fixedWidthSmallStill.toJson(), | |
| 211 | + "fixed_width_still": fixedWidthStill.toJson(), | |
| 212 | + "looping": looping.toJson(), | |
| 213 | + "original": original.toJson(), | |
| 214 | + "original_mp4": originalMp4.toJson(), | |
| 215 | + "original_still": originalStill.toJson(), | |
| 216 | + "preview": preview.toJson(), | |
| 217 | + "preview_gif": previewGif.toJson(), | |
| 218 | + "preview_webp": previewWebp.toJson(), | |
| 219 | + "480w_still": the480WStill?.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Downsized { | |
| 224 | + final String height; | |
| 225 | + final String? size; | |
| 226 | + final String url; | |
| 227 | + final String width; | |
| 228 | + | |
| 229 | + Downsized({ | |
| 230 | + required this.height, | |
| 231 | + this.size, | |
| 232 | + required this.url, | |
| 233 | + required this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Downsized.fromJson(Map<String, dynamic> json) => Downsized( | |
| 237 | + height: json["height"], | |
| 238 | + size: json["size"], | |
| 239 | + url: json["url"], | |
| 240 | + width: json["width"], | |
| 241 | + ); | |
| 242 | + | |
| 243 | + Map<String, dynamic> toJson() => { | |
| 244 | + "height": height, | |
| 245 | + "size": size, | |
| 246 | + "url": url, | |
| 247 | + "width": width, | |
| 248 | + }; | |
| 249 | +} | |
| 250 | + | |
| 251 | +class DownsizedSmall { | |
| 252 | + final String height; | |
| 253 | + final String mp4; | |
| 254 | + final String mp4Size; | |
| 255 | + final String width; | |
| 256 | + | |
| 257 | + DownsizedSmall({ | |
| 258 | + required this.height, | |
| 259 | + required this.mp4, | |
| 260 | + required this.mp4Size, | |
| 261 | + required this.width, | |
| 262 | + }); | |
| 263 | + | |
| 264 | + factory DownsizedSmall.fromJson(Map<String, dynamic> json) => DownsizedSmall( | |
| 265 | + height: json["height"], | |
| 266 | + mp4: json["mp4"], | |
| 267 | + mp4Size: json["mp4_size"], | |
| 268 | + width: json["width"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "height": height, | |
| 273 | + "mp4": mp4, | |
| 274 | + "mp4_size": mp4Size, | |
| 275 | + "width": width, | |
| 276 | + }; | |
| 277 | +} | |
| 278 | + | |
| 279 | +class FixedHeight { | |
| 280 | + final String? frames; | |
| 281 | + final String? hash; | |
| 282 | + final String height; | |
| 283 | + final String? mp4; | |
| 284 | + final String? mp4Size; | |
| 285 | + final String size; | |
| 286 | + final String url; | |
| 287 | + final String webp; | |
| 288 | + final String webpSize; | |
| 289 | + final String width; | |
| 290 | + | |
| 291 | + FixedHeight({ | |
| 292 | + this.frames, | |
| 293 | + this.hash, | |
| 294 | + required this.height, | |
| 295 | + this.mp4, | |
| 296 | + this.mp4Size, | |
| 297 | + required this.size, | |
| 298 | + required this.url, | |
| 299 | + required this.webp, | |
| 300 | + required this.webpSize, | |
| 301 | + required this.width, | |
| 302 | + }); | |
| 303 | + | |
| 304 | + factory FixedHeight.fromJson(Map<String, dynamic> json) => FixedHeight( | |
| 305 | + frames: json["frames"], | |
| 306 | + hash: json["hash"], | |
| 307 | + height: json["height"], | |
| 308 | + mp4: json["mp4"], | |
| 309 | + mp4Size: json["mp4_size"], | |
| 310 | + size: json["size"], | |
| 311 | + url: json["url"], | |
| 312 | + webp: json["webp"], | |
| 313 | + webpSize: json["webp_size"], | |
| 314 | + width: json["width"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "frames": frames, | |
| 319 | + "hash": hash, | |
| 320 | + "height": height, | |
| 321 | + "mp4": mp4, | |
| 322 | + "mp4_size": mp4Size, | |
| 323 | + "size": size, | |
| 324 | + "url": url, | |
| 325 | + "webp": webp, | |
| 326 | + "webp_size": webpSize, | |
| 327 | + "width": width, | |
| 328 | + }; | |
| 329 | +} | |
| 330 | + | |
| 331 | +class Looping { | |
| 332 | + final String mp4; | |
| 333 | + final String mp4Size; | |
| 334 | + | |
| 335 | + Looping({ | |
| 336 | + required this.mp4, | |
| 337 | + required this.mp4Size, | |
| 338 | + }); | |
| 339 | + | |
| 340 | + factory Looping.fromJson(Map<String, dynamic> json) => Looping( | |
| 341 | + mp4: json["mp4"], | |
| 342 | + mp4Size: json["mp4_size"], | |
| 343 | + ); | |
| 344 | + | |
| 345 | + Map<String, dynamic> toJson() => { | |
| 346 | + "mp4": mp4, | |
| 347 | + "mp4_size": mp4Size, | |
| 348 | + }; | |
| 349 | +} | |
| 350 | + | |
| 351 | +enum Rating { | |
| 352 | + G, | |
| 353 | + Y, | |
| 354 | + PG, | |
| 355 | + PG_13 | |
| 356 | +} | |
| 357 | + | |
| 358 | +final ratingValues = EnumValues({ | |
| 359 | + "g": Rating.G, | |
| 360 | + "y": Rating.Y, | |
| 361 | + "pg": Rating.PG, | |
| 362 | + "pg-13": Rating.PG_13 | |
| 363 | +}); | |
| 364 | + | |
| 365 | +enum Type { | |
| 366 | + GIF | |
| 367 | +} | |
| 368 | + | |
| 369 | +final typeValues = EnumValues({ | |
| 370 | + "gif": Type.GIF | |
| 371 | +}); | |
| 372 | + | |
| 373 | +class User { | |
| 374 | + final String avatarUrl; | |
| 375 | + final String bannerUrl; | |
| 376 | + final String displayName; | |
| 377 | + final String profileUrl; | |
| 378 | + final String twitter; | |
| 379 | + final Username username; | |
| 380 | + | |
| 381 | + User({ | |
| 382 | + required this.avatarUrl, | |
| 383 | + required this.bannerUrl, | |
| 384 | + required this.displayName, | |
| 385 | + required this.profileUrl, | |
| 386 | + required this.twitter, | |
| 387 | + required this.username, | |
| 388 | + }); | |
| 389 | + | |
| 390 | + factory User.fromJson(Map<String, dynamic> json) => User( | |
| 391 | + avatarUrl: json["avatar_url"], | |
| 392 | + bannerUrl: json["banner_url"], | |
| 393 | + displayName: json["display_name"], | |
| 394 | + profileUrl: json["profile_url"], | |
| 395 | + twitter: json["twitter"], | |
| 396 | + username: usernameValues.map[json["username"]]!, | |
| 397 | + ); | |
| 398 | + | |
| 399 | + Map<String, dynamic> toJson() => { | |
| 400 | + "avatar_url": avatarUrl, | |
| 401 | + "banner_url": bannerUrl, | |
| 402 | + "display_name": displayName, | |
| 403 | + "profile_url": profileUrl, | |
| 404 | + "twitter": twitter, | |
| 405 | + "username": usernameValues.reverse[username], | |
| 406 | + }; | |
| 407 | +} | |
| 408 | + | |
| 409 | +enum Username { | |
| 410 | + EMPTY, | |
| 411 | + PRODUCTHUNT, | |
| 412 | + MEETAIKO, | |
| 413 | + CHEEZBURGER | |
| 414 | +} | |
| 415 | + | |
| 416 | +final usernameValues = EnumValues({ | |
| 417 | + "": Username.EMPTY, | |
| 418 | + "producthunt": Username.PRODUCTHUNT, | |
| 419 | + "meetaiko": Username.MEETAIKO, | |
| 420 | + "cheezburger": Username.CHEEZBURGER | |
| 421 | +}); | |
| 422 | + | |
| 423 | +class Meta { | |
| 424 | + final String msg; | |
| 425 | + final String responseId; | |
| 426 | + final int status; | |
| 427 | + | |
| 428 | + Meta({ | |
| 429 | + required this.msg, | |
| 430 | + required this.responseId, | |
| 431 | + required this.status, | |
| 432 | + }); | |
| 433 | + | |
| 434 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 435 | + msg: json["msg"], | |
| 436 | + responseId: json["response_id"], | |
| 437 | + status: json["status"], | |
| 438 | + ); | |
| 439 | + | |
| 440 | + Map<String, dynamic> toJson() => { | |
| 441 | + "msg": msg, | |
| 442 | + "response_id": responseId, | |
| 443 | + "status": status, | |
| 444 | + }; | |
| 445 | +} | |
| 446 | + | |
| 447 | +class Pagination { | |
| 448 | + final int count; | |
| 449 | + final int offset; | |
| 450 | + final int totalCount; | |
| 451 | + | |
| 452 | + Pagination({ | |
| 453 | + required this.count, | |
| 454 | + required this.offset, | |
| 455 | + required this.totalCount, | |
| 456 | + }); | |
| 457 | + | |
| 458 | + factory Pagination.fromJson(Map<String, dynamic> json) => Pagination( | |
| 459 | + count: json["count"], | |
| 460 | + offset: json["offset"], | |
| 461 | + totalCount: json["total_count"], | |
| 462 | + ); | |
| 463 | + | |
| 464 | + Map<String, dynamic> toJson() => { | |
| 465 | + "count": count, | |
| 466 | + "offset": offset, | |
| 467 | + "total_count": totalCount, | |
| 468 | + }; | |
| 469 | +} | |
| 470 | + | |
| 471 | +class EnumValues<T> { | |
| 472 | + Map<String, T> map; | |
| 473 | + late Map<T, String> reverseMap; | |
| 474 | + | |
| 475 | + EnumValues(this.map); | |
| 476 | + | |
| 477 | + Map<T, String> get reverse { | |
| 478 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 479 | + return reverseMap; | |
| 480 | + } | |
| 481 | +} |
Test case
1 generated file · +483 −0test/inputs/json/misc/f74d5.json
Adartdefault / TopLevel.dart+483 −0
| @@ -0,0 +1,483 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final int averageRating; | |
| 49 | + final String category; | |
| 50 | + final List<Column> columns; | |
| 51 | + final int createdAt; | |
| 52 | + final String displayType; | |
| 53 | + final int downloadCount; | |
| 54 | + final List<String> flags; | |
| 55 | + final List<Grant> grants; | |
| 56 | + final bool hideFromCatalog; | |
| 57 | + final bool hideFromDataJson; | |
| 58 | + final String id; | |
| 59 | + final int indexUpdatedAt; | |
| 60 | + final License license; | |
| 61 | + final String licenseId; | |
| 62 | + final String locale; | |
| 63 | + final Metadata metadata; | |
| 64 | + final String name; | |
| 65 | + final bool newBackend; | |
| 66 | + final int numberOfComments; | |
| 67 | + final int oid; | |
| 68 | + final Owner owner; | |
| 69 | + final String provenance; | |
| 70 | + final bool publicationAppendEnabled; | |
| 71 | + final int publicationDate; | |
| 72 | + final int publicationGroup; | |
| 73 | + final String publicationStage; | |
| 74 | + final Query query; | |
| 75 | + final List<String> rights; | |
| 76 | + final String rowClass; | |
| 77 | + final int rowsUpdatedAt; | |
| 78 | + final String rowsUpdatedBy; | |
| 79 | + final Owner tableAuthor; | |
| 80 | + final int tableId; | |
| 81 | + final int totalTimesRated; | |
| 82 | + final int viewCount; | |
| 83 | + final int viewLastModified; | |
| 84 | + final String viewType; | |
| 85 | + | |
| 86 | + View({ | |
| 87 | + required this.averageRating, | |
| 88 | + required this.category, | |
| 89 | + required this.columns, | |
| 90 | + required this.createdAt, | |
| 91 | + required this.displayType, | |
| 92 | + required this.downloadCount, | |
| 93 | + required this.flags, | |
| 94 | + required this.grants, | |
| 95 | + required this.hideFromCatalog, | |
| 96 | + required this.hideFromDataJson, | |
| 97 | + required this.id, | |
| 98 | + required this.indexUpdatedAt, | |
| 99 | + required this.license, | |
| 100 | + required this.licenseId, | |
| 101 | + required this.locale, | |
| 102 | + required this.metadata, | |
| 103 | + required this.name, | |
| 104 | + required this.newBackend, | |
| 105 | + required this.numberOfComments, | |
| 106 | + required this.oid, | |
| 107 | + required this.owner, | |
| 108 | + required this.provenance, | |
| 109 | + required this.publicationAppendEnabled, | |
| 110 | + required this.publicationDate, | |
| 111 | + required this.publicationGroup, | |
| 112 | + required this.publicationStage, | |
| 113 | + required this.query, | |
| 114 | + required this.rights, | |
| 115 | + required this.rowClass, | |
| 116 | + required this.rowsUpdatedAt, | |
| 117 | + required this.rowsUpdatedBy, | |
| 118 | + required this.tableAuthor, | |
| 119 | + required this.tableId, | |
| 120 | + required this.totalTimesRated, | |
| 121 | + required this.viewCount, | |
| 122 | + required this.viewLastModified, | |
| 123 | + required this.viewType, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 127 | + averageRating: json["averageRating"], | |
| 128 | + category: json["category"], | |
| 129 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 130 | + createdAt: json["createdAt"], | |
| 131 | + displayType: json["displayType"], | |
| 132 | + downloadCount: json["downloadCount"], | |
| 133 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 134 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 135 | + hideFromCatalog: json["hideFromCatalog"], | |
| 136 | + hideFromDataJson: json["hideFromDataJson"], | |
| 137 | + id: json["id"], | |
| 138 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 139 | + license: License.fromJson(json["license"]), | |
| 140 | + licenseId: json["licenseId"], | |
| 141 | + locale: json["locale"], | |
| 142 | + metadata: Metadata.fromJson(json["metadata"]), | |
| 143 | + name: json["name"], | |
| 144 | + newBackend: json["newBackend"], | |
| 145 | + numberOfComments: json["numberOfComments"], | |
| 146 | + oid: json["oid"], | |
| 147 | + owner: Owner.fromJson(json["owner"]), | |
| 148 | + provenance: json["provenance"], | |
| 149 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 150 | + publicationDate: json["publicationDate"], | |
| 151 | + publicationGroup: json["publicationGroup"], | |
| 152 | + publicationStage: json["publicationStage"], | |
| 153 | + query: Query.fromJson(json["query"]), | |
| 154 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 155 | + rowClass: json["rowClass"], | |
| 156 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 157 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 158 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 159 | + tableId: json["tableId"], | |
| 160 | + totalTimesRated: json["totalTimesRated"], | |
| 161 | + viewCount: json["viewCount"], | |
| 162 | + viewLastModified: json["viewLastModified"], | |
| 163 | + viewType: json["viewType"], | |
| 164 | + ); | |
| 165 | + | |
| 166 | + Map<String, dynamic> toJson() => { | |
| 167 | + "averageRating": averageRating, | |
| 168 | + "category": category, | |
| 169 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 170 | + "createdAt": createdAt, | |
| 171 | + "displayType": displayType, | |
| 172 | + "downloadCount": downloadCount, | |
| 173 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 174 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 175 | + "hideFromCatalog": hideFromCatalog, | |
| 176 | + "hideFromDataJson": hideFromDataJson, | |
| 177 | + "id": id, | |
| 178 | + "indexUpdatedAt": indexUpdatedAt, | |
| 179 | + "license": license.toJson(), | |
| 180 | + "licenseId": licenseId, | |
| 181 | + "locale": locale, | |
| 182 | + "metadata": metadata.toJson(), | |
| 183 | + "name": name, | |
| 184 | + "newBackend": newBackend, | |
| 185 | + "numberOfComments": numberOfComments, | |
| 186 | + "oid": oid, | |
| 187 | + "owner": owner.toJson(), | |
| 188 | + "provenance": provenance, | |
| 189 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 190 | + "publicationDate": publicationDate, | |
| 191 | + "publicationGroup": publicationGroup, | |
| 192 | + "publicationStage": publicationStage, | |
| 193 | + "query": query.toJson(), | |
| 194 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 195 | + "rowClass": rowClass, | |
| 196 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 197 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 198 | + "tableAuthor": tableAuthor.toJson(), | |
| 199 | + "tableId": tableId, | |
| 200 | + "totalTimesRated": totalTimesRated, | |
| 201 | + "viewCount": viewCount, | |
| 202 | + "viewLastModified": viewLastModified, | |
| 203 | + "viewType": viewType, | |
| 204 | + }; | |
| 205 | +} | |
| 206 | + | |
| 207 | +class Column { | |
| 208 | + final CachedContents? cachedContents; | |
| 209 | + final TypeName dataTypeName; | |
| 210 | + final String fieldName; | |
| 211 | + final List<String>? flags; | |
| 212 | + final Query format; | |
| 213 | + final int id; | |
| 214 | + final String name; | |
| 215 | + final int position; | |
| 216 | + final TypeName renderTypeName; | |
| 217 | + final int? tableColumnId; | |
| 218 | + final int? width; | |
| 219 | + | |
| 220 | + Column({ | |
| 221 | + this.cachedContents, | |
| 222 | + required this.dataTypeName, | |
| 223 | + required this.fieldName, | |
| 224 | + this.flags, | |
| 225 | + required this.format, | |
| 226 | + required this.id, | |
| 227 | + required this.name, | |
| 228 | + required this.position, | |
| 229 | + required this.renderTypeName, | |
| 230 | + this.tableColumnId, | |
| 231 | + this.width, | |
| 232 | + }); | |
| 233 | + | |
| 234 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 235 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 236 | + dataTypeName: typeNameValues.map[json["dataTypeName"]]!, | |
| 237 | + fieldName: json["fieldName"], | |
| 238 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 239 | + format: Query.fromJson(json["format"]), | |
| 240 | + id: json["id"], | |
| 241 | + name: json["name"], | |
| 242 | + position: json["position"], | |
| 243 | + renderTypeName: typeNameValues.map[json["renderTypeName"]]!, | |
| 244 | + tableColumnId: json["tableColumnId"], | |
| 245 | + width: json["width"], | |
| 246 | + ); | |
| 247 | + | |
| 248 | + Map<String, dynamic> toJson() => { | |
| 249 | + "cachedContents": cachedContents?.toJson(), | |
| 250 | + "dataTypeName": typeNameValues.reverse[dataTypeName], | |
| 251 | + "fieldName": fieldName, | |
| 252 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 253 | + "format": format.toJson(), | |
| 254 | + "id": id, | |
| 255 | + "name": name, | |
| 256 | + "position": position, | |
| 257 | + "renderTypeName": typeNameValues.reverse[renderTypeName], | |
| 258 | + "tableColumnId": tableColumnId, | |
| 259 | + "width": width, | |
| 260 | + }; | |
| 261 | +} | |
| 262 | + | |
| 263 | +class CachedContents { | |
| 264 | + final String? average; | |
| 265 | + final int cachedContentsNull; | |
| 266 | + final String largest; | |
| 267 | + final int nonNull; | |
| 268 | + final String smallest; | |
| 269 | + final String? sum; | |
| 270 | + final List<Top> top; | |
| 271 | + | |
| 272 | + CachedContents({ | |
| 273 | + this.average, | |
| 274 | + required this.cachedContentsNull, | |
| 275 | + required this.largest, | |
| 276 | + required this.nonNull, | |
| 277 | + required this.smallest, | |
| 278 | + this.sum, | |
| 279 | + required this.top, | |
| 280 | + }); | |
| 281 | + | |
| 282 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 283 | + average: json["average"], | |
| 284 | + cachedContentsNull: json["null"], | |
| 285 | + largest: json["largest"], | |
| 286 | + nonNull: json["non_null"], | |
| 287 | + smallest: json["smallest"], | |
| 288 | + sum: json["sum"], | |
| 289 | + top: List<Top>.from(json["top"].map((x) => Top.fromJson(x))), | |
| 290 | + ); | |
| 291 | + | |
| 292 | + Map<String, dynamic> toJson() => { | |
| 293 | + "average": average, | |
| 294 | + "null": cachedContentsNull, | |
| 295 | + "largest": largest, | |
| 296 | + "non_null": nonNull, | |
| 297 | + "smallest": smallest, | |
| 298 | + "sum": sum, | |
| 299 | + "top": List<dynamic>.from(top.map((x) => x.toJson())), | |
| 300 | + }; | |
| 301 | +} | |
| 302 | + | |
| 303 | +class Top { | |
| 304 | + final int count; | |
| 305 | + final String item; | |
| 306 | + | |
| 307 | + Top({ | |
| 308 | + required this.count, | |
| 309 | + required this.item, | |
| 310 | + }); | |
| 311 | + | |
| 312 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 313 | + count: json["count"], | |
| 314 | + item: json["item"], | |
| 315 | + ); | |
| 316 | + | |
| 317 | + Map<String, dynamic> toJson() => { | |
| 318 | + "count": count, | |
| 319 | + "item": item, | |
| 320 | + }; | |
| 321 | +} | |
| 322 | + | |
| 323 | +enum TypeName { | |
| 324 | + META_DATA, | |
| 325 | + NUMBER, | |
| 326 | + TEXT | |
| 327 | +} | |
| 328 | + | |
| 329 | +final typeNameValues = EnumValues({ | |
| 330 | + "meta_data": TypeName.META_DATA, | |
| 331 | + "number": TypeName.NUMBER, | |
| 332 | + "text": TypeName.TEXT | |
| 333 | +}); | |
| 334 | + | |
| 335 | +class Query { | |
| 336 | + Query(); | |
| 337 | + | |
| 338 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 339 | + ); | |
| 340 | + | |
| 341 | + Map<String, dynamic> toJson() => { | |
| 342 | + }; | |
| 343 | +} | |
| 344 | + | |
| 345 | +class Grant { | |
| 346 | + final List<String> flags; | |
| 347 | + final bool inherited; | |
| 348 | + final String type; | |
| 349 | + | |
| 350 | + Grant({ | |
| 351 | + required this.flags, | |
| 352 | + required this.inherited, | |
| 353 | + required this.type, | |
| 354 | + }); | |
| 355 | + | |
| 356 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 357 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 358 | + inherited: json["inherited"], | |
| 359 | + type: json["type"], | |
| 360 | + ); | |
| 361 | + | |
| 362 | + Map<String, dynamic> toJson() => { | |
| 363 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 364 | + "inherited": inherited, | |
| 365 | + "type": type, | |
| 366 | + }; | |
| 367 | +} | |
| 368 | + | |
| 369 | +class License { | |
| 370 | + final String name; | |
| 371 | + | |
| 372 | + License({ | |
| 373 | + required this.name, | |
| 374 | + }); | |
| 375 | + | |
| 376 | + factory License.fromJson(Map<String, dynamic> json) => License( | |
| 377 | + name: json["name"], | |
| 378 | + ); | |
| 379 | + | |
| 380 | + Map<String, dynamic> toJson() => { | |
| 381 | + "name": name, | |
| 382 | + }; | |
| 383 | +} | |
| 384 | + | |
| 385 | +class Metadata { | |
| 386 | + final List<String> availableDisplayTypes; | |
| 387 | + final String rdfClass; | |
| 388 | + final String rdfSubject; | |
| 389 | + final RenderTypeConfig renderTypeConfig; | |
| 390 | + final String rowIdentifier; | |
| 391 | + | |
| 392 | + Metadata({ | |
| 393 | + required this.availableDisplayTypes, | |
| 394 | + required this.rdfClass, | |
| 395 | + required this.rdfSubject, | |
| 396 | + required this.renderTypeConfig, | |
| 397 | + required this.rowIdentifier, | |
| 398 | + }); | |
| 399 | + | |
| 400 | + factory Metadata.fromJson(Map<String, dynamic> json) => Metadata( | |
| 401 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 402 | + rdfClass: json["rdfClass"], | |
| 403 | + rdfSubject: json["rdfSubject"], | |
| 404 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 405 | + rowIdentifier: json["rowIdentifier"], | |
| 406 | + ); | |
| 407 | + | |
| 408 | + Map<String, dynamic> toJson() => { | |
| 409 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 410 | + "rdfClass": rdfClass, | |
| 411 | + "rdfSubject": rdfSubject, | |
| 412 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 413 | + "rowIdentifier": rowIdentifier, | |
| 414 | + }; | |
| 415 | +} | |
| 416 | + | |
| 417 | +class RenderTypeConfig { | |
| 418 | + final Visible visible; | |
| 419 | + | |
| 420 | + RenderTypeConfig({ | |
| 421 | + required this.visible, | |
| 422 | + }); | |
| 423 | + | |
| 424 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 425 | + visible: Visible.fromJson(json["visible"]), | |
| 426 | + ); | |
| 427 | + | |
| 428 | + Map<String, dynamic> toJson() => { | |
| 429 | + "visible": visible.toJson(), | |
| 430 | + }; | |
| 431 | +} | |
| 432 | + | |
| 433 | +class Visible { | |
| 434 | + final bool table; | |
| 435 | + | |
| 436 | + Visible({ | |
| 437 | + required this.table, | |
| 438 | + }); | |
| 439 | + | |
| 440 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 441 | + table: json["table"], | |
| 442 | + ); | |
| 443 | + | |
| 444 | + Map<String, dynamic> toJson() => { | |
| 445 | + "table": table, | |
| 446 | + }; | |
| 447 | +} | |
| 448 | + | |
| 449 | +class Owner { | |
| 450 | + final String displayName; | |
| 451 | + final String id; | |
| 452 | + final String screenName; | |
| 453 | + | |
| 454 | + Owner({ | |
| 455 | + required this.displayName, | |
| 456 | + required this.id, | |
| 457 | + required this.screenName, | |
| 458 | + }); | |
| 459 | + | |
| 460 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 461 | + displayName: json["displayName"], | |
| 462 | + id: json["id"], | |
| 463 | + screenName: json["screenName"], | |
| 464 | + ); | |
| 465 | + | |
| 466 | + Map<String, dynamic> toJson() => { | |
| 467 | + "displayName": displayName, | |
| 468 | + "id": id, | |
| 469 | + "screenName": screenName, | |
| 470 | + }; | |
| 471 | +} | |
| 472 | + | |
| 473 | +class EnumValues<T> { | |
| 474 | + Map<String, T> map; | |
| 475 | + late Map<T, String> reverseMap; | |
| 476 | + | |
| 477 | + EnumValues(this.map); | |
| 478 | + | |
| 479 | + Map<T, String> get reverse { | |
| 480 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 481 | + return reverseMap; | |
| 482 | + } | |
| 483 | +} |
Test case
1 generated file · +373 −0test/inputs/json/misc/f82d9.json
Adartdefault / TopLevel.dart+373 −0
| @@ -0,0 +1,373 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String basePath; | |
| 13 | + final Definitions definitions; | |
| 14 | + final String host; | |
| 15 | + final Info info; | |
| 16 | + final Paths paths; | |
| 17 | + final List<String> produces; | |
| 18 | + final List<String> schemes; | |
| 19 | + final String swagger; | |
| 20 | + | |
| 21 | + TopLevel({ | |
| 22 | + required this.basePath, | |
| 23 | + required this.definitions, | |
| 24 | + required this.host, | |
| 25 | + required this.info, | |
| 26 | + required this.paths, | |
| 27 | + required this.produces, | |
| 28 | + required this.schemes, | |
| 29 | + required this.swagger, | |
| 30 | + }); | |
| 31 | + | |
| 32 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 33 | + basePath: json["basePath"], | |
| 34 | + definitions: Definitions.fromJson(json["definitions"]), | |
| 35 | + host: json["host"], | |
| 36 | + info: Info.fromJson(json["info"]), | |
| 37 | + paths: Paths.fromJson(json["paths"]), | |
| 38 | + produces: List<String>.from(json["produces"].map((x) => x)), | |
| 39 | + schemes: List<String>.from(json["schemes"].map((x) => x)), | |
| 40 | + swagger: json["swagger"], | |
| 41 | + ); | |
| 42 | + | |
| 43 | + Map<String, dynamic> toJson() => { | |
| 44 | + "basePath": basePath, | |
| 45 | + "definitions": definitions.toJson(), | |
| 46 | + "host": host, | |
| 47 | + "info": info.toJson(), | |
| 48 | + "paths": paths.toJson(), | |
| 49 | + "produces": List<dynamic>.from(produces.map((x) => x)), | |
| 50 | + "schemes": List<dynamic>.from(schemes.map((x) => x)), | |
| 51 | + "swagger": swagger, | |
| 52 | + }; | |
| 53 | +} | |
| 54 | + | |
| 55 | +class Definitions { | |
| 56 | + final Report report; | |
| 57 | + | |
| 58 | + Definitions({ | |
| 59 | + required this.report, | |
| 60 | + }); | |
| 61 | + | |
| 62 | + factory Definitions.fromJson(Map<String, dynamic> json) => Definitions( | |
| 63 | + report: Report.fromJson(json["Report"]), | |
| 64 | + ); | |
| 65 | + | |
| 66 | + Map<String, dynamic> toJson() => { | |
| 67 | + "Report": report.toJson(), | |
| 68 | + }; | |
| 69 | +} | |
| 70 | + | |
| 71 | +class Report { | |
| 72 | + final Properties properties; | |
| 73 | + | |
| 74 | + Report({ | |
| 75 | + required this.properties, | |
| 76 | + }); | |
| 77 | + | |
| 78 | + factory Report.fromJson(Map<String, dynamic> json) => Report( | |
| 79 | + properties: Properties.fromJson(json["properties"]), | |
| 80 | + ); | |
| 81 | + | |
| 82 | + Map<String, dynamic> toJson() => { | |
| 83 | + "properties": properties.toJson(), | |
| 84 | + }; | |
| 85 | +} | |
| 86 | + | |
| 87 | +class Properties { | |
| 88 | + final ClickUrl clickUrl; | |
| 89 | + final ClickUrl country; | |
| 90 | + final ClickUrl description; | |
| 91 | + final ClickUrl expirationDate; | |
| 92 | + final ClickUrl id; | |
| 93 | + final ClickUrl industry; | |
| 94 | + final ClickUrl reportType; | |
| 95 | + final ClickUrl sourceIndustry; | |
| 96 | + final ClickUrl title; | |
| 97 | + final ClickUrl url; | |
| 98 | + | |
| 99 | + Properties({ | |
| 100 | + required this.clickUrl, | |
| 101 | + required this.country, | |
| 102 | + required this.description, | |
| 103 | + required this.expirationDate, | |
| 104 | + required this.id, | |
| 105 | + required this.industry, | |
| 106 | + required this.reportType, | |
| 107 | + required this.sourceIndustry, | |
| 108 | + required this.title, | |
| 109 | + required this.url, | |
| 110 | + }); | |
| 111 | + | |
| 112 | + factory Properties.fromJson(Map<String, dynamic> json) => Properties( | |
| 113 | + clickUrl: ClickUrl.fromJson(json["click_url"]), | |
| 114 | + country: ClickUrl.fromJson(json["country"]), | |
| 115 | + description: ClickUrl.fromJson(json["description"]), | |
| 116 | + expirationDate: ClickUrl.fromJson(json["expiration_date"]), | |
| 117 | + id: ClickUrl.fromJson(json["id"]), | |
| 118 | + industry: ClickUrl.fromJson(json["industry"]), | |
| 119 | + reportType: ClickUrl.fromJson(json["report_type"]), | |
| 120 | + sourceIndustry: ClickUrl.fromJson(json["source_industry"]), | |
| 121 | + title: ClickUrl.fromJson(json["title"]), | |
| 122 | + url: ClickUrl.fromJson(json["url"]), | |
| 123 | + ); | |
| 124 | + | |
| 125 | + Map<String, dynamic> toJson() => { | |
| 126 | + "click_url": clickUrl.toJson(), | |
| 127 | + "country": country.toJson(), | |
| 128 | + "description": description.toJson(), | |
| 129 | + "expiration_date": expirationDate.toJson(), | |
| 130 | + "id": id.toJson(), | |
| 131 | + "industry": industry.toJson(), | |
| 132 | + "report_type": reportType.toJson(), | |
| 133 | + "source_industry": sourceIndustry.toJson(), | |
| 134 | + "title": title.toJson(), | |
| 135 | + "url": url.toJson(), | |
| 136 | + }; | |
| 137 | +} | |
| 138 | + | |
| 139 | +class ClickUrl { | |
| 140 | + final String description; | |
| 141 | + final Type type; | |
| 142 | + | |
| 143 | + ClickUrl({ | |
| 144 | + required this.description, | |
| 145 | + required this.type, | |
| 146 | + }); | |
| 147 | + | |
| 148 | + factory ClickUrl.fromJson(Map<String, dynamic> json) => ClickUrl( | |
| 149 | + description: json["description"], | |
| 150 | + type: typeValues.map[json["type"]]!, | |
| 151 | + ); | |
| 152 | + | |
| 153 | + Map<String, dynamic> toJson() => { | |
| 154 | + "description": description, | |
| 155 | + "type": typeValues.reverse[type], | |
| 156 | + }; | |
| 157 | +} | |
| 158 | + | |
| 159 | +enum Type { | |
| 160 | + STRING | |
| 161 | +} | |
| 162 | + | |
| 163 | +final typeValues = EnumValues({ | |
| 164 | + "string": Type.STRING | |
| 165 | +}); | |
| 166 | + | |
| 167 | +class Info { | |
| 168 | + final String description; | |
| 169 | + final String title; | |
| 170 | + final String version; | |
| 171 | + | |
| 172 | + Info({ | |
| 173 | + required this.description, | |
| 174 | + required this.title, | |
| 175 | + required this.version, | |
| 176 | + }); | |
| 177 | + | |
| 178 | + factory Info.fromJson(Map<String, dynamic> json) => Info( | |
| 179 | + description: json["description"], | |
| 180 | + title: json["title"], | |
| 181 | + version: json["version"], | |
| 182 | + ); | |
| 183 | + | |
| 184 | + Map<String, dynamic> toJson() => { | |
| 185 | + "description": description, | |
| 186 | + "title": title, | |
| 187 | + "version": version, | |
| 188 | + }; | |
| 189 | +} | |
| 190 | + | |
| 191 | +class Paths { | |
| 192 | + final MarketResearchLibrarySearch marketResearchLibrarySearch; | |
| 193 | + | |
| 194 | + Paths({ | |
| 195 | + required this.marketResearchLibrarySearch, | |
| 196 | + }); | |
| 197 | + | |
| 198 | + factory Paths.fromJson(Map<String, dynamic> json) => Paths( | |
| 199 | + marketResearchLibrarySearch: MarketResearchLibrarySearch.fromJson(json["/market_research_library/search"]), | |
| 200 | + ); | |
| 201 | + | |
| 202 | + Map<String, dynamic> toJson() => { | |
| 203 | + "/market_research_library/search": marketResearchLibrarySearch.toJson(), | |
| 204 | + }; | |
| 205 | +} | |
| 206 | + | |
| 207 | +class MarketResearchLibrarySearch { | |
| 208 | + final Get marketResearchLibrarySearchGet; | |
| 209 | + | |
| 210 | + MarketResearchLibrarySearch({ | |
| 211 | + required this.marketResearchLibrarySearchGet, | |
| 212 | + }); | |
| 213 | + | |
| 214 | + factory MarketResearchLibrarySearch.fromJson(Map<String, dynamic> json) => MarketResearchLibrarySearch( | |
| 215 | + marketResearchLibrarySearchGet: Get.fromJson(json["get"]), | |
| 216 | + ); | |
| 217 | + | |
| 218 | + Map<String, dynamic> toJson() => { | |
| 219 | + "get": marketResearchLibrarySearchGet.toJson(), | |
| 220 | + }; | |
| 221 | +} | |
| 222 | + | |
| 223 | +class Get { | |
| 224 | + final String description; | |
| 225 | + final List<Parameter> parameters; | |
| 226 | + final Responses responses; | |
| 227 | + final String summary; | |
| 228 | + final List<String> tags; | |
| 229 | + | |
| 230 | + Get({ | |
| 231 | + required this.description, | |
| 232 | + required this.parameters, | |
| 233 | + required this.responses, | |
| 234 | + required this.summary, | |
| 235 | + required this.tags, | |
| 236 | + }); | |
| 237 | + | |
| 238 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 239 | + description: json["description"], | |
| 240 | + parameters: List<Parameter>.from(json["parameters"].map((x) => Parameter.fromJson(x))), | |
| 241 | + responses: Responses.fromJson(json["responses"]), | |
| 242 | + summary: json["summary"], | |
| 243 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 244 | + ); | |
| 245 | + | |
| 246 | + Map<String, dynamic> toJson() => { | |
| 247 | + "description": description, | |
| 248 | + "parameters": List<dynamic>.from(parameters.map((x) => x.toJson())), | |
| 249 | + "responses": responses.toJson(), | |
| 250 | + "summary": summary, | |
| 251 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 252 | + }; | |
| 253 | +} | |
| 254 | + | |
| 255 | +class Parameter { | |
| 256 | + final String description; | |
| 257 | + final Type format; | |
| 258 | + final String name; | |
| 259 | + final String parameterIn; | |
| 260 | + final bool required; | |
| 261 | + final Type type; | |
| 262 | + | |
| 263 | + Parameter({ | |
| 264 | + required this.description, | |
| 265 | + required this.format, | |
| 266 | + required this.name, | |
| 267 | + required this.parameterIn, | |
| 268 | + required this.required, | |
| 269 | + required this.type, | |
| 270 | + }); | |
| 271 | + | |
| 272 | + factory Parameter.fromJson(Map<String, dynamic> json) => Parameter( | |
| 273 | + description: json["description"], | |
| 274 | + format: typeValues.map[json["format"]]!, | |
| 275 | + name: json["name"], | |
| 276 | + parameterIn: json["in"], | |
| 277 | + required: json["required"], | |
| 278 | + type: typeValues.map[json["type"]]!, | |
| 279 | + ); | |
| 280 | + | |
| 281 | + Map<String, dynamic> toJson() => { | |
| 282 | + "description": description, | |
| 283 | + "format": typeValues.reverse[format], | |
| 284 | + "name": name, | |
| 285 | + "in": parameterIn, | |
| 286 | + "required": required, | |
| 287 | + "type": typeValues.reverse[type], | |
| 288 | + }; | |
| 289 | +} | |
| 290 | + | |
| 291 | +class Responses { | |
| 292 | + final The200 the200; | |
| 293 | + | |
| 294 | + Responses({ | |
| 295 | + required this.the200, | |
| 296 | + }); | |
| 297 | + | |
| 298 | + factory Responses.fromJson(Map<String, dynamic> json) => Responses( | |
| 299 | + the200: The200.fromJson(json["200"]), | |
| 300 | + ); | |
| 301 | + | |
| 302 | + Map<String, dynamic> toJson() => { | |
| 303 | + "200": the200.toJson(), | |
| 304 | + }; | |
| 305 | +} | |
| 306 | + | |
| 307 | +class The200 { | |
| 308 | + final String description; | |
| 309 | + final Schema schema; | |
| 310 | + | |
| 311 | + The200({ | |
| 312 | + required this.description, | |
| 313 | + required this.schema, | |
| 314 | + }); | |
| 315 | + | |
| 316 | + factory The200.fromJson(Map<String, dynamic> json) => The200( | |
| 317 | + description: json["description"], | |
| 318 | + schema: Schema.fromJson(json["schema"]), | |
| 319 | + ); | |
| 320 | + | |
| 321 | + Map<String, dynamic> toJson() => { | |
| 322 | + "description": description, | |
| 323 | + "schema": schema.toJson(), | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Schema { | |
| 328 | + final Items items; | |
| 329 | + final String type; | |
| 330 | + | |
| 331 | + Schema({ | |
| 332 | + required this.items, | |
| 333 | + required this.type, | |
| 334 | + }); | |
| 335 | + | |
| 336 | + factory Schema.fromJson(Map<String, dynamic> json) => Schema( | |
| 337 | + items: Items.fromJson(json["items"]), | |
| 338 | + type: json["type"], | |
| 339 | + ); | |
| 340 | + | |
| 341 | + Map<String, dynamic> toJson() => { | |
| 342 | + "items": items.toJson(), | |
| 343 | + "type": type, | |
| 344 | + }; | |
| 345 | +} | |
| 346 | + | |
| 347 | +class Items { | |
| 348 | + final String ref; | |
| 349 | + | |
| 350 | + Items({ | |
| 351 | + required this.ref, | |
| 352 | + }); | |
| 353 | + | |
| 354 | + factory Items.fromJson(Map<String, dynamic> json) => Items( | |
| 355 | + ref: json["\u0024ref"], | |
| 356 | + ); | |
| 357 | + | |
| 358 | + Map<String, dynamic> toJson() => { | |
| 359 | + "\u0024ref": ref, | |
| 360 | + }; | |
| 361 | +} | |
| 362 | + | |
| 363 | +class EnumValues<T> { | |
| 364 | + Map<String, T> map; | |
| 365 | + late Map<T, String> reverseMap; | |
| 366 | + | |
| 367 | + EnumValues(this.map); | |
| 368 | + | |
| 369 | + Map<T, String> get reverse { | |
| 370 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 371 | + return reverseMap; | |
| 372 | + } | |
| 373 | +} |
Test case
1 generated file · +41 −0test/inputs/json/misc/f974d.json
Adartdefault / TopLevel.dart+41 −0
| @@ -0,0 +1,41 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int blockIndex; | |
| 13 | + final String hash; | |
| 14 | + final int height; | |
| 15 | + final int time; | |
| 16 | + final List<int> txIndexes; | |
| 17 | + | |
| 18 | + TopLevel({ | |
| 19 | + required this.blockIndex, | |
| 20 | + required this.hash, | |
| 21 | + required this.height, | |
| 22 | + required this.time, | |
| 23 | + required this.txIndexes, | |
| 24 | + }); | |
| 25 | + | |
| 26 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 27 | + blockIndex: json["block_index"], | |
| 28 | + hash: json["hash"], | |
| 29 | + height: json["height"], | |
| 30 | + time: json["time"], | |
| 31 | + txIndexes: List<int>.from(json["txIndexes"].map((x) => x)), | |
| 32 | + ); | |
| 33 | + | |
| 34 | + Map<String, dynamic> toJson() => { | |
| 35 | + "block_index": blockIndex, | |
| 36 | + "hash": hash, | |
| 37 | + "height": height, | |
| 38 | + "time": time, | |
| 39 | + "txIndexes": List<dynamic>.from(txIndexes.map((x) => x)), | |
| 40 | + }; | |
| 41 | +} |
Test case
1 generated file · +45 −0test/inputs/json/misc/faff5.json
Adartdefault / TopLevel.dart+45 −0
| @@ -0,0 +1,45 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Response response; | |
| 13 | + | |
| 14 | + TopLevel({ | |
| 15 | + required this.response, | |
| 16 | + }); | |
| 17 | + | |
| 18 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 19 | + response: Response.fromJson(json["response"]), | |
| 20 | + ); | |
| 21 | + | |
| 22 | + Map<String, dynamic> toJson() => { | |
| 23 | + "response": response.toJson(), | |
| 24 | + }; | |
| 25 | +} | |
| 26 | + | |
| 27 | +class Response { | |
| 28 | + final int playerCount; | |
| 29 | + final int result; | |
| 30 | + | |
| 31 | + Response({ | |
| 32 | + required this.playerCount, | |
| 33 | + required this.result, | |
| 34 | + }); | |
| 35 | + | |
| 36 | + factory Response.fromJson(Map<String, dynamic> json) => Response( | |
| 37 | + playerCount: json["player_count"], | |
| 38 | + result: json["result"], | |
| 39 | + ); | |
| 40 | + | |
| 41 | + Map<String, dynamic> toJson() => { | |
| 42 | + "player_count": playerCount, | |
| 43 | + "result": result, | |
| 44 | + }; | |
| 45 | +} |
Test case
1 generated file · +873 −0test/inputs/json/misc/fcca3.json
Adartdefault / TopLevel.dart+873 −0
| @@ -0,0 +1,873 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<List<dynamic>> data; | |
| 13 | + final Meta meta; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.meta, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: List<List<dynamic>>.from(json["data"].map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 22 | + meta: Meta.fromJson(json["meta"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": List<dynamic>.from(data.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 27 | + "meta": meta.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Meta { | |
| 32 | + final View view; | |
| 33 | + | |
| 34 | + Meta({ | |
| 35 | + required this.view, | |
| 36 | + }); | |
| 37 | + | |
| 38 | + factory Meta.fromJson(Map<String, dynamic> json) => Meta( | |
| 39 | + view: View.fromJson(json["view"]), | |
| 40 | + ); | |
| 41 | + | |
| 42 | + Map<String, dynamic> toJson() => { | |
| 43 | + "view": view.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class View { | |
| 48 | + final String attribution; | |
| 49 | + final int averageRating; | |
| 50 | + final String category; | |
| 51 | + final List<Column> columns; | |
| 52 | + final int createdAt; | |
| 53 | + final String description; | |
| 54 | + final String displayType; | |
| 55 | + final int downloadCount; | |
| 56 | + final List<String> flags; | |
| 57 | + final List<Grant> grants; | |
| 58 | + final bool hideFromCatalog; | |
| 59 | + final bool hideFromDataJson; | |
| 60 | + final String id; | |
| 61 | + final int indexUpdatedAt; | |
| 62 | + final String locale; | |
| 63 | + final ViewMetadata metadata; | |
| 64 | + final String name; | |
| 65 | + final bool newBackend; | |
| 66 | + final int numberOfComments; | |
| 67 | + final int oid; | |
| 68 | + final Owner owner; | |
| 69 | + final String provenance; | |
| 70 | + final bool publicationAppendEnabled; | |
| 71 | + final int publicationDate; | |
| 72 | + final int publicationGroup; | |
| 73 | + final String publicationStage; | |
| 74 | + final Query query; | |
| 75 | + final List<String> rights; | |
| 76 | + final int rowsUpdatedAt; | |
| 77 | + final String rowsUpdatedBy; | |
| 78 | + final Owner tableAuthor; | |
| 79 | + final int tableId; | |
| 80 | + final List<String> tags; | |
| 81 | + final int totalTimesRated; | |
| 82 | + final int viewCount; | |
| 83 | + final int viewLastModified; | |
| 84 | + final String viewType; | |
| 85 | + | |
| 86 | + View({ | |
| 87 | + required this.attribution, | |
| 88 | + required this.averageRating, | |
| 89 | + required this.category, | |
| 90 | + required this.columns, | |
| 91 | + required this.createdAt, | |
| 92 | + required this.description, | |
| 93 | + required this.displayType, | |
| 94 | + required this.downloadCount, | |
| 95 | + required this.flags, | |
| 96 | + required this.grants, | |
| 97 | + required this.hideFromCatalog, | |
| 98 | + required this.hideFromDataJson, | |
| 99 | + required this.id, | |
| 100 | + required this.indexUpdatedAt, | |
| 101 | + required this.locale, | |
| 102 | + required this.metadata, | |
| 103 | + required this.name, | |
| 104 | + required this.newBackend, | |
| 105 | + required this.numberOfComments, | |
| 106 | + required this.oid, | |
| 107 | + required this.owner, | |
| 108 | + required this.provenance, | |
| 109 | + required this.publicationAppendEnabled, | |
| 110 | + required this.publicationDate, | |
| 111 | + required this.publicationGroup, | |
| 112 | + required this.publicationStage, | |
| 113 | + required this.query, | |
| 114 | + required this.rights, | |
| 115 | + required this.rowsUpdatedAt, | |
| 116 | + required this.rowsUpdatedBy, | |
| 117 | + required this.tableAuthor, | |
| 118 | + required this.tableId, | |
| 119 | + required this.tags, | |
| 120 | + required this.totalTimesRated, | |
| 121 | + required this.viewCount, | |
| 122 | + required this.viewLastModified, | |
| 123 | + required this.viewType, | |
| 124 | + }); | |
| 125 | + | |
| 126 | + factory View.fromJson(Map<String, dynamic> json) => View( | |
| 127 | + attribution: json["attribution"], | |
| 128 | + averageRating: json["averageRating"], | |
| 129 | + category: json["category"], | |
| 130 | + columns: List<Column>.from(json["columns"].map((x) => Column.fromJson(x))), | |
| 131 | + createdAt: json["createdAt"], | |
| 132 | + description: json["description"], | |
| 133 | + displayType: json["displayType"], | |
| 134 | + downloadCount: json["downloadCount"], | |
| 135 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 136 | + grants: List<Grant>.from(json["grants"].map((x) => Grant.fromJson(x))), | |
| 137 | + hideFromCatalog: json["hideFromCatalog"], | |
| 138 | + hideFromDataJson: json["hideFromDataJson"], | |
| 139 | + id: json["id"], | |
| 140 | + indexUpdatedAt: json["indexUpdatedAt"], | |
| 141 | + locale: json["locale"], | |
| 142 | + metadata: ViewMetadata.fromJson(json["metadata"]), | |
| 143 | + name: json["name"], | |
| 144 | + newBackend: json["newBackend"], | |
| 145 | + numberOfComments: json["numberOfComments"], | |
| 146 | + oid: json["oid"], | |
| 147 | + owner: Owner.fromJson(json["owner"]), | |
| 148 | + provenance: json["provenance"], | |
| 149 | + publicationAppendEnabled: json["publicationAppendEnabled"], | |
| 150 | + publicationDate: json["publicationDate"], | |
| 151 | + publicationGroup: json["publicationGroup"], | |
| 152 | + publicationStage: json["publicationStage"], | |
| 153 | + query: Query.fromJson(json["query"]), | |
| 154 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 155 | + rowsUpdatedAt: json["rowsUpdatedAt"], | |
| 156 | + rowsUpdatedBy: json["rowsUpdatedBy"], | |
| 157 | + tableAuthor: Owner.fromJson(json["tableAuthor"]), | |
| 158 | + tableId: json["tableId"], | |
| 159 | + tags: List<String>.from(json["tags"].map((x) => x)), | |
| 160 | + totalTimesRated: json["totalTimesRated"], | |
| 161 | + viewCount: json["viewCount"], | |
| 162 | + viewLastModified: json["viewLastModified"], | |
| 163 | + viewType: json["viewType"], | |
| 164 | + ); | |
| 165 | + | |
| 166 | + Map<String, dynamic> toJson() => { | |
| 167 | + "attribution": attribution, | |
| 168 | + "averageRating": averageRating, | |
| 169 | + "category": category, | |
| 170 | + "columns": List<dynamic>.from(columns.map((x) => x.toJson())), | |
| 171 | + "createdAt": createdAt, | |
| 172 | + "description": description, | |
| 173 | + "displayType": displayType, | |
| 174 | + "downloadCount": downloadCount, | |
| 175 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 176 | + "grants": List<dynamic>.from(grants.map((x) => x.toJson())), | |
| 177 | + "hideFromCatalog": hideFromCatalog, | |
| 178 | + "hideFromDataJson": hideFromDataJson, | |
| 179 | + "id": id, | |
| 180 | + "indexUpdatedAt": indexUpdatedAt, | |
| 181 | + "locale": locale, | |
| 182 | + "metadata": metadata.toJson(), | |
| 183 | + "name": name, | |
| 184 | + "newBackend": newBackend, | |
| 185 | + "numberOfComments": numberOfComments, | |
| 186 | + "oid": oid, | |
| 187 | + "owner": owner.toJson(), | |
| 188 | + "provenance": provenance, | |
| 189 | + "publicationAppendEnabled": publicationAppendEnabled, | |
| 190 | + "publicationDate": publicationDate, | |
| 191 | + "publicationGroup": publicationGroup, | |
| 192 | + "publicationStage": publicationStage, | |
| 193 | + "query": query.toJson(), | |
| 194 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 195 | + "rowsUpdatedAt": rowsUpdatedAt, | |
| 196 | + "rowsUpdatedBy": rowsUpdatedBy, | |
| 197 | + "tableAuthor": tableAuthor.toJson(), | |
| 198 | + "tableId": tableId, | |
| 199 | + "tags": List<dynamic>.from(tags.map((x) => x)), | |
| 200 | + "totalTimesRated": totalTimesRated, | |
| 201 | + "viewCount": viewCount, | |
| 202 | + "viewLastModified": viewLastModified, | |
| 203 | + "viewType": viewType, | |
| 204 | + }; | |
| 205 | +} | |
| 206 | + | |
| 207 | +class Column { | |
| 208 | + final CachedContents? cachedContents; | |
| 209 | + final TypeName dataTypeName; | |
| 210 | + final String? description; | |
| 211 | + final String fieldName; | |
| 212 | + final List<String>? flags; | |
| 213 | + final Format format; | |
| 214 | + final int id; | |
| 215 | + final String name; | |
| 216 | + final int position; | |
| 217 | + final TypeName renderTypeName; | |
| 218 | + final int? tableColumnId; | |
| 219 | + final int? width; | |
| 220 | + | |
| 221 | + Column({ | |
| 222 | + this.cachedContents, | |
| 223 | + required this.dataTypeName, | |
| 224 | + this.description, | |
| 225 | + required this.fieldName, | |
| 226 | + this.flags, | |
| 227 | + required this.format, | |
| 228 | + required this.id, | |
| 229 | + required this.name, | |
| 230 | + required this.position, | |
| 231 | + required this.renderTypeName, | |
| 232 | + this.tableColumnId, | |
| 233 | + this.width, | |
| 234 | + }); | |
| 235 | + | |
| 236 | + factory Column.fromJson(Map<String, dynamic> json) => Column( | |
| 237 | + cachedContents: json["cachedContents"] == null ? null : CachedContents.fromJson(json["cachedContents"]), | |
| 238 | + dataTypeName: typeNameValues.map[json["dataTypeName"]]!, | |
| 239 | + description: json["description"], | |
| 240 | + fieldName: json["fieldName"], | |
| 241 | + flags: json["flags"] == null ? null : List<String>.from(json["flags"]!.map((x) => x)), | |
| 242 | + format: Format.fromJson(json["format"]), | |
| 243 | + id: json["id"], | |
| 244 | + name: json["name"], | |
| 245 | + position: json["position"], | |
| 246 | + renderTypeName: typeNameValues.map[json["renderTypeName"]]!, | |
| 247 | + tableColumnId: json["tableColumnId"], | |
| 248 | + width: json["width"], | |
| 249 | + ); | |
| 250 | + | |
| 251 | + Map<String, dynamic> toJson() => { | |
| 252 | + "cachedContents": cachedContents?.toJson(), | |
| 253 | + "dataTypeName": typeNameValues.reverse[dataTypeName], | |
| 254 | + "description": description, | |
| 255 | + "fieldName": fieldName, | |
| 256 | + "flags": flags == null ? null : List<dynamic>.from(flags!.map((x) => x)), | |
| 257 | + "format": format.toJson(), | |
| 258 | + "id": id, | |
| 259 | + "name": name, | |
| 260 | + "position": position, | |
| 261 | + "renderTypeName": typeNameValues.reverse[renderTypeName], | |
| 262 | + "tableColumnId": tableColumnId, | |
| 263 | + "width": width, | |
| 264 | + }; | |
| 265 | +} | |
| 266 | + | |
| 267 | +class CachedContents { | |
| 268 | + final String? average; | |
| 269 | + final int cachedContentsNull; | |
| 270 | + final String largest; | |
| 271 | + final int nonNull; | |
| 272 | + final String smallest; | |
| 273 | + final String? sum; | |
| 274 | + final List<Top> top; | |
| 275 | + | |
| 276 | + CachedContents({ | |
| 277 | + this.average, | |
| 278 | + required this.cachedContentsNull, | |
| 279 | + required this.largest, | |
| 280 | + required this.nonNull, | |
| 281 | + required this.smallest, | |
| 282 | + this.sum, | |
| 283 | + required this.top, | |
| 284 | + }); | |
| 285 | + | |
| 286 | + factory CachedContents.fromJson(Map<String, dynamic> json) => CachedContents( | |
| 287 | + average: json["average"], | |
| 288 | + cachedContentsNull: json["null"], | |
| 289 | + largest: json["largest"], | |
| 290 | + nonNull: json["non_null"], | |
| 291 | + smallest: json["smallest"], | |
| 292 | + sum: json["sum"], | |
| 293 | + top: List<Top>.from(json["top"].map((x) => Top.fromJson(x))), | |
| 294 | + ); | |
| 295 | + | |
| 296 | + Map<String, dynamic> toJson() => { | |
| 297 | + "average": average, | |
| 298 | + "null": cachedContentsNull, | |
| 299 | + "largest": largest, | |
| 300 | + "non_null": nonNull, | |
| 301 | + "smallest": smallest, | |
| 302 | + "sum": sum, | |
| 303 | + "top": List<dynamic>.from(top.map((x) => x.toJson())), | |
| 304 | + }; | |
| 305 | +} | |
| 306 | + | |
| 307 | +class Top { | |
| 308 | + final int count; | |
| 309 | + final String item; | |
| 310 | + | |
| 311 | + Top({ | |
| 312 | + required this.count, | |
| 313 | + required this.item, | |
| 314 | + }); | |
| 315 | + | |
| 316 | + factory Top.fromJson(Map<String, dynamic> json) => Top( | |
| 317 | + count: json["count"], | |
| 318 | + item: json["item"], | |
| 319 | + ); | |
| 320 | + | |
| 321 | + Map<String, dynamic> toJson() => { | |
| 322 | + "count": count, | |
| 323 | + "item": item, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +enum TypeName { | |
| 328 | + META_DATA, | |
| 329 | + NUMBER, | |
| 330 | + TEXT | |
| 331 | +} | |
| 332 | + | |
| 333 | +final typeNameValues = EnumValues({ | |
| 334 | + "meta_data": TypeName.META_DATA, | |
| 335 | + "number": TypeName.NUMBER, | |
| 336 | + "text": TypeName.TEXT | |
| 337 | +}); | |
| 338 | + | |
| 339 | +class Format { | |
| 340 | + final String? align; | |
| 341 | + final String? noCommas; | |
| 342 | + final String? precisionStyle; | |
| 343 | + | |
| 344 | + Format({ | |
| 345 | + this.align, | |
| 346 | + this.noCommas, | |
| 347 | + this.precisionStyle, | |
| 348 | + }); | |
| 349 | + | |
| 350 | + factory Format.fromJson(Map<String, dynamic> json) => Format( | |
| 351 | + align: json["align"], | |
| 352 | + noCommas: json["noCommas"], | |
| 353 | + precisionStyle: json["precisionStyle"], | |
| 354 | + ); | |
| 355 | + | |
| 356 | + Map<String, dynamic> toJson() => { | |
| 357 | + "align": align, | |
| 358 | + "noCommas": noCommas, | |
| 359 | + "precisionStyle": precisionStyle, | |
| 360 | + }; | |
| 361 | +} | |
| 362 | + | |
| 363 | +class Grant { | |
| 364 | + final List<String> flags; | |
| 365 | + final bool inherited; | |
| 366 | + final String type; | |
| 367 | + | |
| 368 | + Grant({ | |
| 369 | + required this.flags, | |
| 370 | + required this.inherited, | |
| 371 | + required this.type, | |
| 372 | + }); | |
| 373 | + | |
| 374 | + factory Grant.fromJson(Map<String, dynamic> json) => Grant( | |
| 375 | + flags: List<String>.from(json["flags"].map((x) => x)), | |
| 376 | + inherited: json["inherited"], | |
| 377 | + type: json["type"], | |
| 378 | + ); | |
| 379 | + | |
| 380 | + Map<String, dynamic> toJson() => { | |
| 381 | + "flags": List<dynamic>.from(flags.map((x) => x)), | |
| 382 | + "inherited": inherited, | |
| 383 | + "type": type, | |
| 384 | + }; | |
| 385 | +} | |
| 386 | + | |
| 387 | +class ViewMetadata { | |
| 388 | + final List<Attachment> attachments; | |
| 389 | + final List<String> availableDisplayTypes; | |
| 390 | + final CustomFields customFields; | |
| 391 | + final FilterCondition filterCondition; | |
| 392 | + final JsonQuery jsonQuery; | |
| 393 | + final String rdfSubject; | |
| 394 | + final RenderTypeConfig renderTypeConfig; | |
| 395 | + final String rowLabel; | |
| 396 | + | |
| 397 | + ViewMetadata({ | |
| 398 | + required this.attachments, | |
| 399 | + required this.availableDisplayTypes, | |
| 400 | + required this.customFields, | |
| 401 | + required this.filterCondition, | |
| 402 | + required this.jsonQuery, | |
| 403 | + required this.rdfSubject, | |
| 404 | + required this.renderTypeConfig, | |
| 405 | + required this.rowLabel, | |
| 406 | + }); | |
| 407 | + | |
| 408 | + factory ViewMetadata.fromJson(Map<String, dynamic> json) => ViewMetadata( | |
| 409 | + attachments: List<Attachment>.from(json["attachments"].map((x) => Attachment.fromJson(x))), | |
| 410 | + availableDisplayTypes: List<String>.from(json["availableDisplayTypes"].map((x) => x)), | |
| 411 | + customFields: CustomFields.fromJson(json["custom_fields"]), | |
| 412 | + filterCondition: FilterCondition.fromJson(json["filterCondition"]), | |
| 413 | + jsonQuery: JsonQuery.fromJson(json["jsonQuery"]), | |
| 414 | + rdfSubject: json["rdfSubject"], | |
| 415 | + renderTypeConfig: RenderTypeConfig.fromJson(json["renderTypeConfig"]), | |
| 416 | + rowLabel: json["rowLabel"], | |
| 417 | + ); | |
| 418 | + | |
| 419 | + Map<String, dynamic> toJson() => { | |
| 420 | + "attachments": List<dynamic>.from(attachments.map((x) => x.toJson())), | |
| 421 | + "availableDisplayTypes": List<dynamic>.from(availableDisplayTypes.map((x) => x)), | |
| 422 | + "custom_fields": customFields.toJson(), | |
| 423 | + "filterCondition": filterCondition.toJson(), | |
| 424 | + "jsonQuery": jsonQuery.toJson(), | |
| 425 | + "rdfSubject": rdfSubject, | |
| 426 | + "renderTypeConfig": renderTypeConfig.toJson(), | |
| 427 | + "rowLabel": rowLabel, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class Attachment { | |
| 432 | + final String assetId; | |
| 433 | + final String blobId; | |
| 434 | + final String filename; | |
| 435 | + final String name; | |
| 436 | + | |
| 437 | + Attachment({ | |
| 438 | + required this.assetId, | |
| 439 | + required this.blobId, | |
| 440 | + required this.filename, | |
| 441 | + required this.name, | |
| 442 | + }); | |
| 443 | + | |
| 444 | + factory Attachment.fromJson(Map<String, dynamic> json) => Attachment( | |
| 445 | + assetId: json["assetId"], | |
| 446 | + blobId: json["blobId"], | |
| 447 | + filename: json["filename"], | |
| 448 | + name: json["name"], | |
| 449 | + ); | |
| 450 | + | |
| 451 | + Map<String, dynamic> toJson() => { | |
| 452 | + "assetId": assetId, | |
| 453 | + "blobId": blobId, | |
| 454 | + "filename": filename, | |
| 455 | + "name": name, | |
| 456 | + }; | |
| 457 | +} | |
| 458 | + | |
| 459 | +class CustomFields { | |
| 460 | + final CommonCore commonCore; | |
| 461 | + final DatasetInformation datasetInformation; | |
| 462 | + final DatasetSummary datasetSummary; | |
| 463 | + final Disclaimers disclaimers; | |
| 464 | + | |
| 465 | + CustomFields({ | |
| 466 | + required this.commonCore, | |
| 467 | + required this.datasetInformation, | |
| 468 | + required this.datasetSummary, | |
| 469 | + required this.disclaimers, | |
| 470 | + }); | |
| 471 | + | |
| 472 | + factory CustomFields.fromJson(Map<String, dynamic> json) => CustomFields( | |
| 473 | + commonCore: CommonCore.fromJson(json["Common Core"]), | |
| 474 | + datasetInformation: DatasetInformation.fromJson(json["Dataset Information"]), | |
| 475 | + datasetSummary: DatasetSummary.fromJson(json["Dataset Summary"]), | |
| 476 | + disclaimers: Disclaimers.fromJson(json["Disclaimers"]), | |
| 477 | + ); | |
| 478 | + | |
| 479 | + Map<String, dynamic> toJson() => { | |
| 480 | + "Common Core": commonCore.toJson(), | |
| 481 | + "Dataset Information": datasetInformation.toJson(), | |
| 482 | + "Dataset Summary": datasetSummary.toJson(), | |
| 483 | + "Disclaimers": disclaimers.toJson(), | |
| 484 | + }; | |
| 485 | +} | |
| 486 | + | |
| 487 | +class CommonCore { | |
| 488 | + final String contactEmail; | |
| 489 | + final String contactName; | |
| 490 | + final String publisher; | |
| 491 | + | |
| 492 | + CommonCore({ | |
| 493 | + required this.contactEmail, | |
| 494 | + required this.contactName, | |
| 495 | + required this.publisher, | |
| 496 | + }); | |
| 497 | + | |
| 498 | + factory CommonCore.fromJson(Map<String, dynamic> json) => CommonCore( | |
| 499 | + contactEmail: json["Contact Email"], | |
| 500 | + contactName: json["Contact Name"], | |
| 501 | + publisher: json["Publisher"], | |
| 502 | + ); | |
| 503 | + | |
| 504 | + Map<String, dynamic> toJson() => { | |
| 505 | + "Contact Email": contactEmail, | |
| 506 | + "Contact Name": contactName, | |
| 507 | + "Publisher": publisher, | |
| 508 | + }; | |
| 509 | +} | |
| 510 | + | |
| 511 | +class DatasetInformation { | |
| 512 | + final String agency; | |
| 513 | + | |
| 514 | + DatasetInformation({ | |
| 515 | + required this.agency, | |
| 516 | + }); | |
| 517 | + | |
| 518 | + factory DatasetInformation.fromJson(Map<String, dynamic> json) => DatasetInformation( | |
| 519 | + agency: json["Agency"], | |
| 520 | + ); | |
| 521 | + | |
| 522 | + Map<String, dynamic> toJson() => { | |
| 523 | + "Agency": agency, | |
| 524 | + }; | |
| 525 | +} | |
| 526 | + | |
| 527 | +class DatasetSummary { | |
| 528 | + final String contactInformation; | |
| 529 | + final String coverage; | |
| 530 | + final String granularity; | |
| 531 | + final String organization; | |
| 532 | + final String postingFrequency; | |
| 533 | + final String timePeriod; | |
| 534 | + | |
| 535 | + DatasetSummary({ | |
| 536 | + required this.contactInformation, | |
| 537 | + required this.coverage, | |
| 538 | + required this.granularity, | |
| 539 | + required this.organization, | |
| 540 | + required this.postingFrequency, | |
| 541 | + required this.timePeriod, | |
| 542 | + }); | |
| 543 | + | |
| 544 | + factory DatasetSummary.fromJson(Map<String, dynamic> json) => DatasetSummary( | |
| 545 | + contactInformation: json["Contact Information"], | |
| 546 | + coverage: json["Coverage"], | |
| 547 | + granularity: json["Granularity"], | |
| 548 | + organization: json["Organization"], | |
| 549 | + postingFrequency: json["Posting Frequency"], | |
| 550 | + timePeriod: json["Time Period"], | |
| 551 | + ); | |
| 552 | + | |
| 553 | + Map<String, dynamic> toJson() => { | |
| 554 | + "Contact Information": contactInformation, | |
| 555 | + "Coverage": coverage, | |
| 556 | + "Granularity": granularity, | |
| 557 | + "Organization": organization, | |
| 558 | + "Posting Frequency": postingFrequency, | |
| 559 | + "Time Period": timePeriod, | |
| 560 | + }; | |
| 561 | +} | |
| 562 | + | |
| 563 | +class Disclaimers { | |
| 564 | + final String disclaimer; | |
| 565 | + final String limitations; | |
| 566 | + | |
| 567 | + Disclaimers({ | |
| 568 | + required this.disclaimer, | |
| 569 | + required this.limitations, | |
| 570 | + }); | |
| 571 | + | |
| 572 | + factory Disclaimers.fromJson(Map<String, dynamic> json) => Disclaimers( | |
| 573 | + disclaimer: json["Disclaimer"], | |
| 574 | + limitations: json["Limitations"], | |
| 575 | + ); | |
| 576 | + | |
| 577 | + Map<String, dynamic> toJson() => { | |
| 578 | + "Disclaimer": disclaimer, | |
| 579 | + "Limitations": limitations, | |
| 580 | + }; | |
| 581 | +} | |
| 582 | + | |
| 583 | +class FilterCondition { | |
| 584 | + final List<Child> children; | |
| 585 | + final FilterConditionMetadata metadata; | |
| 586 | + final String type; | |
| 587 | + final String value; | |
| 588 | + | |
| 589 | + FilterCondition({ | |
| 590 | + required this.children, | |
| 591 | + required this.metadata, | |
| 592 | + required this.type, | |
| 593 | + required this.value, | |
| 594 | + }); | |
| 595 | + | |
| 596 | + factory FilterCondition.fromJson(Map<String, dynamic> json) => FilterCondition( | |
| 597 | + children: List<Child>.from(json["children"].map((x) => Child.fromJson(x))), | |
| 598 | + metadata: FilterConditionMetadata.fromJson(json["metadata"]), | |
| 599 | + type: json["type"], | |
| 600 | + value: json["value"], | |
| 601 | + ); | |
| 602 | + | |
| 603 | + Map<String, dynamic> toJson() => { | |
| 604 | + "children": List<dynamic>.from(children.map((x) => x.toJson())), | |
| 605 | + "metadata": metadata.toJson(), | |
| 606 | + "type": type, | |
| 607 | + "value": value, | |
| 608 | + }; | |
| 609 | +} | |
| 610 | + | |
| 611 | +class Child { | |
| 612 | + final ChildMetadata metadata; | |
| 613 | + final String type; | |
| 614 | + final String value; | |
| 615 | + | |
| 616 | + Child({ | |
| 617 | + required this.metadata, | |
| 618 | + required this.type, | |
| 619 | + required this.value, | |
| 620 | + }); | |
| 621 | + | |
| 622 | + factory Child.fromJson(Map<String, dynamic> json) => Child( | |
| 623 | + metadata: ChildMetadata.fromJson(json["metadata"]), | |
| 624 | + type: json["type"], | |
| 625 | + value: json["value"], | |
| 626 | + ); | |
| 627 | + | |
| 628 | + Map<String, dynamic> toJson() => { | |
| 629 | + "metadata": metadata.toJson(), | |
| 630 | + "type": type, | |
| 631 | + "value": value, | |
| 632 | + }; | |
| 633 | +} | |
| 634 | + | |
| 635 | +class ChildMetadata { | |
| 636 | + final List<List<String>> customValues; | |
| 637 | + final String metadataOperator; | |
| 638 | + final TableColumnId tableColumnId; | |
| 639 | + | |
| 640 | + ChildMetadata({ | |
| 641 | + required this.customValues, | |
| 642 | + required this.metadataOperator, | |
| 643 | + required this.tableColumnId, | |
| 644 | + }); | |
| 645 | + | |
| 646 | + factory ChildMetadata.fromJson(Map<String, dynamic> json) => ChildMetadata( | |
| 647 | + customValues: List<List<String>>.from(json["customValues"].map((x) => List<String>.from(x.map((x) => x)))), | |
| 648 | + metadataOperator: json["operator"], | |
| 649 | + tableColumnId: TableColumnId.fromJson(json["tableColumnId"]), | |
| 650 | + ); | |
| 651 | + | |
| 652 | + Map<String, dynamic> toJson() => { | |
| 653 | + "customValues": List<dynamic>.from(customValues.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 654 | + "operator": metadataOperator, | |
| 655 | + "tableColumnId": tableColumnId.toJson(), | |
| 656 | + }; | |
| 657 | +} | |
| 658 | + | |
| 659 | +class TableColumnId { | |
| 660 | + final int the703610; | |
| 661 | + | |
| 662 | + TableColumnId({ | |
| 663 | + required this.the703610, | |
| 664 | + }); | |
| 665 | + | |
| 666 | + factory TableColumnId.fromJson(Map<String, dynamic> json) => TableColumnId( | |
| 667 | + the703610: json["703610"], | |
| 668 | + ); | |
| 669 | + | |
| 670 | + Map<String, dynamic> toJson() => { | |
| 671 | + "703610": the703610, | |
| 672 | + }; | |
| 673 | +} | |
| 674 | + | |
| 675 | +class FilterConditionMetadata { | |
| 676 | + final bool advanced; | |
| 677 | + final int unifiedVersion; | |
| 678 | + | |
| 679 | + FilterConditionMetadata({ | |
| 680 | + required this.advanced, | |
| 681 | + required this.unifiedVersion, | |
| 682 | + }); | |
| 683 | + | |
| 684 | + factory FilterConditionMetadata.fromJson(Map<String, dynamic> json) => FilterConditionMetadata( | |
| 685 | + advanced: json["advanced"], | |
| 686 | + unifiedVersion: json["unifiedVersion"], | |
| 687 | + ); | |
| 688 | + | |
| 689 | + Map<String, dynamic> toJson() => { | |
| 690 | + "advanced": advanced, | |
| 691 | + "unifiedVersion": unifiedVersion, | |
| 692 | + }; | |
| 693 | +} | |
| 694 | + | |
| 695 | +class JsonQuery { | |
| 696 | + final List<Order> order; | |
| 697 | + | |
| 698 | + JsonQuery({ | |
| 699 | + required this.order, | |
| 700 | + }); | |
| 701 | + | |
| 702 | + factory JsonQuery.fromJson(Map<String, dynamic> json) => JsonQuery( | |
| 703 | + order: List<Order>.from(json["order"].map((x) => Order.fromJson(x))), | |
| 704 | + ); | |
| 705 | + | |
| 706 | + Map<String, dynamic> toJson() => { | |
| 707 | + "order": List<dynamic>.from(order.map((x) => x.toJson())), | |
| 708 | + }; | |
| 709 | +} | |
| 710 | + | |
| 711 | +class Order { | |
| 712 | + final bool ascending; | |
| 713 | + final String columnFieldName; | |
| 714 | + | |
| 715 | + Order({ | |
| 716 | + required this.ascending, | |
| 717 | + required this.columnFieldName, | |
| 718 | + }); | |
| 719 | + | |
| 720 | + factory Order.fromJson(Map<String, dynamic> json) => Order( | |
| 721 | + ascending: json["ascending"], | |
| 722 | + columnFieldName: json["columnFieldName"], | |
| 723 | + ); | |
| 724 | + | |
| 725 | + Map<String, dynamic> toJson() => { | |
| 726 | + "ascending": ascending, | |
| 727 | + "columnFieldName": columnFieldName, | |
| 728 | + }; | |
| 729 | +} | |
| 730 | + | |
| 731 | +class RenderTypeConfig { | |
| 732 | + final Visible visible; | |
| 733 | + | |
| 734 | + RenderTypeConfig({ | |
| 735 | + required this.visible, | |
| 736 | + }); | |
| 737 | + | |
| 738 | + factory RenderTypeConfig.fromJson(Map<String, dynamic> json) => RenderTypeConfig( | |
| 739 | + visible: Visible.fromJson(json["visible"]), | |
| 740 | + ); | |
| 741 | + | |
| 742 | + Map<String, dynamic> toJson() => { | |
| 743 | + "visible": visible.toJson(), | |
| 744 | + }; | |
| 745 | +} | |
| 746 | + | |
| 747 | +class Visible { | |
| 748 | + final bool table; | |
| 749 | + | |
| 750 | + Visible({ | |
| 751 | + required this.table, | |
| 752 | + }); | |
| 753 | + | |
| 754 | + factory Visible.fromJson(Map<String, dynamic> json) => Visible( | |
| 755 | + table: json["table"], | |
| 756 | + ); | |
| 757 | + | |
| 758 | + Map<String, dynamic> toJson() => { | |
| 759 | + "table": table, | |
| 760 | + }; | |
| 761 | +} | |
| 762 | + | |
| 763 | +class Owner { | |
| 764 | + final String displayName; | |
| 765 | + final String id; | |
| 766 | + final String profileImageUrlLarge; | |
| 767 | + final String profileImageUrlMedium; | |
| 768 | + final String profileImageUrlSmall; | |
| 769 | + final List<String> rights; | |
| 770 | + final String roleName; | |
| 771 | + final String screenName; | |
| 772 | + | |
| 773 | + Owner({ | |
| 774 | + required this.displayName, | |
| 775 | + required this.id, | |
| 776 | + required this.profileImageUrlLarge, | |
| 777 | + required this.profileImageUrlMedium, | |
| 778 | + required this.profileImageUrlSmall, | |
| 779 | + required this.rights, | |
| 780 | + required this.roleName, | |
| 781 | + required this.screenName, | |
| 782 | + }); | |
| 783 | + | |
| 784 | + factory Owner.fromJson(Map<String, dynamic> json) => Owner( | |
| 785 | + displayName: json["displayName"], | |
| 786 | + id: json["id"], | |
| 787 | + profileImageUrlLarge: json["profileImageUrlLarge"], | |
| 788 | + profileImageUrlMedium: json["profileImageUrlMedium"], | |
| 789 | + profileImageUrlSmall: json["profileImageUrlSmall"], | |
| 790 | + rights: List<String>.from(json["rights"].map((x) => x)), | |
| 791 | + roleName: json["roleName"], | |
| 792 | + screenName: json["screenName"], | |
| 793 | + ); | |
| 794 | + | |
| 795 | + Map<String, dynamic> toJson() => { | |
| 796 | + "displayName": displayName, | |
| 797 | + "id": id, | |
| 798 | + "profileImageUrlLarge": profileImageUrlLarge, | |
| 799 | + "profileImageUrlMedium": profileImageUrlMedium, | |
| 800 | + "profileImageUrlSmall": profileImageUrlSmall, | |
| 801 | + "rights": List<dynamic>.from(rights.map((x) => x)), | |
| 802 | + "roleName": roleName, | |
| 803 | + "screenName": screenName, | |
| 804 | + }; | |
| 805 | +} | |
| 806 | + | |
| 807 | +class Query { | |
| 808 | + final List<OrderBy> orderBys; | |
| 809 | + | |
| 810 | + Query({ | |
| 811 | + required this.orderBys, | |
| 812 | + }); | |
| 813 | + | |
| 814 | + factory Query.fromJson(Map<String, dynamic> json) => Query( | |
| 815 | + orderBys: List<OrderBy>.from(json["orderBys"].map((x) => OrderBy.fromJson(x))), | |
| 816 | + ); | |
| 817 | + | |
| 818 | + Map<String, dynamic> toJson() => { | |
| 819 | + "orderBys": List<dynamic>.from(orderBys.map((x) => x.toJson())), | |
| 820 | + }; | |
| 821 | +} | |
| 822 | + | |
| 823 | +class OrderBy { | |
| 824 | + final bool ascending; | |
| 825 | + final Expression expression; | |
| 826 | + | |
| 827 | + OrderBy({ | |
| 828 | + required this.ascending, | |
| 829 | + required this.expression, | |
| 830 | + }); | |
| 831 | + | |
| 832 | + factory OrderBy.fromJson(Map<String, dynamic> json) => OrderBy( | |
| 833 | + ascending: json["ascending"], | |
| 834 | + expression: Expression.fromJson(json["expression"]), | |
| 835 | + ); | |
| 836 | + | |
| 837 | + Map<String, dynamic> toJson() => { | |
| 838 | + "ascending": ascending, | |
| 839 | + "expression": expression.toJson(), | |
| 840 | + }; | |
| 841 | +} | |
| 842 | + | |
| 843 | +class Expression { | |
| 844 | + final int columnId; | |
| 845 | + final String type; | |
| 846 | + | |
| 847 | + Expression({ | |
| 848 | + required this.columnId, | |
| 849 | + required this.type, | |
| 850 | + }); | |
| 851 | + | |
| 852 | + factory Expression.fromJson(Map<String, dynamic> json) => Expression( | |
| 853 | + columnId: json["columnId"], | |
| 854 | + type: json["type"], | |
| 855 | + ); | |
| 856 | + | |
| 857 | + Map<String, dynamic> toJson() => { | |
| 858 | + "columnId": columnId, | |
| 859 | + "type": type, | |
| 860 | + }; | |
| 861 | +} | |
| 862 | + | |
| 863 | +class EnumValues<T> { | |
| 864 | + Map<String, T> map; | |
| 865 | + late Map<T, String> reverseMap; | |
| 866 | + | |
| 867 | + EnumValues(this.map); | |
| 868 | + | |
| 869 | + Map<T, String> get reverse { | |
| 870 | + reverseMap = map.map((k, v) => MapEntry(v, k)); | |
| 871 | + return reverseMap; | |
| 872 | + } | |
| 873 | +} |
Test case
1 generated file · +77 −0test/inputs/json/misc/fd329.json
Adartdefault / TopLevel.dart+77 −0
| @@ -0,0 +1,77 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final Map<String, Datum> data; | |
| 13 | + final Description description; | |
| 14 | + | |
| 15 | + TopLevel({ | |
| 16 | + required this.data, | |
| 17 | + required this.description, | |
| 18 | + }); | |
| 19 | + | |
| 20 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 21 | + data: Map.from(json["data"]).map((k, v) => MapEntry<String, Datum>(k, Datum.fromJson(v))), | |
| 22 | + description: Description.fromJson(json["description"]), | |
| 23 | + ); | |
| 24 | + | |
| 25 | + Map<String, dynamic> toJson() => { | |
| 26 | + "data": Map.from(data).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 27 | + "description": description.toJson(), | |
| 28 | + }; | |
| 29 | +} | |
| 30 | + | |
| 31 | +class Datum { | |
| 32 | + final String anomaly; | |
| 33 | + final String value; | |
| 34 | + | |
| 35 | + Datum({ | |
| 36 | + required this.anomaly, | |
| 37 | + required this.value, | |
| 38 | + }); | |
| 39 | + | |
| 40 | + factory Datum.fromJson(Map<String, dynamic> json) => Datum( | |
| 41 | + anomaly: json["anomaly"], | |
| 42 | + value: json["value"], | |
| 43 | + ); | |
| 44 | + | |
| 45 | + Map<String, dynamic> toJson() => { | |
| 46 | + "anomaly": anomaly, | |
| 47 | + "value": value, | |
| 48 | + }; | |
| 49 | +} | |
| 50 | + | |
| 51 | +class Description { | |
| 52 | + final String basePeriod; | |
| 53 | + final int missing; | |
| 54 | + final String title; | |
| 55 | + final String units; | |
| 56 | + | |
| 57 | + Description({ | |
| 58 | + required this.basePeriod, | |
| 59 | + required this.missing, | |
| 60 | + required this.title, | |
| 61 | + required this.units, | |
| 62 | + }); | |
| 63 | + | |
| 64 | + factory Description.fromJson(Map<String, dynamic> json) => Description( | |
| 65 | + basePeriod: json["base_period"], | |
| 66 | + missing: json["missing"], | |
| 67 | + title: json["title"], | |
| 68 | + units: json["units"], | |
| 69 | + ); | |
| 70 | + | |
| 71 | + Map<String, dynamic> toJson() => { | |
| 72 | + "base_period": basePeriod, | |
| 73 | + "missing": missing, | |
| 74 | + "title": title, | |
| 75 | + "units": units, | |
| 76 | + }; | |
| 77 | +} |
Test case
2 generated files · +2,658 −0test/inputs/json/priority/combinations1.json
Adartdefault / TopLevel.dart+1,329 −0
| @@ -0,0 +1,1329 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final String centrodesmose; | |
| 13 | + final List<dynamic> cerograph; | |
| 14 | + final List<dynamic> chemotherapeutics; | |
| 15 | + final List<dynamic> cimelia; | |
| 16 | + final int citrated; | |
| 17 | + final List<dynamic> clinodome; | |
| 18 | + final List<dynamic> coadjust; | |
| 19 | + final List<dynamic> consilience; | |
| 20 | + final List<dynamic> constructor; | |
| 21 | + final List<dynamic> continuative; | |
| 22 | + final List<dynamic> credulity; | |
| 23 | + final List<dynamic> creviced; | |
| 24 | + final List<List<int?>> cubiculum; | |
| 25 | + final List<dynamic> deruralize; | |
| 26 | + final List<dynamic> diaereses; | |
| 27 | + final List<List<dynamic>?> dissolution; | |
| 28 | + final List<dynamic> downstroke; | |
| 29 | + final List<double?> electrotautomerism; | |
| 30 | + final List<dynamic> eleutheromania; | |
| 31 | + final Encrust encrust; | |
| 32 | + final List<dynamic> entomoid; | |
| 33 | + final List<dynamic> epipaleolithic; | |
| 34 | + final List<dynamic> expropriable; | |
| 35 | + final List<dynamic> faggingly; | |
| 36 | + final List<dynamic> fenks; | |
| 37 | + final List<dynamic> flagmaking; | |
| 38 | + final List<dynamic> fluorometer; | |
| 39 | + final List<int?> fulsome; | |
| 40 | + final List<dynamic> fuzzy; | |
| 41 | + final List<dynamic> gardenwards; | |
| 42 | + final List<dynamic> generalissimo; | |
| 43 | + final List<Map<String, int>?> habeas; | |
| 44 | + final List<dynamic> hemicrystalline; | |
| 45 | + final List<dynamic> hemocoele; | |
| 46 | + final List<dynamic> hoister; | |
| 47 | + final List<dynamic> hyperpiesis; | |
| 48 | + final List<dynamic> hyppish; | |
| 49 | + final List<dynamic> idealizer; | |
| 50 | + final List<dynamic> incrustator; | |
| 51 | + final List<dynamic> intentiveness; | |
| 52 | + final Interacinar interacinar; | |
| 53 | + final List<List<int>?> intercorrelation; | |
| 54 | + final List<dynamic> jacutinga; | |
| 55 | + | |
| 56 | + TopLevel({ | |
| 57 | + required this.centrodesmose, | |
| 58 | + required this.cerograph, | |
| 59 | + required this.chemotherapeutics, | |
| 60 | + required this.cimelia, | |
| 61 | + required this.citrated, | |
| 62 | + required this.clinodome, | |
| 63 | + required this.coadjust, | |
| 64 | + required this.consilience, | |
| 65 | + required this.constructor, | |
| 66 | + required this.continuative, | |
| 67 | + required this.credulity, | |
| 68 | + required this.creviced, | |
| 69 | + required this.cubiculum, | |
| 70 | + required this.deruralize, | |
| 71 | + required this.diaereses, | |
| 72 | + required this.dissolution, | |
| 73 | + required this.downstroke, | |
| 74 | + required this.electrotautomerism, | |
| 75 | + required this.eleutheromania, | |
| 76 | + required this.encrust, | |
| 77 | + required this.entomoid, | |
| 78 | + required this.epipaleolithic, | |
| 79 | + required this.expropriable, | |
| 80 | + required this.faggingly, | |
| 81 | + required this.fenks, | |
| 82 | + required this.flagmaking, | |
| 83 | + required this.fluorometer, | |
| 84 | + required this.fulsome, | |
| 85 | + required this.fuzzy, | |
| 86 | + required this.gardenwards, | |
| 87 | + required this.generalissimo, | |
| 88 | + required this.habeas, | |
| 89 | + required this.hemicrystalline, | |
| 90 | + required this.hemocoele, | |
| 91 | + required this.hoister, | |
| 92 | + required this.hyperpiesis, | |
| 93 | + required this.hyppish, | |
| 94 | + required this.idealizer, | |
| 95 | + required this.incrustator, | |
| 96 | + required this.intentiveness, | |
| 97 | + required this.interacinar, | |
| 98 | + required this.intercorrelation, | |
| 99 | + required this.jacutinga, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 103 | + centrodesmose: json["centrodesmose"], | |
| 104 | + cerograph: List<dynamic>.from(json["cerograph"].map((x) => x)), | |
| 105 | + chemotherapeutics: List<dynamic>.from(json["chemotherapeutics"].map((x) => x)), | |
| 106 | + cimelia: List<dynamic>.from(json["cimelia"].map((x) => x)), | |
| 107 | + citrated: json["citrated"], | |
| 108 | + clinodome: List<dynamic>.from(json["clinodome"].map((x) => x)), | |
| 109 | + coadjust: List<dynamic>.from(json["coadjust"].map((x) => x)), | |
| 110 | + consilience: List<dynamic>.from(json["consilience"].map((x) => x)), | |
| 111 | + constructor: List<dynamic>.from(json["constructor"].map((x) => x)), | |
| 112 | + continuative: List<dynamic>.from(json["continuative"].map((x) => x)), | |
| 113 | + credulity: List<dynamic>.from(json["credulity"].map((x) => x)), | |
| 114 | + creviced: List<dynamic>.from(json["creviced"].map((x) => x)), | |
| 115 | + cubiculum: List<List<int?>>.from(json["cubiculum"].map((x) => List<int?>.from(x.map((x) => x)))), | |
| 116 | + deruralize: List<dynamic>.from(json["deruralize"].map((x) => x)), | |
| 117 | + diaereses: List<dynamic>.from(json["diaereses"].map((x) => x)), | |
| 118 | + dissolution: List<List<dynamic>?>.from(json["dissolution"].map((x) => x == null ? null : List<dynamic>.from(x!.map((x) => x)))), | |
| 119 | + downstroke: List<dynamic>.from(json["downstroke"].map((x) => x)), | |
| 120 | + electrotautomerism: List<double?>.from(json["electrotautomerism"].map((x) => x?.toDouble())), | |
| 121 | + eleutheromania: List<dynamic>.from(json["eleutheromania"].map((x) => x)), | |
| 122 | + encrust: Encrust.fromJson(json["encrust"]), | |
| 123 | + entomoid: List<dynamic>.from(json["entomoid"].map((x) => x)), | |
| 124 | + epipaleolithic: List<dynamic>.from(json["epipaleolithic"].map((x) => x)), | |
| 125 | + expropriable: List<dynamic>.from(json["expropriable"].map((x) => x)), | |
| 126 | + faggingly: List<dynamic>.from(json["faggingly"].map((x) => x)), | |
| 127 | + fenks: List<dynamic>.from(json["fenks"].map((x) => x)), | |
| 128 | + flagmaking: List<dynamic>.from(json["flagmaking"].map((x) => x)), | |
| 129 | + fluorometer: List<dynamic>.from(json["fluorometer"].map((x) => x)), | |
| 130 | + fulsome: List<int?>.from(json["fulsome"].map((x) => x)), | |
| 131 | + fuzzy: List<dynamic>.from(json["fuzzy"].map((x) => x)), | |
| 132 | + gardenwards: List<dynamic>.from(json["gardenwards"].map((x) => x)), | |
| 133 | + generalissimo: List<dynamic>.from(json["generalissimo"].map((x) => x)), | |
| 134 | + habeas: List<Map<String, int>?>.from(json["habeas"].map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, int>(k, v)))), | |
| 135 | + hemicrystalline: List<dynamic>.from(json["hemicrystalline"].map((x) => x)), | |
| 136 | + hemocoele: List<dynamic>.from(json["hemocoele"].map((x) => x)), | |
| 137 | + hoister: List<dynamic>.from(json["hoister"].map((x) => x)), | |
| 138 | + hyperpiesis: List<dynamic>.from(json["hyperpiesis"].map((x) => x)), | |
| 139 | + hyppish: List<dynamic>.from(json["hyppish"].map((x) => x)), | |
| 140 | + idealizer: List<dynamic>.from(json["idealizer"].map((x) => x)), | |
| 141 | + incrustator: List<dynamic>.from(json["incrustator"].map((x) => x)), | |
| 142 | + intentiveness: List<dynamic>.from(json["intentiveness"].map((x) => x)), | |
| 143 | + interacinar: Interacinar.fromJson(json["interacinar"]), | |
| 144 | + intercorrelation: List<List<int>?>.from(json["intercorrelation"].map((x) => x == null ? null : List<int>.from(x!.map((x) => x)))), | |
| 145 | + jacutinga: List<dynamic>.from(json["jacutinga"].map((x) => x)), | |
| 146 | + ); | |
| 147 | + | |
| 148 | + Map<String, dynamic> toJson() => { | |
| 149 | + "centrodesmose": centrodesmose, | |
| 150 | + "cerograph": List<dynamic>.from(cerograph.map((x) => x)), | |
| 151 | + "chemotherapeutics": List<dynamic>.from(chemotherapeutics.map((x) => x)), | |
| 152 | + "cimelia": List<dynamic>.from(cimelia.map((x) => x)), | |
| 153 | + "citrated": citrated, | |
| 154 | + "clinodome": List<dynamic>.from(clinodome.map((x) => x)), | |
| 155 | + "coadjust": List<dynamic>.from(coadjust.map((x) => x)), | |
| 156 | + "consilience": List<dynamic>.from(consilience.map((x) => x)), | |
| 157 | + "constructor": List<dynamic>.from(constructor.map((x) => x)), | |
| 158 | + "continuative": List<dynamic>.from(continuative.map((x) => x)), | |
| 159 | + "credulity": List<dynamic>.from(credulity.map((x) => x)), | |
| 160 | + "creviced": List<dynamic>.from(creviced.map((x) => x)), | |
| 161 | + "cubiculum": List<dynamic>.from(cubiculum.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 162 | + "deruralize": List<dynamic>.from(deruralize.map((x) => x)), | |
| 163 | + "diaereses": List<dynamic>.from(diaereses.map((x) => x)), | |
| 164 | + "dissolution": List<dynamic>.from(dissolution.map((x) => x == null ? null : List<dynamic>.from(x!.map((x) => x)))), | |
| 165 | + "downstroke": List<dynamic>.from(downstroke.map((x) => x)), | |
| 166 | + "electrotautomerism": List<dynamic>.from(electrotautomerism.map((x) => x)), | |
| 167 | + "eleutheromania": List<dynamic>.from(eleutheromania.map((x) => x)), | |
| 168 | + "encrust": encrust.toJson(), | |
| 169 | + "entomoid": List<dynamic>.from(entomoid.map((x) => x)), | |
| 170 | + "epipaleolithic": List<dynamic>.from(epipaleolithic.map((x) => x)), | |
| 171 | + "expropriable": List<dynamic>.from(expropriable.map((x) => x)), | |
| 172 | + "faggingly": List<dynamic>.from(faggingly.map((x) => x)), | |
| 173 | + "fenks": List<dynamic>.from(fenks.map((x) => x)), | |
| 174 | + "flagmaking": List<dynamic>.from(flagmaking.map((x) => x)), | |
| 175 | + "fluorometer": List<dynamic>.from(fluorometer.map((x) => x)), | |
| 176 | + "fulsome": List<dynamic>.from(fulsome.map((x) => x)), | |
| 177 | + "fuzzy": List<dynamic>.from(fuzzy.map((x) => x)), | |
| 178 | + "gardenwards": List<dynamic>.from(gardenwards.map((x) => x)), | |
| 179 | + "generalissimo": List<dynamic>.from(generalissimo.map((x) => x)), | |
| 180 | + "habeas": List<dynamic>.from(habeas.map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, dynamic>(k, v)))), | |
| 181 | + "hemicrystalline": List<dynamic>.from(hemicrystalline.map((x) => x)), | |
| 182 | + "hemocoele": List<dynamic>.from(hemocoele.map((x) => x)), | |
| 183 | + "hoister": List<dynamic>.from(hoister.map((x) => x)), | |
| 184 | + "hyperpiesis": List<dynamic>.from(hyperpiesis.map((x) => x)), | |
| 185 | + "hyppish": List<dynamic>.from(hyppish.map((x) => x)), | |
| 186 | + "idealizer": List<dynamic>.from(idealizer.map((x) => x)), | |
| 187 | + "incrustator": List<dynamic>.from(incrustator.map((x) => x)), | |
| 188 | + "intentiveness": List<dynamic>.from(intentiveness.map((x) => x)), | |
| 189 | + "interacinar": interacinar.toJson(), | |
| 190 | + "intercorrelation": List<dynamic>.from(intercorrelation.map((x) => x == null ? null : List<dynamic>.from(x!.map((x) => x)))), | |
| 191 | + "jacutinga": List<dynamic>.from(jacutinga.map((x) => x)), | |
| 192 | + }; | |
| 193 | +} | |
| 194 | + | |
| 195 | +class CerographClass { | |
| 196 | + final dynamic apotropaion; | |
| 197 | + final dynamic casuary; | |
| 198 | + final dynamic creaker; | |
| 199 | + final dynamic disqualification; | |
| 200 | + final dynamic imperatorious; | |
| 201 | + final dynamic impermeabilize; | |
| 202 | + final dynamic metastoma; | |
| 203 | + final dynamic noctidiurnal; | |
| 204 | + final dynamic nonreserve; | |
| 205 | + final dynamic ophthalmotonometry; | |
| 206 | + final dynamic pailful; | |
| 207 | + final dynamic pigfish; | |
| 208 | + final dynamic pongee; | |
| 209 | + final dynamic prosodical; | |
| 210 | + final dynamic scrofuloderm; | |
| 211 | + final dynamic storekeeping; | |
| 212 | + final dynamic therologist; | |
| 213 | + final dynamic tolowa; | |
| 214 | + final dynamic tradeful; | |
| 215 | + final dynamic unriveting; | |
| 216 | + | |
| 217 | + CerographClass({ | |
| 218 | + required this.apotropaion, | |
| 219 | + required this.casuary, | |
| 220 | + required this.creaker, | |
| 221 | + required this.disqualification, | |
| 222 | + required this.imperatorious, | |
| 223 | + required this.impermeabilize, | |
| 224 | + required this.metastoma, | |
| 225 | + required this.noctidiurnal, | |
| 226 | + required this.nonreserve, | |
| 227 | + required this.ophthalmotonometry, | |
| 228 | + required this.pailful, | |
| 229 | + required this.pigfish, | |
| 230 | + required this.pongee, | |
| 231 | + required this.prosodical, | |
| 232 | + required this.scrofuloderm, | |
| 233 | + required this.storekeeping, | |
| 234 | + required this.therologist, | |
| 235 | + required this.tolowa, | |
| 236 | + required this.tradeful, | |
| 237 | + required this.unriveting, | |
| 238 | + }); | |
| 239 | + | |
| 240 | + factory CerographClass.fromJson(Map<String, dynamic> json) => CerographClass( | |
| 241 | + apotropaion: json["apotropaion"], | |
| 242 | + casuary: json["casuary"], | |
| 243 | + creaker: json["creaker"], | |
| 244 | + disqualification: json["disqualification"], | |
| 245 | + imperatorious: json["imperatorious"], | |
| 246 | + impermeabilize: json["impermeabilize"], | |
| 247 | + metastoma: json["metastoma"], | |
| 248 | + noctidiurnal: json["noctidiurnal"], | |
| 249 | + nonreserve: json["nonreserve"], | |
| 250 | + ophthalmotonometry: json["ophthalmotonometry"], | |
| 251 | + pailful: json["pailful"], | |
| 252 | + pigfish: json["pigfish"], | |
| 253 | + pongee: json["pongee"], | |
| 254 | + prosodical: json["prosodical"], | |
| 255 | + scrofuloderm: json["scrofuloderm"], | |
| 256 | + storekeeping: json["storekeeping"], | |
| 257 | + therologist: json["therologist"], | |
| 258 | + tolowa: json["Tolowa"], | |
| 259 | + tradeful: json["tradeful"], | |
| 260 | + unriveting: json["unriveting"], | |
| 261 | + ); | |
| 262 | + | |
| 263 | + Map<String, dynamic> toJson() => { | |
| 264 | + "apotropaion": apotropaion, | |
| 265 | + "casuary": casuary, | |
| 266 | + "creaker": creaker, | |
| 267 | + "disqualification": disqualification, | |
| 268 | + "imperatorious": imperatorious, | |
| 269 | + "impermeabilize": impermeabilize, | |
| 270 | + "metastoma": metastoma, | |
| 271 | + "noctidiurnal": noctidiurnal, | |
| 272 | + "nonreserve": nonreserve, | |
| 273 | + "ophthalmotonometry": ophthalmotonometry, | |
| 274 | + "pailful": pailful, | |
| 275 | + "pigfish": pigfish, | |
| 276 | + "pongee": pongee, | |
| 277 | + "prosodical": prosodical, | |
| 278 | + "scrofuloderm": scrofuloderm, | |
| 279 | + "storekeeping": storekeeping, | |
| 280 | + "therologist": therologist, | |
| 281 | + "Tolowa": tolowa, | |
| 282 | + "tradeful": tradeful, | |
| 283 | + "unriveting": unriveting, | |
| 284 | + }; | |
| 285 | +} | |
| 286 | + | |
| 287 | +class ChemotherapeuticClass { | |
| 288 | + final dynamic angioneurotic; | |
| 289 | + final dynamic availment; | |
| 290 | + final dynamic bladelet; | |
| 291 | + final double? catharticalness; | |
| 292 | + final dynamic caulis; | |
| 293 | + final dynamic chalcus; | |
| 294 | + final int? chirotherium; | |
| 295 | + final String? disdiapason; | |
| 296 | + final dynamic enteradenological; | |
| 297 | + final bool? homocerc; | |
| 298 | + final dynamic imporosity; | |
| 299 | + final dynamic insistently; | |
| 300 | + final dynamic intraparietal; | |
| 301 | + final dynamic ivied; | |
| 302 | + final dynamic maureen; | |
| 303 | + final dynamic nonbookish; | |
| 304 | + final dynamic nostochine; | |
| 305 | + final dynamic nutcracker; | |
| 306 | + final dynamic ofttimes; | |
| 307 | + final dynamic phenocryst; | |
| 308 | + final dynamic precoincident; | |
| 309 | + final dynamic ramiferous; | |
| 310 | + final dynamic stagmometer; | |
| 311 | + final dynamic tetherball; | |
| 312 | + final dynamic unshy; | |
| 313 | + | |
| 314 | + ChemotherapeuticClass({ | |
| 315 | + this.angioneurotic, | |
| 316 | + this.availment, | |
| 317 | + this.bladelet, | |
| 318 | + this.catharticalness, | |
| 319 | + this.caulis, | |
| 320 | + this.chalcus, | |
| 321 | + this.chirotherium, | |
| 322 | + this.disdiapason, | |
| 323 | + this.enteradenological, | |
| 324 | + this.homocerc, | |
| 325 | + this.imporosity, | |
| 326 | + this.insistently, | |
| 327 | + this.intraparietal, | |
| 328 | + this.ivied, | |
| 329 | + this.maureen, | |
| 330 | + this.nonbookish, | |
| 331 | + this.nostochine, | |
| 332 | + this.nutcracker, | |
| 333 | + this.ofttimes, | |
| 334 | + this.phenocryst, | |
| 335 | + this.precoincident, | |
| 336 | + this.ramiferous, | |
| 337 | + this.stagmometer, | |
| 338 | + this.tetherball, | |
| 339 | + this.unshy, | |
| 340 | + }); | |
| 341 | + | |
| 342 | + factory ChemotherapeuticClass.fromJson(Map<String, dynamic> json) => ChemotherapeuticClass( | |
| 343 | + angioneurotic: json["angioneurotic"], | |
| 344 | + availment: json["availment"], | |
| 345 | + bladelet: json["bladelet"], | |
| 346 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 347 | + caulis: json["caulis"], | |
| 348 | + chalcus: json["chalcus"], | |
| 349 | + chirotherium: json["Chirotherium"], | |
| 350 | + disdiapason: json["disdiapason"], | |
| 351 | + enteradenological: json["enteradenological"], | |
| 352 | + homocerc: json["homocerc"], | |
| 353 | + imporosity: json["imporosity"], | |
| 354 | + insistently: json["insistently"], | |
| 355 | + intraparietal: json["intraparietal"], | |
| 356 | + ivied: json["ivied"], | |
| 357 | + maureen: json["Maureen"], | |
| 358 | + nonbookish: json["nonbookish"], | |
| 359 | + nostochine: json["nostochine"], | |
| 360 | + nutcracker: json["nutcracker"], | |
| 361 | + ofttimes: json["ofttimes"], | |
| 362 | + phenocryst: json["phenocryst"], | |
| 363 | + precoincident: json["precoincident"], | |
| 364 | + ramiferous: json["ramiferous"], | |
| 365 | + stagmometer: json["stagmometer"], | |
| 366 | + tetherball: json["tetherball"], | |
| 367 | + unshy: json["unshy"], | |
| 368 | + ); | |
| 369 | + | |
| 370 | + Map<String, dynamic> toJson() => { | |
| 371 | + "angioneurotic": angioneurotic, | |
| 372 | + "availment": availment, | |
| 373 | + "bladelet": bladelet, | |
| 374 | + "catharticalness": catharticalness, | |
| 375 | + "caulis": caulis, | |
| 376 | + "chalcus": chalcus, | |
| 377 | + "Chirotherium": chirotherium, | |
| 378 | + "disdiapason": disdiapason, | |
| 379 | + "enteradenological": enteradenological, | |
| 380 | + "homocerc": homocerc, | |
| 381 | + "imporosity": imporosity, | |
| 382 | + "insistently": insistently, | |
| 383 | + "intraparietal": intraparietal, | |
| 384 | + "ivied": ivied, | |
| 385 | + "Maureen": maureen, | |
| 386 | + "nonbookish": nonbookish, | |
| 387 | + "nostochine": nostochine, | |
| 388 | + "nutcracker": nutcracker, | |
| 389 | + "ofttimes": ofttimes, | |
| 390 | + "phenocryst": phenocryst, | |
| 391 | + "precoincident": precoincident, | |
| 392 | + "ramiferous": ramiferous, | |
| 393 | + "stagmometer": stagmometer, | |
| 394 | + "tetherball": tetherball, | |
| 395 | + "unshy": unshy, | |
| 396 | + }; | |
| 397 | +} | |
| 398 | + | |
| 399 | +class CimeliaClass { | |
| 400 | + final double catharticalness; | |
| 401 | + final int chirotherium; | |
| 402 | + final String disdiapason; | |
| 403 | + final bool homocerc; | |
| 404 | + final dynamic nonbookish; | |
| 405 | + | |
| 406 | + CimeliaClass({ | |
| 407 | + required this.catharticalness, | |
| 408 | + required this.chirotherium, | |
| 409 | + required this.disdiapason, | |
| 410 | + required this.homocerc, | |
| 411 | + required this.nonbookish, | |
| 412 | + }); | |
| 413 | + | |
| 414 | + factory CimeliaClass.fromJson(Map<String, dynamic> json) => CimeliaClass( | |
| 415 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 416 | + chirotherium: json["Chirotherium"], | |
| 417 | + disdiapason: json["disdiapason"], | |
| 418 | + homocerc: json["homocerc"], | |
| 419 | + nonbookish: json["nonbookish"], | |
| 420 | + ); | |
| 421 | + | |
| 422 | + Map<String, dynamic> toJson() => { | |
| 423 | + "catharticalness": catharticalness, | |
| 424 | + "Chirotherium": chirotherium, | |
| 425 | + "disdiapason": disdiapason, | |
| 426 | + "homocerc": homocerc, | |
| 427 | + "nonbookish": nonbookish, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class CoadjustClass { | |
| 432 | + final dynamic amidosulphonal; | |
| 433 | + final dynamic benny; | |
| 434 | + final double? catharticalness; | |
| 435 | + final int? chirotherium; | |
| 436 | + final String? disdiapason; | |
| 437 | + final dynamic ensnare; | |
| 438 | + final bool? homocerc; | |
| 439 | + final dynamic hybridizer; | |
| 440 | + final dynamic leastwise; | |
| 441 | + final dynamic lof; | |
| 442 | + final dynamic monkhood; | |
| 443 | + final dynamic netherlandish; | |
| 444 | + final dynamic nonbookish; | |
| 445 | + final dynamic peonism; | |
| 446 | + final dynamic phonelescope; | |
| 447 | + final dynamic porphyrogeniture; | |
| 448 | + final dynamic preindemnify; | |
| 449 | + final dynamic rosal; | |
| 450 | + final dynamic scalenous; | |
| 451 | + final dynamic scopine; | |
| 452 | + final dynamic sedaceae; | |
| 453 | + final dynamic suberinize; | |
| 454 | + final dynamic symbiot; | |
| 455 | + final dynamic tablefellow; | |
| 456 | + final dynamic unchargeable; | |
| 457 | + | |
| 458 | + CoadjustClass({ | |
| 459 | + this.amidosulphonal, | |
| 460 | + this.benny, | |
| 461 | + this.catharticalness, | |
| 462 | + this.chirotherium, | |
| 463 | + this.disdiapason, | |
| 464 | + this.ensnare, | |
| 465 | + this.homocerc, | |
| 466 | + this.hybridizer, | |
| 467 | + this.leastwise, | |
| 468 | + this.lof, | |
| 469 | + this.monkhood, | |
| 470 | + this.netherlandish, | |
| 471 | + this.nonbookish, | |
| 472 | + this.peonism, | |
| 473 | + this.phonelescope, | |
| 474 | + this.porphyrogeniture, | |
| 475 | + this.preindemnify, | |
| 476 | + this.rosal, | |
| 477 | + this.scalenous, | |
| 478 | + this.scopine, | |
| 479 | + this.sedaceae, | |
| 480 | + this.suberinize, | |
| 481 | + this.symbiot, | |
| 482 | + this.tablefellow, | |
| 483 | + this.unchargeable, | |
| 484 | + }); | |
| 485 | + | |
| 486 | + factory CoadjustClass.fromJson(Map<String, dynamic> json) => CoadjustClass( | |
| 487 | + amidosulphonal: json["amidosulphonal"], | |
| 488 | + benny: json["Benny"], | |
| 489 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 490 | + chirotherium: json["Chirotherium"], | |
| 491 | + disdiapason: json["disdiapason"], | |
| 492 | + ensnare: json["ensnare"], | |
| 493 | + homocerc: json["homocerc"], | |
| 494 | + hybridizer: json["hybridizer"], | |
| 495 | + leastwise: json["leastwise"], | |
| 496 | + lof: json["lof"], | |
| 497 | + monkhood: json["monkhood"], | |
| 498 | + netherlandish: json["Netherlandish"], | |
| 499 | + nonbookish: json["nonbookish"], | |
| 500 | + peonism: json["peonism"], | |
| 501 | + phonelescope: json["Phonelescope"], | |
| 502 | + porphyrogeniture: json["porphyrogeniture"], | |
| 503 | + preindemnify: json["preindemnify"], | |
| 504 | + rosal: json["rosal"], | |
| 505 | + scalenous: json["scalenous"], | |
| 506 | + scopine: json["scopine"], | |
| 507 | + sedaceae: json["Sedaceae"], | |
| 508 | + suberinize: json["suberinize"], | |
| 509 | + symbiot: json["symbiot"], | |
| 510 | + tablefellow: json["tablefellow"], | |
| 511 | + unchargeable: json["unchargeable"], | |
| 512 | + ); | |
| 513 | + | |
| 514 | + Map<String, dynamic> toJson() => { | |
| 515 | + "amidosulphonal": amidosulphonal, | |
| 516 | + "Benny": benny, | |
| 517 | + "catharticalness": catharticalness, | |
| 518 | + "Chirotherium": chirotherium, | |
| 519 | + "disdiapason": disdiapason, | |
| 520 | + "ensnare": ensnare, | |
| 521 | + "homocerc": homocerc, | |
| 522 | + "hybridizer": hybridizer, | |
| 523 | + "leastwise": leastwise, | |
| 524 | + "lof": lof, | |
| 525 | + "monkhood": monkhood, | |
| 526 | + "Netherlandish": netherlandish, | |
| 527 | + "nonbookish": nonbookish, | |
| 528 | + "peonism": peonism, | |
| 529 | + "Phonelescope": phonelescope, | |
| 530 | + "porphyrogeniture": porphyrogeniture, | |
| 531 | + "preindemnify": preindemnify, | |
| 532 | + "rosal": rosal, | |
| 533 | + "scalenous": scalenous, | |
| 534 | + "scopine": scopine, | |
| 535 | + "Sedaceae": sedaceae, | |
| 536 | + "suberinize": suberinize, | |
| 537 | + "symbiot": symbiot, | |
| 538 | + "tablefellow": tablefellow, | |
| 539 | + "unchargeable": unchargeable, | |
| 540 | + }; | |
| 541 | +} | |
| 542 | + | |
| 543 | +class CredulityClass { | |
| 544 | + final dynamic ammonolytic; | |
| 545 | + final dynamic bushmaster; | |
| 546 | + final dynamic considering; | |
| 547 | + final dynamic consuetudinary; | |
| 548 | + final dynamic embarras; | |
| 549 | + final dynamic fineness; | |
| 550 | + final dynamic flaithship; | |
| 551 | + final dynamic flavia; | |
| 552 | + final dynamic gruffly; | |
| 553 | + final dynamic hedychium; | |
| 554 | + final dynamic leadwort; | |
| 555 | + final dynamic overseriously; | |
| 556 | + final dynamic parabola; | |
| 557 | + final dynamic pectinatodenticulate; | |
| 558 | + final dynamic popean; | |
| 559 | + final dynamic pornocrat; | |
| 560 | + final dynamic quadrisect; | |
| 561 | + final dynamic seriality; | |
| 562 | + final dynamic vamphorn; | |
| 563 | + final dynamic wharp; | |
| 564 | + | |
| 565 | + CredulityClass({ | |
| 566 | + required this.ammonolytic, | |
| 567 | + required this.bushmaster, | |
| 568 | + required this.considering, | |
| 569 | + required this.consuetudinary, | |
| 570 | + required this.embarras, | |
| 571 | + required this.fineness, | |
| 572 | + required this.flaithship, | |
| 573 | + required this.flavia, | |
| 574 | + required this.gruffly, | |
| 575 | + required this.hedychium, | |
| 576 | + required this.leadwort, | |
| 577 | + required this.overseriously, | |
| 578 | + required this.parabola, | |
| 579 | + required this.pectinatodenticulate, | |
| 580 | + required this.popean, | |
| 581 | + required this.pornocrat, | |
| 582 | + required this.quadrisect, | |
| 583 | + required this.seriality, | |
| 584 | + required this.vamphorn, | |
| 585 | + required this.wharp, | |
| 586 | + }); | |
| 587 | + | |
| 588 | + factory CredulityClass.fromJson(Map<String, dynamic> json) => CredulityClass( | |
| 589 | + ammonolytic: json["ammonolytic"], | |
| 590 | + bushmaster: json["bushmaster"], | |
| 591 | + considering: json["considering"], | |
| 592 | + consuetudinary: json["consuetudinary"], | |
| 593 | + embarras: json["embarras"], | |
| 594 | + fineness: json["fineness"], | |
| 595 | + flaithship: json["flaithship"], | |
| 596 | + flavia: json["Flavia"], | |
| 597 | + gruffly: json["gruffly"], | |
| 598 | + hedychium: json["Hedychium"], | |
| 599 | + leadwort: json["leadwort"], | |
| 600 | + overseriously: json["overseriously"], | |
| 601 | + parabola: json["parabola"], | |
| 602 | + pectinatodenticulate: json["pectinatodenticulate"], | |
| 603 | + popean: json["Popean"], | |
| 604 | + pornocrat: json["pornocrat"], | |
| 605 | + quadrisect: json["quadrisect"], | |
| 606 | + seriality: json["seriality"], | |
| 607 | + vamphorn: json["vamphorn"], | |
| 608 | + wharp: json["wharp"], | |
| 609 | + ); | |
| 610 | + | |
| 611 | + Map<String, dynamic> toJson() => { | |
| 612 | + "ammonolytic": ammonolytic, | |
| 613 | + "bushmaster": bushmaster, | |
| 614 | + "considering": considering, | |
| 615 | + "consuetudinary": consuetudinary, | |
| 616 | + "embarras": embarras, | |
| 617 | + "fineness": fineness, | |
| 618 | + "flaithship": flaithship, | |
| 619 | + "Flavia": flavia, | |
| 620 | + "gruffly": gruffly, | |
| 621 | + "Hedychium": hedychium, | |
| 622 | + "leadwort": leadwort, | |
| 623 | + "overseriously": overseriously, | |
| 624 | + "parabola": parabola, | |
| 625 | + "pectinatodenticulate": pectinatodenticulate, | |
| 626 | + "Popean": popean, | |
| 627 | + "pornocrat": pornocrat, | |
| 628 | + "quadrisect": quadrisect, | |
| 629 | + "seriality": seriality, | |
| 630 | + "vamphorn": vamphorn, | |
| 631 | + "wharp": wharp, | |
| 632 | + }; | |
| 633 | +} | |
| 634 | + | |
| 635 | +class DeruralizeClass { | |
| 636 | + final dynamic bockerel; | |
| 637 | + final dynamic boulder; | |
| 638 | + final dynamic churrus; | |
| 639 | + final dynamic counterdigged; | |
| 640 | + final dynamic dialogite; | |
| 641 | + final dynamic digenic; | |
| 642 | + final dynamic dunbird; | |
| 643 | + final dynamic ergatogyne; | |
| 644 | + final dynamic fiendful; | |
| 645 | + final dynamic jackrod; | |
| 646 | + final dynamic jehovistic; | |
| 647 | + final dynamic paninean; | |
| 648 | + final dynamic panther; | |
| 649 | + final dynamic placentigerous; | |
| 650 | + final dynamic romney; | |
| 651 | + final dynamic sparm; | |
| 652 | + final dynamic tocsin; | |
| 653 | + final dynamic unnicked; | |
| 654 | + final dynamic unstavable; | |
| 655 | + final dynamic windfirm; | |
| 656 | + | |
| 657 | + DeruralizeClass({ | |
| 658 | + required this.bockerel, | |
| 659 | + required this.boulder, | |
| 660 | + required this.churrus, | |
| 661 | + required this.counterdigged, | |
| 662 | + required this.dialogite, | |
| 663 | + required this.digenic, | |
| 664 | + required this.dunbird, | |
| 665 | + required this.ergatogyne, | |
| 666 | + required this.fiendful, | |
| 667 | + required this.jackrod, | |
| 668 | + required this.jehovistic, | |
| 669 | + required this.paninean, | |
| 670 | + required this.panther, | |
| 671 | + required this.placentigerous, | |
| 672 | + required this.romney, | |
| 673 | + required this.sparm, | |
| 674 | + required this.tocsin, | |
| 675 | + required this.unnicked, | |
| 676 | + required this.unstavable, | |
| 677 | + required this.windfirm, | |
| 678 | + }); | |
| 679 | + | |
| 680 | + factory DeruralizeClass.fromJson(Map<String, dynamic> json) => DeruralizeClass( | |
| 681 | + bockerel: json["bockerel"], | |
| 682 | + boulder: json["boulder"], | |
| 683 | + churrus: json["churrus"], | |
| 684 | + counterdigged: json["counterdigged"], | |
| 685 | + dialogite: json["dialogite"], | |
| 686 | + digenic: json["digenic"], | |
| 687 | + dunbird: json["dunbird"], | |
| 688 | + ergatogyne: json["ergatogyne"], | |
| 689 | + fiendful: json["fiendful"], | |
| 690 | + jackrod: json["jackrod"], | |
| 691 | + jehovistic: json["Jehovistic"], | |
| 692 | + paninean: json["Paninean"], | |
| 693 | + panther: json["panther"], | |
| 694 | + placentigerous: json["placentigerous"], | |
| 695 | + romney: json["Romney"], | |
| 696 | + sparm: json["sparm"], | |
| 697 | + tocsin: json["tocsin"], | |
| 698 | + unnicked: json["unnicked"], | |
| 699 | + unstavable: json["unstavable"], | |
| 700 | + windfirm: json["windfirm"], | |
| 701 | + ); | |
| 702 | + | |
| 703 | + Map<String, dynamic> toJson() => { | |
| 704 | + "bockerel": bockerel, | |
| 705 | + "boulder": boulder, | |
| 706 | + "churrus": churrus, | |
| 707 | + "counterdigged": counterdigged, | |
| 708 | + "dialogite": dialogite, | |
| 709 | + "digenic": digenic, | |
| 710 | + "dunbird": dunbird, | |
| 711 | + "ergatogyne": ergatogyne, | |
| 712 | + "fiendful": fiendful, | |
| 713 | + "jackrod": jackrod, | |
| 714 | + "Jehovistic": jehovistic, | |
| 715 | + "Paninean": paninean, | |
| 716 | + "panther": panther, | |
| 717 | + "placentigerous": placentigerous, | |
| 718 | + "Romney": romney, | |
| 719 | + "sparm": sparm, | |
| 720 | + "tocsin": tocsin, | |
| 721 | + "unnicked": unnicked, | |
| 722 | + "unstavable": unstavable, | |
| 723 | + "windfirm": windfirm, | |
| 724 | + }; | |
| 725 | +} | |
| 726 | + | |
| 727 | +class DiaereseClass { | |
| 728 | + final dynamic amoreuxia; | |
| 729 | + final dynamic ani; | |
| 730 | + final dynamic bernicle; | |
| 731 | + final dynamic blackwasher; | |
| 732 | + final dynamic blowhard; | |
| 733 | + final dynamic broma; | |
| 734 | + final dynamic closecross; | |
| 735 | + final dynamic congregationalism; | |
| 736 | + final dynamic grayly; | |
| 737 | + final dynamic historically; | |
| 738 | + final dynamic hoast; | |
| 739 | + final dynamic irretentive; | |
| 740 | + final dynamic parcener; | |
| 741 | + final dynamic pedder; | |
| 742 | + final dynamic pseudoanatomic; | |
| 743 | + final dynamic rhizocarpian; | |
| 744 | + final dynamic samel; | |
| 745 | + final dynamic silker; | |
| 746 | + final dynamic subdentated; | |
| 747 | + final dynamic subobscure; | |
| 748 | + | |
| 749 | + DiaereseClass({ | |
| 750 | + required this.amoreuxia, | |
| 751 | + required this.ani, | |
| 752 | + required this.bernicle, | |
| 753 | + required this.blackwasher, | |
| 754 | + required this.blowhard, | |
| 755 | + required this.broma, | |
| 756 | + required this.closecross, | |
| 757 | + required this.congregationalism, | |
| 758 | + required this.grayly, | |
| 759 | + required this.historically, | |
| 760 | + required this.hoast, | |
| 761 | + required this.irretentive, | |
| 762 | + required this.parcener, | |
| 763 | + required this.pedder, | |
| 764 | + required this.pseudoanatomic, | |
| 765 | + required this.rhizocarpian, | |
| 766 | + required this.samel, | |
| 767 | + required this.silker, | |
| 768 | + required this.subdentated, | |
| 769 | + required this.subobscure, | |
| 770 | + }); | |
| 771 | + | |
| 772 | + factory DiaereseClass.fromJson(Map<String, dynamic> json) => DiaereseClass( | |
| 773 | + amoreuxia: json["Amoreuxia"], | |
| 774 | + ani: json["ani"], | |
| 775 | + bernicle: json["bernicle"], | |
| 776 | + blackwasher: json["blackwasher"], | |
| 777 | + blowhard: json["blowhard"], | |
| 778 | + broma: json["broma"], | |
| 779 | + closecross: json["closecross"], | |
| 780 | + congregationalism: json["congregationalism"], | |
| 781 | + grayly: json["grayly"], | |
| 782 | + historically: json["historically"], | |
| 783 | + hoast: json["hoast"], | |
| 784 | + irretentive: json["irretentive"], | |
| 785 | + parcener: json["parcener"], | |
| 786 | + pedder: json["pedder"], | |
| 787 | + pseudoanatomic: json["pseudoanatomic"], | |
| 788 | + rhizocarpian: json["rhizocarpian"], | |
| 789 | + samel: json["samel"], | |
| 790 | + silker: json["silker"], | |
| 791 | + subdentated: json["subdentated"], | |
| 792 | + subobscure: json["subobscure"], | |
| 793 | + ); | |
| 794 | + | |
| 795 | + Map<String, dynamic> toJson() => { | |
| 796 | + "Amoreuxia": amoreuxia, | |
| 797 | + "ani": ani, | |
| 798 | + "bernicle": bernicle, | |
| 799 | + "blackwasher": blackwasher, | |
| 800 | + "blowhard": blowhard, | |
| 801 | + "broma": broma, | |
| 802 | + "closecross": closecross, | |
| 803 | + "congregationalism": congregationalism, | |
| 804 | + "grayly": grayly, | |
| 805 | + "historically": historically, | |
| 806 | + "hoast": hoast, | |
| 807 | + "irretentive": irretentive, | |
| 808 | + "parcener": parcener, | |
| 809 | + "pedder": pedder, | |
| 810 | + "pseudoanatomic": pseudoanatomic, | |
| 811 | + "rhizocarpian": rhizocarpian, | |
| 812 | + "samel": samel, | |
| 813 | + "silker": silker, | |
| 814 | + "subdentated": subdentated, | |
| 815 | + "subobscure": subobscure, | |
| 816 | + }; | |
| 817 | +} | |
| 818 | + | |
| 819 | +class Encrust { | |
| 820 | + final dynamic comradely; | |
| 821 | + final dynamic diacanthous; | |
| 822 | + final dynamic feminineness; | |
| 823 | + final dynamic gossamered; | |
| 824 | + final dynamic hibernia; | |
| 825 | + final dynamic hibiscus; | |
| 826 | + final dynamic lepidosauria; | |
| 827 | + final dynamic lollingly; | |
| 828 | + final dynamic manager; | |
| 829 | + final dynamic mechanic; | |
| 830 | + final dynamic overminuteness; | |
| 831 | + final dynamic papelonne; | |
| 832 | + final dynamic plebification; | |
| 833 | + final dynamic pugmiller; | |
| 834 | + final dynamic recoveror; | |
| 835 | + final dynamic spermatoblastic; | |
| 836 | + final dynamic syllidae; | |
| 837 | + final dynamic ungyved; | |
| 838 | + final dynamic whirlabout; | |
| 839 | + final dynamic woodenware; | |
| 840 | + | |
| 841 | + Encrust({ | |
| 842 | + required this.comradely, | |
| 843 | + required this.diacanthous, | |
| 844 | + required this.feminineness, | |
| 845 | + required this.gossamered, | |
| 846 | + required this.hibernia, | |
| 847 | + required this.hibiscus, | |
| 848 | + required this.lepidosauria, | |
| 849 | + required this.lollingly, | |
| 850 | + required this.manager, | |
| 851 | + required this.mechanic, | |
| 852 | + required this.overminuteness, | |
| 853 | + required this.papelonne, | |
| 854 | + required this.plebification, | |
| 855 | + required this.pugmiller, | |
| 856 | + required this.recoveror, | |
| 857 | + required this.spermatoblastic, | |
| 858 | + required this.syllidae, | |
| 859 | + required this.ungyved, | |
| 860 | + required this.whirlabout, | |
| 861 | + required this.woodenware, | |
| 862 | + }); | |
| 863 | + | |
| 864 | + factory Encrust.fromJson(Map<String, dynamic> json) => Encrust( | |
| 865 | + comradely: json["comradely"], | |
| 866 | + diacanthous: json["diacanthous"], | |
| 867 | + feminineness: json["feminineness"], | |
| 868 | + gossamered: json["gossamered"], | |
| 869 | + hibernia: json["Hibernia"], | |
| 870 | + hibiscus: json["Hibiscus"], | |
| 871 | + lepidosauria: json["Lepidosauria"], | |
| 872 | + lollingly: json["lollingly"], | |
| 873 | + manager: json["manager"], | |
| 874 | + mechanic: json["mechanic"], | |
| 875 | + overminuteness: json["overminuteness"], | |
| 876 | + papelonne: json["papelonne"], | |
| 877 | + plebification: json["plebification"], | |
| 878 | + pugmiller: json["pugmiller"], | |
| 879 | + recoveror: json["recoveror"], | |
| 880 | + spermatoblastic: json["spermatoblastic"], | |
| 881 | + syllidae: json["Syllidae"], | |
| 882 | + ungyved: json["ungyved"], | |
| 883 | + whirlabout: json["whirlabout"], | |
| 884 | + woodenware: json["woodenware"], | |
| 885 | + ); | |
| 886 | + | |
| 887 | + Map<String, dynamic> toJson() => { | |
| 888 | + "comradely": comradely, | |
| 889 | + "diacanthous": diacanthous, | |
| 890 | + "feminineness": feminineness, | |
| 891 | + "gossamered": gossamered, | |
| 892 | + "Hibernia": hibernia, | |
| 893 | + "Hibiscus": hibiscus, | |
| 894 | + "Lepidosauria": lepidosauria, | |
| 895 | + "lollingly": lollingly, | |
| 896 | + "manager": manager, | |
| 897 | + "mechanic": mechanic, | |
| 898 | + "overminuteness": overminuteness, | |
| 899 | + "papelonne": papelonne, | |
| 900 | + "plebification": plebification, | |
| 901 | + "pugmiller": pugmiller, | |
| 902 | + "recoveror": recoveror, | |
| 903 | + "spermatoblastic": spermatoblastic, | |
| 904 | + "Syllidae": syllidae, | |
| 905 | + "ungyved": ungyved, | |
| 906 | + "whirlabout": whirlabout, | |
| 907 | + "woodenware": woodenware, | |
| 908 | + }; | |
| 909 | +} | |
| 910 | + | |
| 911 | +class FagginglyClass { | |
| 912 | + final dynamic abranchian; | |
| 913 | + final dynamic aculeiform; | |
| 914 | + final dynamic adiaphoristic; | |
| 915 | + final dynamic adoptionism; | |
| 916 | + final dynamic anglic; | |
| 917 | + final dynamic antrotomy; | |
| 918 | + final dynamic coerciveness; | |
| 919 | + final dynamic decorist; | |
| 920 | + final dynamic duckhood; | |
| 921 | + final dynamic heteromeri; | |
| 922 | + final dynamic hypochnose; | |
| 923 | + final dynamic lochage; | |
| 924 | + final dynamic melee; | |
| 925 | + final dynamic nonconformitant; | |
| 926 | + final dynamic poinsettia; | |
| 927 | + final dynamic putatively; | |
| 928 | + final dynamic semivolatile; | |
| 929 | + final dynamic soleas; | |
| 930 | + final dynamic unfastenable; | |
| 931 | + final dynamic unmillinered; | |
| 932 | + | |
| 933 | + FagginglyClass({ | |
| 934 | + required this.abranchian, | |
| 935 | + required this.aculeiform, | |
| 936 | + required this.adiaphoristic, | |
| 937 | + required this.adoptionism, | |
| 938 | + required this.anglic, | |
| 939 | + required this.antrotomy, | |
| 940 | + required this.coerciveness, | |
| 941 | + required this.decorist, | |
| 942 | + required this.duckhood, | |
| 943 | + required this.heteromeri, | |
| 944 | + required this.hypochnose, | |
| 945 | + required this.lochage, | |
| 946 | + required this.melee, | |
| 947 | + required this.nonconformitant, | |
| 948 | + required this.poinsettia, | |
| 949 | + required this.putatively, | |
| 950 | + required this.semivolatile, | |
| 951 | + required this.soleas, | |
| 952 | + required this.unfastenable, | |
| 953 | + required this.unmillinered, | |
| 954 | + }); | |
| 955 | + | |
| 956 | + factory FagginglyClass.fromJson(Map<String, dynamic> json) => FagginglyClass( | |
| 957 | + abranchian: json["abranchian"], | |
| 958 | + aculeiform: json["aculeiform"], | |
| 959 | + adiaphoristic: json["adiaphoristic"], | |
| 960 | + adoptionism: json["adoptionism"], | |
| 961 | + anglic: json["Anglic"], | |
| 962 | + antrotomy: json["antrotomy"], | |
| 963 | + coerciveness: json["coerciveness"], | |
| 964 | + decorist: json["decorist"], | |
| 965 | + duckhood: json["duckhood"], | |
| 966 | + heteromeri: json["Heteromeri"], | |
| 967 | + hypochnose: json["hypochnose"], | |
| 968 | + lochage: json["lochage"], | |
| 969 | + melee: json["melee"], | |
| 970 | + nonconformitant: json["nonconformitant"], | |
| 971 | + poinsettia: json["Poinsettia"], | |
| 972 | + putatively: json["putatively"], | |
| 973 | + semivolatile: json["semivolatile"], | |
| 974 | + soleas: json["soleas"], | |
| 975 | + unfastenable: json["unfastenable"], | |
| 976 | + unmillinered: json["unmillinered"], | |
| 977 | + ); | |
| 978 | + | |
| 979 | + Map<String, dynamic> toJson() => { | |
| 980 | + "abranchian": abranchian, | |
| 981 | + "aculeiform": aculeiform, | |
| 982 | + "adiaphoristic": adiaphoristic, | |
| 983 | + "adoptionism": adoptionism, | |
| 984 | + "Anglic": anglic, | |
| 985 | + "antrotomy": antrotomy, | |
| 986 | + "coerciveness": coerciveness, | |
| 987 | + "decorist": decorist, | |
| 988 | + "duckhood": duckhood, | |
| 989 | + "Heteromeri": heteromeri, | |
| 990 | + "hypochnose": hypochnose, | |
| 991 | + "lochage": lochage, | |
| 992 | + "melee": melee, | |
| 993 | + "nonconformitant": nonconformitant, | |
| 994 | + "Poinsettia": poinsettia, | |
| 995 | + "putatively": putatively, | |
| 996 | + "semivolatile": semivolatile, | |
| 997 | + "soleas": soleas, | |
| 998 | + "unfastenable": unfastenable, | |
| 999 | + "unmillinered": unmillinered, | |
| 1000 | + }; | |
| 1001 | +} | |
| 1002 | + | |
| 1003 | +class FenkClass { | |
| 1004 | + final dynamic apoise; | |
| 1005 | + final dynamic astronomize; | |
| 1006 | + final dynamic cockhorse; | |
| 1007 | + final dynamic copular; | |
| 1008 | + final dynamic dagomba; | |
| 1009 | + final dynamic draffy; | |
| 1010 | + final dynamic foreigner; | |
| 1011 | + final dynamic guyandot; | |
| 1012 | + final dynamic neurogliosis; | |
| 1013 | + final dynamic osmious; | |
| 1014 | + final dynamic palpitate; | |
| 1015 | + final dynamic rebukeable; | |
| 1016 | + final dynamic reinwardtia; | |
| 1017 | + final dynamic reservatory; | |
| 1018 | + final dynamic scalt; | |
| 1019 | + final dynamic scripturalize; | |
| 1020 | + final dynamic tintometer; | |
| 1021 | + final dynamic tritoness; | |
| 1022 | + final dynamic undergrade; | |
| 1023 | + final dynamic undermountain; | |
| 1024 | + | |
| 1025 | + FenkClass({ | |
| 1026 | + required this.apoise, | |
| 1027 | + required this.astronomize, | |
| 1028 | + required this.cockhorse, | |
| 1029 | + required this.copular, | |
| 1030 | + required this.dagomba, | |
| 1031 | + required this.draffy, | |
| 1032 | + required this.foreigner, | |
| 1033 | + required this.guyandot, | |
| 1034 | + required this.neurogliosis, | |
| 1035 | + required this.osmious, | |
| 1036 | + required this.palpitate, | |
| 1037 | + required this.rebukeable, | |
| 1038 | + required this.reinwardtia, | |
| 1039 | + required this.reservatory, | |
| 1040 | + required this.scalt, | |
| 1041 | + required this.scripturalize, | |
| 1042 | + required this.tintometer, | |
| 1043 | + required this.tritoness, | |
| 1044 | + required this.undergrade, | |
| 1045 | + required this.undermountain, | |
| 1046 | + }); | |
| 1047 | + | |
| 1048 | + factory FenkClass.fromJson(Map<String, dynamic> json) => FenkClass( | |
| 1049 | + apoise: json["apoise"], | |
| 1050 | + astronomize: json["astronomize"], | |
| 1051 | + cockhorse: json["cockhorse"], | |
| 1052 | + copular: json["copular"], | |
| 1053 | + dagomba: json["Dagomba"], | |
| 1054 | + draffy: json["draffy"], | |
| 1055 | + foreigner: json["foreigner"], | |
| 1056 | + guyandot: json["Guyandot"], | |
| 1057 | + neurogliosis: json["neurogliosis"], | |
| 1058 | + osmious: json["osmious"], | |
| 1059 | + palpitate: json["palpitate"], | |
| 1060 | + rebukeable: json["rebukeable"], | |
| 1061 | + reinwardtia: json["Reinwardtia"], | |
| 1062 | + reservatory: json["reservatory"], | |
| 1063 | + scalt: json["scalt"], | |
| 1064 | + scripturalize: json["scripturalize"], | |
| 1065 | + tintometer: json["tintometer"], | |
| 1066 | + tritoness: json["Tritoness"], | |
| 1067 | + undergrade: json["undergrade"], | |
| 1068 | + undermountain: json["undermountain"], | |
| 1069 | + ); | |
| 1070 | + | |
| 1071 | + Map<String, dynamic> toJson() => { | |
| 1072 | + "apoise": apoise, | |
| 1073 | + "astronomize": astronomize, | |
| 1074 | + "cockhorse": cockhorse, | |
| 1075 | + "copular": copular, | |
| 1076 | + "Dagomba": dagomba, | |
| 1077 | + "draffy": draffy, | |
| 1078 | + "foreigner": foreigner, | |
| 1079 | + "Guyandot": guyandot, | |
| 1080 | + "neurogliosis": neurogliosis, | |
| 1081 | + "osmious": osmious, | |
| 1082 | + "palpitate": palpitate, | |
| 1083 | + "rebukeable": rebukeable, | |
| 1084 | + "Reinwardtia": reinwardtia, | |
| 1085 | + "reservatory": reservatory, | |
| 1086 | + "scalt": scalt, | |
| 1087 | + "scripturalize": scripturalize, | |
| 1088 | + "tintometer": tintometer, | |
| 1089 | + "Tritoness": tritoness, | |
| 1090 | + "undergrade": undergrade, | |
| 1091 | + "undermountain": undermountain, | |
| 1092 | + }; | |
| 1093 | +} | |
| 1094 | + | |
| 1095 | +class FlagmakingClass { | |
| 1096 | + final dynamic albarco; | |
| 1097 | + final dynamic bunodonta; | |
| 1098 | + final dynamic hornify; | |
| 1099 | + final dynamic hydrocorisae; | |
| 1100 | + final dynamic hypoglossus; | |
| 1101 | + final dynamic inexpiably; | |
| 1102 | + final dynamic ingratitude; | |
| 1103 | + final dynamic ladyfly; | |
| 1104 | + final dynamic medicament; | |
| 1105 | + final dynamic monogrammatic; | |
| 1106 | + final dynamic nobbut; | |
| 1107 | + final dynamic notacanthidae; | |
| 1108 | + final dynamic polyplacophore; | |
| 1109 | + final dynamic proexercise; | |
| 1110 | + final dynamic protoplast; | |
| 1111 | + final dynamic puzzling; | |
| 1112 | + final dynamic splanchnoskeleton; | |
| 1113 | + final dynamic unloveliness; | |
| 1114 | + final dynamic unquarantined; | |
| 1115 | + final dynamic unrenounceable; | |
| 1116 | + | |
| 1117 | + FlagmakingClass({ | |
| 1118 | + required this.albarco, | |
| 1119 | + required this.bunodonta, | |
| 1120 | + required this.hornify, | |
| 1121 | + required this.hydrocorisae, | |
| 1122 | + required this.hypoglossus, | |
| 1123 | + required this.inexpiably, | |
| 1124 | + required this.ingratitude, | |
| 1125 | + required this.ladyfly, | |
| 1126 | + required this.medicament, | |
| 1127 | + required this.monogrammatic, | |
| 1128 | + required this.nobbut, | |
| 1129 | + required this.notacanthidae, | |
| 1130 | + required this.polyplacophore, | |
| 1131 | + required this.proexercise, | |
| 1132 | + required this.protoplast, | |
| 1133 | + required this.puzzling, | |
| 1134 | + required this.splanchnoskeleton, | |
| 1135 | + required this.unloveliness, | |
| 1136 | + required this.unquarantined, | |
| 1137 | + required this.unrenounceable, | |
| 1138 | + }); | |
| 1139 | + | |
| 1140 | + factory FlagmakingClass.fromJson(Map<String, dynamic> json) => FlagmakingClass( | |
| 1141 | + albarco: json["albarco"], | |
| 1142 | + bunodonta: json["Bunodonta"], | |
| 1143 | + hornify: json["hornify"], | |
| 1144 | + hydrocorisae: json["Hydrocorisae"], | |
| 1145 | + hypoglossus: json["hypoglossus"], | |
| 1146 | + inexpiably: json["inexpiably"], | |
| 1147 | + ingratitude: json["ingratitude"], | |
| 1148 | + ladyfly: json["ladyfly"], | |
| 1149 | + medicament: json["medicament"], | |
| 1150 | + monogrammatic: json["monogrammatic"], | |
| 1151 | + nobbut: json["nobbut"], | |
| 1152 | + notacanthidae: json["Notacanthidae"], | |
| 1153 | + polyplacophore: json["polyplacophore"], | |
| 1154 | + proexercise: json["proexercise"], | |
| 1155 | + protoplast: json["protoplast"], | |
| 1156 | + puzzling: json["puzzling"], | |
| 1157 | + splanchnoskeleton: json["splanchnoskeleton"], | |
| 1158 | + unloveliness: json["unloveliness"], | |
| 1159 | + unquarantined: json["unquarantined"], | |
| 1160 | + unrenounceable: json["unrenounceable"], | |
| 1161 | + ); | |
| 1162 | + | |
| 1163 | + Map<String, dynamic> toJson() => { | |
| 1164 | + "albarco": albarco, | |
| 1165 | + "Bunodonta": bunodonta, | |
| 1166 | + "hornify": hornify, | |
| 1167 | + "Hydrocorisae": hydrocorisae, | |
| 1168 | + "hypoglossus": hypoglossus, | |
| 1169 | + "inexpiably": inexpiably, | |
| 1170 | + "ingratitude": ingratitude, | |
| 1171 | + "ladyfly": ladyfly, | |
| 1172 | + "medicament": medicament, | |
| 1173 | + "monogrammatic": monogrammatic, | |
| 1174 | + "nobbut": nobbut, | |
| 1175 | + "Notacanthidae": notacanthidae, | |
| 1176 | + "polyplacophore": polyplacophore, | |
| 1177 | + "proexercise": proexercise, | |
| 1178 | + "protoplast": protoplast, | |
| 1179 | + "puzzling": puzzling, | |
| 1180 | + "splanchnoskeleton": splanchnoskeleton, | |
| 1181 | + "unloveliness": unloveliness, | |
| 1182 | + "unquarantined": unquarantined, | |
| 1183 | + "unrenounceable": unrenounceable, | |
| 1184 | + }; | |
| 1185 | +} | |
| 1186 | + | |
| 1187 | +class HemocoeleClass { | |
| 1188 | + final dynamic acrogamy; | |
| 1189 | + final dynamic amelification; | |
| 1190 | + final dynamic autobiographic; | |
| 1191 | + final dynamic berat; | |
| 1192 | + final double? catharticalness; | |
| 1193 | + final int? chirotherium; | |
| 1194 | + final String? disdiapason; | |
| 1195 | + final dynamic disproportionably; | |
| 1196 | + final dynamic erythrite; | |
| 1197 | + final dynamic graphic; | |
| 1198 | + final dynamic hepatological; | |
| 1199 | + final bool? homocerc; | |
| 1200 | + final dynamic incommensurably; | |
| 1201 | + final dynamic misaffirm; | |
| 1202 | + final dynamic nonbookish; | |
| 1203 | + final dynamic pocketbook; | |
| 1204 | + final dynamic sclerometric; | |
| 1205 | + final dynamic stambouline; | |
| 1206 | + final dynamic stickpin; | |
| 1207 | + final dynamic tubulure; | |
| 1208 | + final dynamic undelated; | |
| 1209 | + final dynamic unsalt; | |
| 1210 | + final dynamic untutelar; | |
| 1211 | + final dynamic vagrant; | |
| 1212 | + final dynamic walt; | |
| 1213 | + | |
| 1214 | + HemocoeleClass({ | |
| 1215 | + this.acrogamy, | |
| 1216 | + this.amelification, | |
| 1217 | + this.autobiographic, | |
| 1218 | + this.berat, | |
| 1219 | + this.catharticalness, | |
| 1220 | + this.chirotherium, | |
| 1221 | + this.disdiapason, | |
| 1222 | + this.disproportionably, | |
| 1223 | + this.erythrite, | |
| 1224 | + this.graphic, | |
| 1225 | + this.hepatological, | |
| 1226 | + this.homocerc, | |
| 1227 | + this.incommensurably, | |
| 1228 | + this.misaffirm, | |
| 1229 | + this.nonbookish, | |
| 1230 | + this.pocketbook, | |
| 1231 | + this.sclerometric, | |
| 1232 | + this.stambouline, | |
| 1233 | + this.stickpin, | |
| 1234 | + this.tubulure, | |
| 1235 | + this.undelated, | |
| 1236 | + this.unsalt, | |
| 1237 | + this.untutelar, | |
| 1238 | + this.vagrant, | |
| 1239 | + this.walt, | |
| 1240 | + }); | |
| 1241 | + | |
| 1242 | + factory HemocoeleClass.fromJson(Map<String, dynamic> json) => HemocoeleClass( | |
| 1243 | + acrogamy: json["acrogamy"], | |
| 1244 | + amelification: json["amelification"], | |
| 1245 | + autobiographic: json["autobiographic"], | |
| 1246 | + berat: json["berat"], | |
| 1247 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 1248 | + chirotherium: json["Chirotherium"], | |
| 1249 | + disdiapason: json["disdiapason"], | |
| 1250 | + disproportionably: json["disproportionably"], | |
| 1251 | + erythrite: json["erythrite"], | |
| 1252 | + graphic: json["graphic"], | |
| 1253 | + hepatological: json["hepatological"], | |
| 1254 | + homocerc: json["homocerc"], | |
| 1255 | + incommensurably: json["incommensurably"], | |
| 1256 | + misaffirm: json["misaffirm"], | |
| 1257 | + nonbookish: json["nonbookish"], | |
| 1258 | + pocketbook: json["pocketbook"], | |
| 1259 | + sclerometric: json["sclerometric"], | |
| 1260 | + stambouline: json["stambouline"], | |
| 1261 | + stickpin: json["stickpin"], | |
| 1262 | + tubulure: json["tubulure"], | |
| 1263 | + undelated: json["undelated"], | |
| 1264 | + unsalt: json["unsalt"], | |
| 1265 | + untutelar: json["untutelar"], | |
| 1266 | + vagrant: json["vagrant"], | |
| 1267 | + walt: json["Walt"], | |
| 1268 | + ); | |
| 1269 | + | |
| 1270 | + Map<String, dynamic> toJson() => { | |
| 1271 | + "acrogamy": acrogamy, | |
| 1272 | + "amelification": amelification, | |
| 1273 | + "autobiographic": autobiographic, | |
| 1274 | + "berat": berat, | |
| 1275 | + "catharticalness": catharticalness, | |
| 1276 | + "Chirotherium": chirotherium, | |
| 1277 | + "disdiapason": disdiapason, | |
| 1278 | + "disproportionably": disproportionably, | |
| 1279 | + "erythrite": erythrite, | |
| 1280 | + "graphic": graphic, | |
| 1281 | + "hepatological": hepatological, | |
| 1282 | + "homocerc": homocerc, | |
| 1283 | + "incommensurably": incommensurably, | |
| 1284 | + "misaffirm": misaffirm, | |
| 1285 | + "nonbookish": nonbookish, | |
| 1286 | + "pocketbook": pocketbook, | |
| 1287 | + "sclerometric": sclerometric, | |
| 1288 | + "stambouline": stambouline, | |
| 1289 | + "stickpin": stickpin, | |
| 1290 | + "tubulure": tubulure, | |
| 1291 | + "undelated": undelated, | |
| 1292 | + "unsalt": unsalt, | |
| 1293 | + "untutelar": untutelar, | |
| 1294 | + "vagrant": vagrant, | |
| 1295 | + "Walt": walt, | |
| 1296 | + }; | |
| 1297 | +} | |
| 1298 | + | |
| 1299 | +class Interacinar { | |
| 1300 | + final double assapan; | |
| 1301 | + final bool benefactorship; | |
| 1302 | + final String triseriatim; | |
| 1303 | + final int tubbing; | |
| 1304 | + final dynamic untrimmed; | |
| 1305 | + | |
| 1306 | + Interacinar({ | |
| 1307 | + required this.assapan, | |
| 1308 | + required this.benefactorship, | |
| 1309 | + required this.triseriatim, | |
| 1310 | + required this.tubbing, | |
| 1311 | + required this.untrimmed, | |
| 1312 | + }); | |
| 1313 | + | |
| 1314 | + factory Interacinar.fromJson(Map<String, dynamic> json) => Interacinar( | |
| 1315 | + assapan: json["assapan"]?.toDouble(), | |
| 1316 | + benefactorship: json["benefactorship"], | |
| 1317 | + triseriatim: json["triseriatim"], | |
| 1318 | + tubbing: json["tubbing"], | |
| 1319 | + untrimmed: json["untrimmed"], | |
| 1320 | + ); | |
| 1321 | + | |
| 1322 | + Map<String, dynamic> toJson() => { | |
| 1323 | + "assapan": assapan, | |
| 1324 | + "benefactorship": benefactorship, | |
| 1325 | + "triseriatim": triseriatim, | |
| 1326 | + "tubbing": tubbing, | |
| 1327 | + "untrimmed": untrimmed, | |
| 1328 | + }; | |
| 1329 | +} |
Adartfinal-props-false--58a791807e0c / TopLevel.dart+1,329 −0
| @@ -0,0 +1,1329 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + String centrodesmose; | |
| 13 | + List<dynamic> cerograph; | |
| 14 | + List<dynamic> chemotherapeutics; | |
| 15 | + List<dynamic> cimelia; | |
| 16 | + int citrated; | |
| 17 | + List<dynamic> clinodome; | |
| 18 | + List<dynamic> coadjust; | |
| 19 | + List<dynamic> consilience; | |
| 20 | + List<dynamic> constructor; | |
| 21 | + List<dynamic> continuative; | |
| 22 | + List<dynamic> credulity; | |
| 23 | + List<dynamic> creviced; | |
| 24 | + List<List<int?>> cubiculum; | |
| 25 | + List<dynamic> deruralize; | |
| 26 | + List<dynamic> diaereses; | |
| 27 | + List<List<dynamic>?> dissolution; | |
| 28 | + List<dynamic> downstroke; | |
| 29 | + List<double?> electrotautomerism; | |
| 30 | + List<dynamic> eleutheromania; | |
| 31 | + Encrust encrust; | |
| 32 | + List<dynamic> entomoid; | |
| 33 | + List<dynamic> epipaleolithic; | |
| 34 | + List<dynamic> expropriable; | |
| 35 | + List<dynamic> faggingly; | |
| 36 | + List<dynamic> fenks; | |
| 37 | + List<dynamic> flagmaking; | |
| 38 | + List<dynamic> fluorometer; | |
| 39 | + List<int?> fulsome; | |
| 40 | + List<dynamic> fuzzy; | |
| 41 | + List<dynamic> gardenwards; | |
| 42 | + List<dynamic> generalissimo; | |
| 43 | + List<Map<String, int>?> habeas; | |
| 44 | + List<dynamic> hemicrystalline; | |
| 45 | + List<dynamic> hemocoele; | |
| 46 | + List<dynamic> hoister; | |
| 47 | + List<dynamic> hyperpiesis; | |
| 48 | + List<dynamic> hyppish; | |
| 49 | + List<dynamic> idealizer; | |
| 50 | + List<dynamic> incrustator; | |
| 51 | + List<dynamic> intentiveness; | |
| 52 | + Interacinar interacinar; | |
| 53 | + List<List<int>?> intercorrelation; | |
| 54 | + List<dynamic> jacutinga; | |
| 55 | + | |
| 56 | + TopLevel({ | |
| 57 | + required this.centrodesmose, | |
| 58 | + required this.cerograph, | |
| 59 | + required this.chemotherapeutics, | |
| 60 | + required this.cimelia, | |
| 61 | + required this.citrated, | |
| 62 | + required this.clinodome, | |
| 63 | + required this.coadjust, | |
| 64 | + required this.consilience, | |
| 65 | + required this.constructor, | |
| 66 | + required this.continuative, | |
| 67 | + required this.credulity, | |
| 68 | + required this.creviced, | |
| 69 | + required this.cubiculum, | |
| 70 | + required this.deruralize, | |
| 71 | + required this.diaereses, | |
| 72 | + required this.dissolution, | |
| 73 | + required this.downstroke, | |
| 74 | + required this.electrotautomerism, | |
| 75 | + required this.eleutheromania, | |
| 76 | + required this.encrust, | |
| 77 | + required this.entomoid, | |
| 78 | + required this.epipaleolithic, | |
| 79 | + required this.expropriable, | |
| 80 | + required this.faggingly, | |
| 81 | + required this.fenks, | |
| 82 | + required this.flagmaking, | |
| 83 | + required this.fluorometer, | |
| 84 | + required this.fulsome, | |
| 85 | + required this.fuzzy, | |
| 86 | + required this.gardenwards, | |
| 87 | + required this.generalissimo, | |
| 88 | + required this.habeas, | |
| 89 | + required this.hemicrystalline, | |
| 90 | + required this.hemocoele, | |
| 91 | + required this.hoister, | |
| 92 | + required this.hyperpiesis, | |
| 93 | + required this.hyppish, | |
| 94 | + required this.idealizer, | |
| 95 | + required this.incrustator, | |
| 96 | + required this.intentiveness, | |
| 97 | + required this.interacinar, | |
| 98 | + required this.intercorrelation, | |
| 99 | + required this.jacutinga, | |
| 100 | + }); | |
| 101 | + | |
| 102 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 103 | + centrodesmose: json["centrodesmose"], | |
| 104 | + cerograph: List<dynamic>.from(json["cerograph"].map((x) => x)), | |
| 105 | + chemotherapeutics: List<dynamic>.from(json["chemotherapeutics"].map((x) => x)), | |
| 106 | + cimelia: List<dynamic>.from(json["cimelia"].map((x) => x)), | |
| 107 | + citrated: json["citrated"], | |
| 108 | + clinodome: List<dynamic>.from(json["clinodome"].map((x) => x)), | |
| 109 | + coadjust: List<dynamic>.from(json["coadjust"].map((x) => x)), | |
| 110 | + consilience: List<dynamic>.from(json["consilience"].map((x) => x)), | |
| 111 | + constructor: List<dynamic>.from(json["constructor"].map((x) => x)), | |
| 112 | + continuative: List<dynamic>.from(json["continuative"].map((x) => x)), | |
| 113 | + credulity: List<dynamic>.from(json["credulity"].map((x) => x)), | |
| 114 | + creviced: List<dynamic>.from(json["creviced"].map((x) => x)), | |
| 115 | + cubiculum: List<List<int?>>.from(json["cubiculum"].map((x) => List<int?>.from(x.map((x) => x)))), | |
| 116 | + deruralize: List<dynamic>.from(json["deruralize"].map((x) => x)), | |
| 117 | + diaereses: List<dynamic>.from(json["diaereses"].map((x) => x)), | |
| 118 | + dissolution: List<List<dynamic>?>.from(json["dissolution"].map((x) => x == null ? null : List<dynamic>.from(x!.map((x) => x)))), | |
| 119 | + downstroke: List<dynamic>.from(json["downstroke"].map((x) => x)), | |
| 120 | + electrotautomerism: List<double?>.from(json["electrotautomerism"].map((x) => x?.toDouble())), | |
| 121 | + eleutheromania: List<dynamic>.from(json["eleutheromania"].map((x) => x)), | |
| 122 | + encrust: Encrust.fromJson(json["encrust"]), | |
| 123 | + entomoid: List<dynamic>.from(json["entomoid"].map((x) => x)), | |
| 124 | + epipaleolithic: List<dynamic>.from(json["epipaleolithic"].map((x) => x)), | |
| 125 | + expropriable: List<dynamic>.from(json["expropriable"].map((x) => x)), | |
| 126 | + faggingly: List<dynamic>.from(json["faggingly"].map((x) => x)), | |
| 127 | + fenks: List<dynamic>.from(json["fenks"].map((x) => x)), | |
| 128 | + flagmaking: List<dynamic>.from(json["flagmaking"].map((x) => x)), | |
| 129 | + fluorometer: List<dynamic>.from(json["fluorometer"].map((x) => x)), | |
| 130 | + fulsome: List<int?>.from(json["fulsome"].map((x) => x)), | |
| 131 | + fuzzy: List<dynamic>.from(json["fuzzy"].map((x) => x)), | |
| 132 | + gardenwards: List<dynamic>.from(json["gardenwards"].map((x) => x)), | |
| 133 | + generalissimo: List<dynamic>.from(json["generalissimo"].map((x) => x)), | |
| 134 | + habeas: List<Map<String, int>?>.from(json["habeas"].map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, int>(k, v)))), | |
| 135 | + hemicrystalline: List<dynamic>.from(json["hemicrystalline"].map((x) => x)), | |
| 136 | + hemocoele: List<dynamic>.from(json["hemocoele"].map((x) => x)), | |
| 137 | + hoister: List<dynamic>.from(json["hoister"].map((x) => x)), | |
| 138 | + hyperpiesis: List<dynamic>.from(json["hyperpiesis"].map((x) => x)), | |
| 139 | + hyppish: List<dynamic>.from(json["hyppish"].map((x) => x)), | |
| 140 | + idealizer: List<dynamic>.from(json["idealizer"].map((x) => x)), | |
| 141 | + incrustator: List<dynamic>.from(json["incrustator"].map((x) => x)), | |
| 142 | + intentiveness: List<dynamic>.from(json["intentiveness"].map((x) => x)), | |
| 143 | + interacinar: Interacinar.fromJson(json["interacinar"]), | |
| 144 | + intercorrelation: List<List<int>?>.from(json["intercorrelation"].map((x) => x == null ? null : List<int>.from(x!.map((x) => x)))), | |
| 145 | + jacutinga: List<dynamic>.from(json["jacutinga"].map((x) => x)), | |
| 146 | + ); | |
| 147 | + | |
| 148 | + Map<String, dynamic> toJson() => { | |
| 149 | + "centrodesmose": centrodesmose, | |
| 150 | + "cerograph": List<dynamic>.from(cerograph.map((x) => x)), | |
| 151 | + "chemotherapeutics": List<dynamic>.from(chemotherapeutics.map((x) => x)), | |
| 152 | + "cimelia": List<dynamic>.from(cimelia.map((x) => x)), | |
| 153 | + "citrated": citrated, | |
| 154 | + "clinodome": List<dynamic>.from(clinodome.map((x) => x)), | |
| 155 | + "coadjust": List<dynamic>.from(coadjust.map((x) => x)), | |
| 156 | + "consilience": List<dynamic>.from(consilience.map((x) => x)), | |
| 157 | + "constructor": List<dynamic>.from(constructor.map((x) => x)), | |
| 158 | + "continuative": List<dynamic>.from(continuative.map((x) => x)), | |
| 159 | + "credulity": List<dynamic>.from(credulity.map((x) => x)), | |
| 160 | + "creviced": List<dynamic>.from(creviced.map((x) => x)), | |
| 161 | + "cubiculum": List<dynamic>.from(cubiculum.map((x) => List<dynamic>.from(x.map((x) => x)))), | |
| 162 | + "deruralize": List<dynamic>.from(deruralize.map((x) => x)), | |
| 163 | + "diaereses": List<dynamic>.from(diaereses.map((x) => x)), | |
| 164 | + "dissolution": List<dynamic>.from(dissolution.map((x) => x == null ? null : List<dynamic>.from(x!.map((x) => x)))), | |
| 165 | + "downstroke": List<dynamic>.from(downstroke.map((x) => x)), | |
| 166 | + "electrotautomerism": List<dynamic>.from(electrotautomerism.map((x) => x)), | |
| 167 | + "eleutheromania": List<dynamic>.from(eleutheromania.map((x) => x)), | |
| 168 | + "encrust": encrust.toJson(), | |
| 169 | + "entomoid": List<dynamic>.from(entomoid.map((x) => x)), | |
| 170 | + "epipaleolithic": List<dynamic>.from(epipaleolithic.map((x) => x)), | |
| 171 | + "expropriable": List<dynamic>.from(expropriable.map((x) => x)), | |
| 172 | + "faggingly": List<dynamic>.from(faggingly.map((x) => x)), | |
| 173 | + "fenks": List<dynamic>.from(fenks.map((x) => x)), | |
| 174 | + "flagmaking": List<dynamic>.from(flagmaking.map((x) => x)), | |
| 175 | + "fluorometer": List<dynamic>.from(fluorometer.map((x) => x)), | |
| 176 | + "fulsome": List<dynamic>.from(fulsome.map((x) => x)), | |
| 177 | + "fuzzy": List<dynamic>.from(fuzzy.map((x) => x)), | |
| 178 | + "gardenwards": List<dynamic>.from(gardenwards.map((x) => x)), | |
| 179 | + "generalissimo": List<dynamic>.from(generalissimo.map((x) => x)), | |
| 180 | + "habeas": List<dynamic>.from(habeas.map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, dynamic>(k, v)))), | |
| 181 | + "hemicrystalline": List<dynamic>.from(hemicrystalline.map((x) => x)), | |
| 182 | + "hemocoele": List<dynamic>.from(hemocoele.map((x) => x)), | |
| 183 | + "hoister": List<dynamic>.from(hoister.map((x) => x)), | |
| 184 | + "hyperpiesis": List<dynamic>.from(hyperpiesis.map((x) => x)), | |
| 185 | + "hyppish": List<dynamic>.from(hyppish.map((x) => x)), | |
| 186 | + "idealizer": List<dynamic>.from(idealizer.map((x) => x)), | |
| 187 | + "incrustator": List<dynamic>.from(incrustator.map((x) => x)), | |
| 188 | + "intentiveness": List<dynamic>.from(intentiveness.map((x) => x)), | |
| 189 | + "interacinar": interacinar.toJson(), | |
| 190 | + "intercorrelation": List<dynamic>.from(intercorrelation.map((x) => x == null ? null : List<dynamic>.from(x!.map((x) => x)))), | |
| 191 | + "jacutinga": List<dynamic>.from(jacutinga.map((x) => x)), | |
| 192 | + }; | |
| 193 | +} | |
| 194 | + | |
| 195 | +class CerographClass { | |
| 196 | + dynamic apotropaion; | |
| 197 | + dynamic casuary; | |
| 198 | + dynamic creaker; | |
| 199 | + dynamic disqualification; | |
| 200 | + dynamic imperatorious; | |
| 201 | + dynamic impermeabilize; | |
| 202 | + dynamic metastoma; | |
| 203 | + dynamic noctidiurnal; | |
| 204 | + dynamic nonreserve; | |
| 205 | + dynamic ophthalmotonometry; | |
| 206 | + dynamic pailful; | |
| 207 | + dynamic pigfish; | |
| 208 | + dynamic pongee; | |
| 209 | + dynamic prosodical; | |
| 210 | + dynamic scrofuloderm; | |
| 211 | + dynamic storekeeping; | |
| 212 | + dynamic therologist; | |
| 213 | + dynamic tolowa; | |
| 214 | + dynamic tradeful; | |
| 215 | + dynamic unriveting; | |
| 216 | + | |
| 217 | + CerographClass({ | |
| 218 | + required this.apotropaion, | |
| 219 | + required this.casuary, | |
| 220 | + required this.creaker, | |
| 221 | + required this.disqualification, | |
| 222 | + required this.imperatorious, | |
| 223 | + required this.impermeabilize, | |
| 224 | + required this.metastoma, | |
| 225 | + required this.noctidiurnal, | |
| 226 | + required this.nonreserve, | |
| 227 | + required this.ophthalmotonometry, | |
| 228 | + required this.pailful, | |
| 229 | + required this.pigfish, | |
| 230 | + required this.pongee, | |
| 231 | + required this.prosodical, | |
| 232 | + required this.scrofuloderm, | |
| 233 | + required this.storekeeping, | |
| 234 | + required this.therologist, | |
| 235 | + required this.tolowa, | |
| 236 | + required this.tradeful, | |
| 237 | + required this.unriveting, | |
| 238 | + }); | |
| 239 | + | |
| 240 | + factory CerographClass.fromJson(Map<String, dynamic> json) => CerographClass( | |
| 241 | + apotropaion: json["apotropaion"], | |
| 242 | + casuary: json["casuary"], | |
| 243 | + creaker: json["creaker"], | |
| 244 | + disqualification: json["disqualification"], | |
| 245 | + imperatorious: json["imperatorious"], | |
| 246 | + impermeabilize: json["impermeabilize"], | |
| 247 | + metastoma: json["metastoma"], | |
| 248 | + noctidiurnal: json["noctidiurnal"], | |
| 249 | + nonreserve: json["nonreserve"], | |
| 250 | + ophthalmotonometry: json["ophthalmotonometry"], | |
| 251 | + pailful: json["pailful"], | |
| 252 | + pigfish: json["pigfish"], | |
| 253 | + pongee: json["pongee"], | |
| 254 | + prosodical: json["prosodical"], | |
| 255 | + scrofuloderm: json["scrofuloderm"], | |
| 256 | + storekeeping: json["storekeeping"], | |
| 257 | + therologist: json["therologist"], | |
| 258 | + tolowa: json["Tolowa"], | |
| 259 | + tradeful: json["tradeful"], | |
| 260 | + unriveting: json["unriveting"], | |
| 261 | + ); | |
| 262 | + | |
| 263 | + Map<String, dynamic> toJson() => { | |
| 264 | + "apotropaion": apotropaion, | |
| 265 | + "casuary": casuary, | |
| 266 | + "creaker": creaker, | |
| 267 | + "disqualification": disqualification, | |
| 268 | + "imperatorious": imperatorious, | |
| 269 | + "impermeabilize": impermeabilize, | |
| 270 | + "metastoma": metastoma, | |
| 271 | + "noctidiurnal": noctidiurnal, | |
| 272 | + "nonreserve": nonreserve, | |
| 273 | + "ophthalmotonometry": ophthalmotonometry, | |
| 274 | + "pailful": pailful, | |
| 275 | + "pigfish": pigfish, | |
| 276 | + "pongee": pongee, | |
| 277 | + "prosodical": prosodical, | |
| 278 | + "scrofuloderm": scrofuloderm, | |
| 279 | + "storekeeping": storekeeping, | |
| 280 | + "therologist": therologist, | |
| 281 | + "Tolowa": tolowa, | |
| 282 | + "tradeful": tradeful, | |
| 283 | + "unriveting": unriveting, | |
| 284 | + }; | |
| 285 | +} | |
| 286 | + | |
| 287 | +class ChemotherapeuticClass { | |
| 288 | + dynamic angioneurotic; | |
| 289 | + dynamic availment; | |
| 290 | + dynamic bladelet; | |
| 291 | + double? catharticalness; | |
| 292 | + dynamic caulis; | |
| 293 | + dynamic chalcus; | |
| 294 | + int? chirotherium; | |
| 295 | + String? disdiapason; | |
| 296 | + dynamic enteradenological; | |
| 297 | + bool? homocerc; | |
| 298 | + dynamic imporosity; | |
| 299 | + dynamic insistently; | |
| 300 | + dynamic intraparietal; | |
| 301 | + dynamic ivied; | |
| 302 | + dynamic maureen; | |
| 303 | + dynamic nonbookish; | |
| 304 | + dynamic nostochine; | |
| 305 | + dynamic nutcracker; | |
| 306 | + dynamic ofttimes; | |
| 307 | + dynamic phenocryst; | |
| 308 | + dynamic precoincident; | |
| 309 | + dynamic ramiferous; | |
| 310 | + dynamic stagmometer; | |
| 311 | + dynamic tetherball; | |
| 312 | + dynamic unshy; | |
| 313 | + | |
| 314 | + ChemotherapeuticClass({ | |
| 315 | + this.angioneurotic, | |
| 316 | + this.availment, | |
| 317 | + this.bladelet, | |
| 318 | + this.catharticalness, | |
| 319 | + this.caulis, | |
| 320 | + this.chalcus, | |
| 321 | + this.chirotherium, | |
| 322 | + this.disdiapason, | |
| 323 | + this.enteradenological, | |
| 324 | + this.homocerc, | |
| 325 | + this.imporosity, | |
| 326 | + this.insistently, | |
| 327 | + this.intraparietal, | |
| 328 | + this.ivied, | |
| 329 | + this.maureen, | |
| 330 | + this.nonbookish, | |
| 331 | + this.nostochine, | |
| 332 | + this.nutcracker, | |
| 333 | + this.ofttimes, | |
| 334 | + this.phenocryst, | |
| 335 | + this.precoincident, | |
| 336 | + this.ramiferous, | |
| 337 | + this.stagmometer, | |
| 338 | + this.tetherball, | |
| 339 | + this.unshy, | |
| 340 | + }); | |
| 341 | + | |
| 342 | + factory ChemotherapeuticClass.fromJson(Map<String, dynamic> json) => ChemotherapeuticClass( | |
| 343 | + angioneurotic: json["angioneurotic"], | |
| 344 | + availment: json["availment"], | |
| 345 | + bladelet: json["bladelet"], | |
| 346 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 347 | + caulis: json["caulis"], | |
| 348 | + chalcus: json["chalcus"], | |
| 349 | + chirotherium: json["Chirotherium"], | |
| 350 | + disdiapason: json["disdiapason"], | |
| 351 | + enteradenological: json["enteradenological"], | |
| 352 | + homocerc: json["homocerc"], | |
| 353 | + imporosity: json["imporosity"], | |
| 354 | + insistently: json["insistently"], | |
| 355 | + intraparietal: json["intraparietal"], | |
| 356 | + ivied: json["ivied"], | |
| 357 | + maureen: json["Maureen"], | |
| 358 | + nonbookish: json["nonbookish"], | |
| 359 | + nostochine: json["nostochine"], | |
| 360 | + nutcracker: json["nutcracker"], | |
| 361 | + ofttimes: json["ofttimes"], | |
| 362 | + phenocryst: json["phenocryst"], | |
| 363 | + precoincident: json["precoincident"], | |
| 364 | + ramiferous: json["ramiferous"], | |
| 365 | + stagmometer: json["stagmometer"], | |
| 366 | + tetherball: json["tetherball"], | |
| 367 | + unshy: json["unshy"], | |
| 368 | + ); | |
| 369 | + | |
| 370 | + Map<String, dynamic> toJson() => { | |
| 371 | + "angioneurotic": angioneurotic, | |
| 372 | + "availment": availment, | |
| 373 | + "bladelet": bladelet, | |
| 374 | + "catharticalness": catharticalness, | |
| 375 | + "caulis": caulis, | |
| 376 | + "chalcus": chalcus, | |
| 377 | + "Chirotherium": chirotherium, | |
| 378 | + "disdiapason": disdiapason, | |
| 379 | + "enteradenological": enteradenological, | |
| 380 | + "homocerc": homocerc, | |
| 381 | + "imporosity": imporosity, | |
| 382 | + "insistently": insistently, | |
| 383 | + "intraparietal": intraparietal, | |
| 384 | + "ivied": ivied, | |
| 385 | + "Maureen": maureen, | |
| 386 | + "nonbookish": nonbookish, | |
| 387 | + "nostochine": nostochine, | |
| 388 | + "nutcracker": nutcracker, | |
| 389 | + "ofttimes": ofttimes, | |
| 390 | + "phenocryst": phenocryst, | |
| 391 | + "precoincident": precoincident, | |
| 392 | + "ramiferous": ramiferous, | |
| 393 | + "stagmometer": stagmometer, | |
| 394 | + "tetherball": tetherball, | |
| 395 | + "unshy": unshy, | |
| 396 | + }; | |
| 397 | +} | |
| 398 | + | |
| 399 | +class CimeliaClass { | |
| 400 | + double catharticalness; | |
| 401 | + int chirotherium; | |
| 402 | + String disdiapason; | |
| 403 | + bool homocerc; | |
| 404 | + dynamic nonbookish; | |
| 405 | + | |
| 406 | + CimeliaClass({ | |
| 407 | + required this.catharticalness, | |
| 408 | + required this.chirotherium, | |
| 409 | + required this.disdiapason, | |
| 410 | + required this.homocerc, | |
| 411 | + required this.nonbookish, | |
| 412 | + }); | |
| 413 | + | |
| 414 | + factory CimeliaClass.fromJson(Map<String, dynamic> json) => CimeliaClass( | |
| 415 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 416 | + chirotherium: json["Chirotherium"], | |
| 417 | + disdiapason: json["disdiapason"], | |
| 418 | + homocerc: json["homocerc"], | |
| 419 | + nonbookish: json["nonbookish"], | |
| 420 | + ); | |
| 421 | + | |
| 422 | + Map<String, dynamic> toJson() => { | |
| 423 | + "catharticalness": catharticalness, | |
| 424 | + "Chirotherium": chirotherium, | |
| 425 | + "disdiapason": disdiapason, | |
| 426 | + "homocerc": homocerc, | |
| 427 | + "nonbookish": nonbookish, | |
| 428 | + }; | |
| 429 | +} | |
| 430 | + | |
| 431 | +class CoadjustClass { | |
| 432 | + dynamic amidosulphonal; | |
| 433 | + dynamic benny; | |
| 434 | + double? catharticalness; | |
| 435 | + int? chirotherium; | |
| 436 | + String? disdiapason; | |
| 437 | + dynamic ensnare; | |
| 438 | + bool? homocerc; | |
| 439 | + dynamic hybridizer; | |
| 440 | + dynamic leastwise; | |
| 441 | + dynamic lof; | |
| 442 | + dynamic monkhood; | |
| 443 | + dynamic netherlandish; | |
| 444 | + dynamic nonbookish; | |
| 445 | + dynamic peonism; | |
| 446 | + dynamic phonelescope; | |
| 447 | + dynamic porphyrogeniture; | |
| 448 | + dynamic preindemnify; | |
| 449 | + dynamic rosal; | |
| 450 | + dynamic scalenous; | |
| 451 | + dynamic scopine; | |
| 452 | + dynamic sedaceae; | |
| 453 | + dynamic suberinize; | |
| 454 | + dynamic symbiot; | |
| 455 | + dynamic tablefellow; | |
| 456 | + dynamic unchargeable; | |
| 457 | + | |
| 458 | + CoadjustClass({ | |
| 459 | + this.amidosulphonal, | |
| 460 | + this.benny, | |
| 461 | + this.catharticalness, | |
| 462 | + this.chirotherium, | |
| 463 | + this.disdiapason, | |
| 464 | + this.ensnare, | |
| 465 | + this.homocerc, | |
| 466 | + this.hybridizer, | |
| 467 | + this.leastwise, | |
| 468 | + this.lof, | |
| 469 | + this.monkhood, | |
| 470 | + this.netherlandish, | |
| 471 | + this.nonbookish, | |
| 472 | + this.peonism, | |
| 473 | + this.phonelescope, | |
| 474 | + this.porphyrogeniture, | |
| 475 | + this.preindemnify, | |
| 476 | + this.rosal, | |
| 477 | + this.scalenous, | |
| 478 | + this.scopine, | |
| 479 | + this.sedaceae, | |
| 480 | + this.suberinize, | |
| 481 | + this.symbiot, | |
| 482 | + this.tablefellow, | |
| 483 | + this.unchargeable, | |
| 484 | + }); | |
| 485 | + | |
| 486 | + factory CoadjustClass.fromJson(Map<String, dynamic> json) => CoadjustClass( | |
| 487 | + amidosulphonal: json["amidosulphonal"], | |
| 488 | + benny: json["Benny"], | |
| 489 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 490 | + chirotherium: json["Chirotherium"], | |
| 491 | + disdiapason: json["disdiapason"], | |
| 492 | + ensnare: json["ensnare"], | |
| 493 | + homocerc: json["homocerc"], | |
| 494 | + hybridizer: json["hybridizer"], | |
| 495 | + leastwise: json["leastwise"], | |
| 496 | + lof: json["lof"], | |
| 497 | + monkhood: json["monkhood"], | |
| 498 | + netherlandish: json["Netherlandish"], | |
| 499 | + nonbookish: json["nonbookish"], | |
| 500 | + peonism: json["peonism"], | |
| 501 | + phonelescope: json["Phonelescope"], | |
| 502 | + porphyrogeniture: json["porphyrogeniture"], | |
| 503 | + preindemnify: json["preindemnify"], | |
| 504 | + rosal: json["rosal"], | |
| 505 | + scalenous: json["scalenous"], | |
| 506 | + scopine: json["scopine"], | |
| 507 | + sedaceae: json["Sedaceae"], | |
| 508 | + suberinize: json["suberinize"], | |
| 509 | + symbiot: json["symbiot"], | |
| 510 | + tablefellow: json["tablefellow"], | |
| 511 | + unchargeable: json["unchargeable"], | |
| 512 | + ); | |
| 513 | + | |
| 514 | + Map<String, dynamic> toJson() => { | |
| 515 | + "amidosulphonal": amidosulphonal, | |
| 516 | + "Benny": benny, | |
| 517 | + "catharticalness": catharticalness, | |
| 518 | + "Chirotherium": chirotherium, | |
| 519 | + "disdiapason": disdiapason, | |
| 520 | + "ensnare": ensnare, | |
| 521 | + "homocerc": homocerc, | |
| 522 | + "hybridizer": hybridizer, | |
| 523 | + "leastwise": leastwise, | |
| 524 | + "lof": lof, | |
| 525 | + "monkhood": monkhood, | |
| 526 | + "Netherlandish": netherlandish, | |
| 527 | + "nonbookish": nonbookish, | |
| 528 | + "peonism": peonism, | |
| 529 | + "Phonelescope": phonelescope, | |
| 530 | + "porphyrogeniture": porphyrogeniture, | |
| 531 | + "preindemnify": preindemnify, | |
| 532 | + "rosal": rosal, | |
| 533 | + "scalenous": scalenous, | |
| 534 | + "scopine": scopine, | |
| 535 | + "Sedaceae": sedaceae, | |
| 536 | + "suberinize": suberinize, | |
| 537 | + "symbiot": symbiot, | |
| 538 | + "tablefellow": tablefellow, | |
| 539 | + "unchargeable": unchargeable, | |
| 540 | + }; | |
| 541 | +} | |
| 542 | + | |
| 543 | +class CredulityClass { | |
| 544 | + dynamic ammonolytic; | |
| 545 | + dynamic bushmaster; | |
| 546 | + dynamic considering; | |
| 547 | + dynamic consuetudinary; | |
| 548 | + dynamic embarras; | |
| 549 | + dynamic fineness; | |
| 550 | + dynamic flaithship; | |
| 551 | + dynamic flavia; | |
| 552 | + dynamic gruffly; | |
| 553 | + dynamic hedychium; | |
| 554 | + dynamic leadwort; | |
| 555 | + dynamic overseriously; | |
| 556 | + dynamic parabola; | |
| 557 | + dynamic pectinatodenticulate; | |
| 558 | + dynamic popean; | |
| 559 | + dynamic pornocrat; | |
| 560 | + dynamic quadrisect; | |
| 561 | + dynamic seriality; | |
| 562 | + dynamic vamphorn; | |
| 563 | + dynamic wharp; | |
| 564 | + | |
| 565 | + CredulityClass({ | |
| 566 | + required this.ammonolytic, | |
| 567 | + required this.bushmaster, | |
| 568 | + required this.considering, | |
| 569 | + required this.consuetudinary, | |
| 570 | + required this.embarras, | |
| 571 | + required this.fineness, | |
| 572 | + required this.flaithship, | |
| 573 | + required this.flavia, | |
| 574 | + required this.gruffly, | |
| 575 | + required this.hedychium, | |
| 576 | + required this.leadwort, | |
| 577 | + required this.overseriously, | |
| 578 | + required this.parabola, | |
| 579 | + required this.pectinatodenticulate, | |
| 580 | + required this.popean, | |
| 581 | + required this.pornocrat, | |
| 582 | + required this.quadrisect, | |
| 583 | + required this.seriality, | |
| 584 | + required this.vamphorn, | |
| 585 | + required this.wharp, | |
| 586 | + }); | |
| 587 | + | |
| 588 | + factory CredulityClass.fromJson(Map<String, dynamic> json) => CredulityClass( | |
| 589 | + ammonolytic: json["ammonolytic"], | |
| 590 | + bushmaster: json["bushmaster"], | |
| 591 | + considering: json["considering"], | |
| 592 | + consuetudinary: json["consuetudinary"], | |
| 593 | + embarras: json["embarras"], | |
| 594 | + fineness: json["fineness"], | |
| 595 | + flaithship: json["flaithship"], | |
| 596 | + flavia: json["Flavia"], | |
| 597 | + gruffly: json["gruffly"], | |
| 598 | + hedychium: json["Hedychium"], | |
| 599 | + leadwort: json["leadwort"], | |
| 600 | + overseriously: json["overseriously"], | |
| 601 | + parabola: json["parabola"], | |
| 602 | + pectinatodenticulate: json["pectinatodenticulate"], | |
| 603 | + popean: json["Popean"], | |
| 604 | + pornocrat: json["pornocrat"], | |
| 605 | + quadrisect: json["quadrisect"], | |
| 606 | + seriality: json["seriality"], | |
| 607 | + vamphorn: json["vamphorn"], | |
| 608 | + wharp: json["wharp"], | |
| 609 | + ); | |
| 610 | + | |
| 611 | + Map<String, dynamic> toJson() => { | |
| 612 | + "ammonolytic": ammonolytic, | |
| 613 | + "bushmaster": bushmaster, | |
| 614 | + "considering": considering, | |
| 615 | + "consuetudinary": consuetudinary, | |
| 616 | + "embarras": embarras, | |
| 617 | + "fineness": fineness, | |
| 618 | + "flaithship": flaithship, | |
| 619 | + "Flavia": flavia, | |
| 620 | + "gruffly": gruffly, | |
| 621 | + "Hedychium": hedychium, | |
| 622 | + "leadwort": leadwort, | |
| 623 | + "overseriously": overseriously, | |
| 624 | + "parabola": parabola, | |
| 625 | + "pectinatodenticulate": pectinatodenticulate, | |
| 626 | + "Popean": popean, | |
| 627 | + "pornocrat": pornocrat, | |
| 628 | + "quadrisect": quadrisect, | |
| 629 | + "seriality": seriality, | |
| 630 | + "vamphorn": vamphorn, | |
| 631 | + "wharp": wharp, | |
| 632 | + }; | |
| 633 | +} | |
| 634 | + | |
| 635 | +class DeruralizeClass { | |
| 636 | + dynamic bockerel; | |
| 637 | + dynamic boulder; | |
| 638 | + dynamic churrus; | |
| 639 | + dynamic counterdigged; | |
| 640 | + dynamic dialogite; | |
| 641 | + dynamic digenic; | |
| 642 | + dynamic dunbird; | |
| 643 | + dynamic ergatogyne; | |
| 644 | + dynamic fiendful; | |
| 645 | + dynamic jackrod; | |
| 646 | + dynamic jehovistic; | |
| 647 | + dynamic paninean; | |
| 648 | + dynamic panther; | |
| 649 | + dynamic placentigerous; | |
| 650 | + dynamic romney; | |
| 651 | + dynamic sparm; | |
| 652 | + dynamic tocsin; | |
| 653 | + dynamic unnicked; | |
| 654 | + dynamic unstavable; | |
| 655 | + dynamic windfirm; | |
| 656 | + | |
| 657 | + DeruralizeClass({ | |
| 658 | + required this.bockerel, | |
| 659 | + required this.boulder, | |
| 660 | + required this.churrus, | |
| 661 | + required this.counterdigged, | |
| 662 | + required this.dialogite, | |
| 663 | + required this.digenic, | |
| 664 | + required this.dunbird, | |
| 665 | + required this.ergatogyne, | |
| 666 | + required this.fiendful, | |
| 667 | + required this.jackrod, | |
| 668 | + required this.jehovistic, | |
| 669 | + required this.paninean, | |
| 670 | + required this.panther, | |
| 671 | + required this.placentigerous, | |
| 672 | + required this.romney, | |
| 673 | + required this.sparm, | |
| 674 | + required this.tocsin, | |
| 675 | + required this.unnicked, | |
| 676 | + required this.unstavable, | |
| 677 | + required this.windfirm, | |
| 678 | + }); | |
| 679 | + | |
| 680 | + factory DeruralizeClass.fromJson(Map<String, dynamic> json) => DeruralizeClass( | |
| 681 | + bockerel: json["bockerel"], | |
| 682 | + boulder: json["boulder"], | |
| 683 | + churrus: json["churrus"], | |
| 684 | + counterdigged: json["counterdigged"], | |
| 685 | + dialogite: json["dialogite"], | |
| 686 | + digenic: json["digenic"], | |
| 687 | + dunbird: json["dunbird"], | |
| 688 | + ergatogyne: json["ergatogyne"], | |
| 689 | + fiendful: json["fiendful"], | |
| 690 | + jackrod: json["jackrod"], | |
| 691 | + jehovistic: json["Jehovistic"], | |
| 692 | + paninean: json["Paninean"], | |
| 693 | + panther: json["panther"], | |
| 694 | + placentigerous: json["placentigerous"], | |
| 695 | + romney: json["Romney"], | |
| 696 | + sparm: json["sparm"], | |
| 697 | + tocsin: json["tocsin"], | |
| 698 | + unnicked: json["unnicked"], | |
| 699 | + unstavable: json["unstavable"], | |
| 700 | + windfirm: json["windfirm"], | |
| 701 | + ); | |
| 702 | + | |
| 703 | + Map<String, dynamic> toJson() => { | |
| 704 | + "bockerel": bockerel, | |
| 705 | + "boulder": boulder, | |
| 706 | + "churrus": churrus, | |
| 707 | + "counterdigged": counterdigged, | |
| 708 | + "dialogite": dialogite, | |
| 709 | + "digenic": digenic, | |
| 710 | + "dunbird": dunbird, | |
| 711 | + "ergatogyne": ergatogyne, | |
| 712 | + "fiendful": fiendful, | |
| 713 | + "jackrod": jackrod, | |
| 714 | + "Jehovistic": jehovistic, | |
| 715 | + "Paninean": paninean, | |
| 716 | + "panther": panther, | |
| 717 | + "placentigerous": placentigerous, | |
| 718 | + "Romney": romney, | |
| 719 | + "sparm": sparm, | |
| 720 | + "tocsin": tocsin, | |
| 721 | + "unnicked": unnicked, | |
| 722 | + "unstavable": unstavable, | |
| 723 | + "windfirm": windfirm, | |
| 724 | + }; | |
| 725 | +} | |
| 726 | + | |
| 727 | +class DiaereseClass { | |
| 728 | + dynamic amoreuxia; | |
| 729 | + dynamic ani; | |
| 730 | + dynamic bernicle; | |
| 731 | + dynamic blackwasher; | |
| 732 | + dynamic blowhard; | |
| 733 | + dynamic broma; | |
| 734 | + dynamic closecross; | |
| 735 | + dynamic congregationalism; | |
| 736 | + dynamic grayly; | |
| 737 | + dynamic historically; | |
| 738 | + dynamic hoast; | |
| 739 | + dynamic irretentive; | |
| 740 | + dynamic parcener; | |
| 741 | + dynamic pedder; | |
| 742 | + dynamic pseudoanatomic; | |
| 743 | + dynamic rhizocarpian; | |
| 744 | + dynamic samel; | |
| 745 | + dynamic silker; | |
| 746 | + dynamic subdentated; | |
| 747 | + dynamic subobscure; | |
| 748 | + | |
| 749 | + DiaereseClass({ | |
| 750 | + required this.amoreuxia, | |
| 751 | + required this.ani, | |
| 752 | + required this.bernicle, | |
| 753 | + required this.blackwasher, | |
| 754 | + required this.blowhard, | |
| 755 | + required this.broma, | |
| 756 | + required this.closecross, | |
| 757 | + required this.congregationalism, | |
| 758 | + required this.grayly, | |
| 759 | + required this.historically, | |
| 760 | + required this.hoast, | |
| 761 | + required this.irretentive, | |
| 762 | + required this.parcener, | |
| 763 | + required this.pedder, | |
| 764 | + required this.pseudoanatomic, | |
| 765 | + required this.rhizocarpian, | |
| 766 | + required this.samel, | |
| 767 | + required this.silker, | |
| 768 | + required this.subdentated, | |
| 769 | + required this.subobscure, | |
| 770 | + }); | |
| 771 | + | |
| 772 | + factory DiaereseClass.fromJson(Map<String, dynamic> json) => DiaereseClass( | |
| 773 | + amoreuxia: json["Amoreuxia"], | |
| 774 | + ani: json["ani"], | |
| 775 | + bernicle: json["bernicle"], | |
| 776 | + blackwasher: json["blackwasher"], | |
| 777 | + blowhard: json["blowhard"], | |
| 778 | + broma: json["broma"], | |
| 779 | + closecross: json["closecross"], | |
| 780 | + congregationalism: json["congregationalism"], | |
| 781 | + grayly: json["grayly"], | |
| 782 | + historically: json["historically"], | |
| 783 | + hoast: json["hoast"], | |
| 784 | + irretentive: json["irretentive"], | |
| 785 | + parcener: json["parcener"], | |
| 786 | + pedder: json["pedder"], | |
| 787 | + pseudoanatomic: json["pseudoanatomic"], | |
| 788 | + rhizocarpian: json["rhizocarpian"], | |
| 789 | + samel: json["samel"], | |
| 790 | + silker: json["silker"], | |
| 791 | + subdentated: json["subdentated"], | |
| 792 | + subobscure: json["subobscure"], | |
| 793 | + ); | |
| 794 | + | |
| 795 | + Map<String, dynamic> toJson() => { | |
| 796 | + "Amoreuxia": amoreuxia, | |
| 797 | + "ani": ani, | |
| 798 | + "bernicle": bernicle, | |
| 799 | + "blackwasher": blackwasher, | |
| 800 | + "blowhard": blowhard, | |
| 801 | + "broma": broma, | |
| 802 | + "closecross": closecross, | |
| 803 | + "congregationalism": congregationalism, | |
| 804 | + "grayly": grayly, | |
| 805 | + "historically": historically, | |
| 806 | + "hoast": hoast, | |
| 807 | + "irretentive": irretentive, | |
| 808 | + "parcener": parcener, | |
| 809 | + "pedder": pedder, | |
| 810 | + "pseudoanatomic": pseudoanatomic, | |
| 811 | + "rhizocarpian": rhizocarpian, | |
| 812 | + "samel": samel, | |
| 813 | + "silker": silker, | |
| 814 | + "subdentated": subdentated, | |
| 815 | + "subobscure": subobscure, | |
| 816 | + }; | |
| 817 | +} | |
| 818 | + | |
| 819 | +class Encrust { | |
| 820 | + dynamic comradely; | |
| 821 | + dynamic diacanthous; | |
| 822 | + dynamic feminineness; | |
| 823 | + dynamic gossamered; | |
| 824 | + dynamic hibernia; | |
| 825 | + dynamic hibiscus; | |
| 826 | + dynamic lepidosauria; | |
| 827 | + dynamic lollingly; | |
| 828 | + dynamic manager; | |
| 829 | + dynamic mechanic; | |
| 830 | + dynamic overminuteness; | |
| 831 | + dynamic papelonne; | |
| 832 | + dynamic plebification; | |
| 833 | + dynamic pugmiller; | |
| 834 | + dynamic recoveror; | |
| 835 | + dynamic spermatoblastic; | |
| 836 | + dynamic syllidae; | |
| 837 | + dynamic ungyved; | |
| 838 | + dynamic whirlabout; | |
| 839 | + dynamic woodenware; | |
| 840 | + | |
| 841 | + Encrust({ | |
| 842 | + required this.comradely, | |
| 843 | + required this.diacanthous, | |
| 844 | + required this.feminineness, | |
| 845 | + required this.gossamered, | |
| 846 | + required this.hibernia, | |
| 847 | + required this.hibiscus, | |
| 848 | + required this.lepidosauria, | |
| 849 | + required this.lollingly, | |
| 850 | + required this.manager, | |
| 851 | + required this.mechanic, | |
| 852 | + required this.overminuteness, | |
| 853 | + required this.papelonne, | |
| 854 | + required this.plebification, | |
| 855 | + required this.pugmiller, | |
| 856 | + required this.recoveror, | |
| 857 | + required this.spermatoblastic, | |
| 858 | + required this.syllidae, | |
| 859 | + required this.ungyved, | |
| 860 | + required this.whirlabout, | |
| 861 | + required this.woodenware, | |
| 862 | + }); | |
| 863 | + | |
| 864 | + factory Encrust.fromJson(Map<String, dynamic> json) => Encrust( | |
| 865 | + comradely: json["comradely"], | |
| 866 | + diacanthous: json["diacanthous"], | |
| 867 | + feminineness: json["feminineness"], | |
| 868 | + gossamered: json["gossamered"], | |
| 869 | + hibernia: json["Hibernia"], | |
| 870 | + hibiscus: json["Hibiscus"], | |
| 871 | + lepidosauria: json["Lepidosauria"], | |
| 872 | + lollingly: json["lollingly"], | |
| 873 | + manager: json["manager"], | |
| 874 | + mechanic: json["mechanic"], | |
| 875 | + overminuteness: json["overminuteness"], | |
| 876 | + papelonne: json["papelonne"], | |
| 877 | + plebification: json["plebification"], | |
| 878 | + pugmiller: json["pugmiller"], | |
| 879 | + recoveror: json["recoveror"], | |
| 880 | + spermatoblastic: json["spermatoblastic"], | |
| 881 | + syllidae: json["Syllidae"], | |
| 882 | + ungyved: json["ungyved"], | |
| 883 | + whirlabout: json["whirlabout"], | |
| 884 | + woodenware: json["woodenware"], | |
| 885 | + ); | |
| 886 | + | |
| 887 | + Map<String, dynamic> toJson() => { | |
| 888 | + "comradely": comradely, | |
| 889 | + "diacanthous": diacanthous, | |
| 890 | + "feminineness": feminineness, | |
| 891 | + "gossamered": gossamered, | |
| 892 | + "Hibernia": hibernia, | |
| 893 | + "Hibiscus": hibiscus, | |
| 894 | + "Lepidosauria": lepidosauria, | |
| 895 | + "lollingly": lollingly, | |
| 896 | + "manager": manager, | |
| 897 | + "mechanic": mechanic, | |
| 898 | + "overminuteness": overminuteness, | |
| 899 | + "papelonne": papelonne, | |
| 900 | + "plebification": plebification, | |
| 901 | + "pugmiller": pugmiller, | |
| 902 | + "recoveror": recoveror, | |
| 903 | + "spermatoblastic": spermatoblastic, | |
| 904 | + "Syllidae": syllidae, | |
| 905 | + "ungyved": ungyved, | |
| 906 | + "whirlabout": whirlabout, | |
| 907 | + "woodenware": woodenware, | |
| 908 | + }; | |
| 909 | +} | |
| 910 | + | |
| 911 | +class FagginglyClass { | |
| 912 | + dynamic abranchian; | |
| 913 | + dynamic aculeiform; | |
| 914 | + dynamic adiaphoristic; | |
| 915 | + dynamic adoptionism; | |
| 916 | + dynamic anglic; | |
| 917 | + dynamic antrotomy; | |
| 918 | + dynamic coerciveness; | |
| 919 | + dynamic decorist; | |
| 920 | + dynamic duckhood; | |
| 921 | + dynamic heteromeri; | |
| 922 | + dynamic hypochnose; | |
| 923 | + dynamic lochage; | |
| 924 | + dynamic melee; | |
| 925 | + dynamic nonconformitant; | |
| 926 | + dynamic poinsettia; | |
| 927 | + dynamic putatively; | |
| 928 | + dynamic semivolatile; | |
| 929 | + dynamic soleas; | |
| 930 | + dynamic unfastenable; | |
| 931 | + dynamic unmillinered; | |
| 932 | + | |
| 933 | + FagginglyClass({ | |
| 934 | + required this.abranchian, | |
| 935 | + required this.aculeiform, | |
| 936 | + required this.adiaphoristic, | |
| 937 | + required this.adoptionism, | |
| 938 | + required this.anglic, | |
| 939 | + required this.antrotomy, | |
| 940 | + required this.coerciveness, | |
| 941 | + required this.decorist, | |
| 942 | + required this.duckhood, | |
| 943 | + required this.heteromeri, | |
| 944 | + required this.hypochnose, | |
| 945 | + required this.lochage, | |
| 946 | + required this.melee, | |
| 947 | + required this.nonconformitant, | |
| 948 | + required this.poinsettia, | |
| 949 | + required this.putatively, | |
| 950 | + required this.semivolatile, | |
| 951 | + required this.soleas, | |
| 952 | + required this.unfastenable, | |
| 953 | + required this.unmillinered, | |
| 954 | + }); | |
| 955 | + | |
| 956 | + factory FagginglyClass.fromJson(Map<String, dynamic> json) => FagginglyClass( | |
| 957 | + abranchian: json["abranchian"], | |
| 958 | + aculeiform: json["aculeiform"], | |
| 959 | + adiaphoristic: json["adiaphoristic"], | |
| 960 | + adoptionism: json["adoptionism"], | |
| 961 | + anglic: json["Anglic"], | |
| 962 | + antrotomy: json["antrotomy"], | |
| 963 | + coerciveness: json["coerciveness"], | |
| 964 | + decorist: json["decorist"], | |
| 965 | + duckhood: json["duckhood"], | |
| 966 | + heteromeri: json["Heteromeri"], | |
| 967 | + hypochnose: json["hypochnose"], | |
| 968 | + lochage: json["lochage"], | |
| 969 | + melee: json["melee"], | |
| 970 | + nonconformitant: json["nonconformitant"], | |
| 971 | + poinsettia: json["Poinsettia"], | |
| 972 | + putatively: json["putatively"], | |
| 973 | + semivolatile: json["semivolatile"], | |
| 974 | + soleas: json["soleas"], | |
| 975 | + unfastenable: json["unfastenable"], | |
| 976 | + unmillinered: json["unmillinered"], | |
| 977 | + ); | |
| 978 | + | |
| 979 | + Map<String, dynamic> toJson() => { | |
| 980 | + "abranchian": abranchian, | |
| 981 | + "aculeiform": aculeiform, | |
| 982 | + "adiaphoristic": adiaphoristic, | |
| 983 | + "adoptionism": adoptionism, | |
| 984 | + "Anglic": anglic, | |
| 985 | + "antrotomy": antrotomy, | |
| 986 | + "coerciveness": coerciveness, | |
| 987 | + "decorist": decorist, | |
| 988 | + "duckhood": duckhood, | |
| 989 | + "Heteromeri": heteromeri, | |
| 990 | + "hypochnose": hypochnose, | |
| 991 | + "lochage": lochage, | |
| 992 | + "melee": melee, | |
| 993 | + "nonconformitant": nonconformitant, | |
| 994 | + "Poinsettia": poinsettia, | |
| 995 | + "putatively": putatively, | |
| 996 | + "semivolatile": semivolatile, | |
| 997 | + "soleas": soleas, | |
| 998 | + "unfastenable": unfastenable, | |
| 999 | + "unmillinered": unmillinered, | |
| 1000 | + }; | |
| 1001 | +} | |
| 1002 | + | |
| 1003 | +class FenkClass { | |
| 1004 | + dynamic apoise; | |
| 1005 | + dynamic astronomize; | |
| 1006 | + dynamic cockhorse; | |
| 1007 | + dynamic copular; | |
| 1008 | + dynamic dagomba; | |
| 1009 | + dynamic draffy; | |
| 1010 | + dynamic foreigner; | |
| 1011 | + dynamic guyandot; | |
| 1012 | + dynamic neurogliosis; | |
| 1013 | + dynamic osmious; | |
| 1014 | + dynamic palpitate; | |
| 1015 | + dynamic rebukeable; | |
| 1016 | + dynamic reinwardtia; | |
| 1017 | + dynamic reservatory; | |
| 1018 | + dynamic scalt; | |
| 1019 | + dynamic scripturalize; | |
| 1020 | + dynamic tintometer; | |
| 1021 | + dynamic tritoness; | |
| 1022 | + dynamic undergrade; | |
| 1023 | + dynamic undermountain; | |
| 1024 | + | |
| 1025 | + FenkClass({ | |
| 1026 | + required this.apoise, | |
| 1027 | + required this.astronomize, | |
| 1028 | + required this.cockhorse, | |
| 1029 | + required this.copular, | |
| 1030 | + required this.dagomba, | |
| 1031 | + required this.draffy, | |
| 1032 | + required this.foreigner, | |
| 1033 | + required this.guyandot, | |
| 1034 | + required this.neurogliosis, | |
| 1035 | + required this.osmious, | |
| 1036 | + required this.palpitate, | |
| 1037 | + required this.rebukeable, | |
| 1038 | + required this.reinwardtia, | |
| 1039 | + required this.reservatory, | |
| 1040 | + required this.scalt, | |
| 1041 | + required this.scripturalize, | |
| 1042 | + required this.tintometer, | |
| 1043 | + required this.tritoness, | |
| 1044 | + required this.undergrade, | |
| 1045 | + required this.undermountain, | |
| 1046 | + }); | |
| 1047 | + | |
| 1048 | + factory FenkClass.fromJson(Map<String, dynamic> json) => FenkClass( | |
| 1049 | + apoise: json["apoise"], | |
| 1050 | + astronomize: json["astronomize"], | |
| 1051 | + cockhorse: json["cockhorse"], | |
| 1052 | + copular: json["copular"], | |
| 1053 | + dagomba: json["Dagomba"], | |
| 1054 | + draffy: json["draffy"], | |
| 1055 | + foreigner: json["foreigner"], | |
| 1056 | + guyandot: json["Guyandot"], | |
| 1057 | + neurogliosis: json["neurogliosis"], | |
| 1058 | + osmious: json["osmious"], | |
| 1059 | + palpitate: json["palpitate"], | |
| 1060 | + rebukeable: json["rebukeable"], | |
| 1061 | + reinwardtia: json["Reinwardtia"], | |
| 1062 | + reservatory: json["reservatory"], | |
| 1063 | + scalt: json["scalt"], | |
| 1064 | + scripturalize: json["scripturalize"], | |
| 1065 | + tintometer: json["tintometer"], | |
| 1066 | + tritoness: json["Tritoness"], | |
| 1067 | + undergrade: json["undergrade"], | |
| 1068 | + undermountain: json["undermountain"], | |
| 1069 | + ); | |
| 1070 | + | |
| 1071 | + Map<String, dynamic> toJson() => { | |
| 1072 | + "apoise": apoise, | |
| 1073 | + "astronomize": astronomize, | |
| 1074 | + "cockhorse": cockhorse, | |
| 1075 | + "copular": copular, | |
| 1076 | + "Dagomba": dagomba, | |
| 1077 | + "draffy": draffy, | |
| 1078 | + "foreigner": foreigner, | |
| 1079 | + "Guyandot": guyandot, | |
| 1080 | + "neurogliosis": neurogliosis, | |
| 1081 | + "osmious": osmious, | |
| 1082 | + "palpitate": palpitate, | |
| 1083 | + "rebukeable": rebukeable, | |
| 1084 | + "Reinwardtia": reinwardtia, | |
| 1085 | + "reservatory": reservatory, | |
| 1086 | + "scalt": scalt, | |
| 1087 | + "scripturalize": scripturalize, | |
| 1088 | + "tintometer": tintometer, | |
| 1089 | + "Tritoness": tritoness, | |
| 1090 | + "undergrade": undergrade, | |
| 1091 | + "undermountain": undermountain, | |
| 1092 | + }; | |
| 1093 | +} | |
| 1094 | + | |
| 1095 | +class FlagmakingClass { | |
| 1096 | + dynamic albarco; | |
| 1097 | + dynamic bunodonta; | |
| 1098 | + dynamic hornify; | |
| 1099 | + dynamic hydrocorisae; | |
| 1100 | + dynamic hypoglossus; | |
| 1101 | + dynamic inexpiably; | |
| 1102 | + dynamic ingratitude; | |
| 1103 | + dynamic ladyfly; | |
| 1104 | + dynamic medicament; | |
| 1105 | + dynamic monogrammatic; | |
| 1106 | + dynamic nobbut; | |
| 1107 | + dynamic notacanthidae; | |
| 1108 | + dynamic polyplacophore; | |
| 1109 | + dynamic proexercise; | |
| 1110 | + dynamic protoplast; | |
| 1111 | + dynamic puzzling; | |
| 1112 | + dynamic splanchnoskeleton; | |
| 1113 | + dynamic unloveliness; | |
| 1114 | + dynamic unquarantined; | |
| 1115 | + dynamic unrenounceable; | |
| 1116 | + | |
| 1117 | + FlagmakingClass({ | |
| 1118 | + required this.albarco, | |
| 1119 | + required this.bunodonta, | |
| 1120 | + required this.hornify, | |
| 1121 | + required this.hydrocorisae, | |
| 1122 | + required this.hypoglossus, | |
| 1123 | + required this.inexpiably, | |
| 1124 | + required this.ingratitude, | |
| 1125 | + required this.ladyfly, | |
| 1126 | + required this.medicament, | |
| 1127 | + required this.monogrammatic, | |
| 1128 | + required this.nobbut, | |
| 1129 | + required this.notacanthidae, | |
| 1130 | + required this.polyplacophore, | |
| 1131 | + required this.proexercise, | |
| 1132 | + required this.protoplast, | |
| 1133 | + required this.puzzling, | |
| 1134 | + required this.splanchnoskeleton, | |
| 1135 | + required this.unloveliness, | |
| 1136 | + required this.unquarantined, | |
| 1137 | + required this.unrenounceable, | |
| 1138 | + }); | |
| 1139 | + | |
| 1140 | + factory FlagmakingClass.fromJson(Map<String, dynamic> json) => FlagmakingClass( | |
| 1141 | + albarco: json["albarco"], | |
| 1142 | + bunodonta: json["Bunodonta"], | |
| 1143 | + hornify: json["hornify"], | |
| 1144 | + hydrocorisae: json["Hydrocorisae"], | |
| 1145 | + hypoglossus: json["hypoglossus"], | |
| 1146 | + inexpiably: json["inexpiably"], | |
| 1147 | + ingratitude: json["ingratitude"], | |
| 1148 | + ladyfly: json["ladyfly"], | |
| 1149 | + medicament: json["medicament"], | |
| 1150 | + monogrammatic: json["monogrammatic"], | |
| 1151 | + nobbut: json["nobbut"], | |
| 1152 | + notacanthidae: json["Notacanthidae"], | |
| 1153 | + polyplacophore: json["polyplacophore"], | |
| 1154 | + proexercise: json["proexercise"], | |
| 1155 | + protoplast: json["protoplast"], | |
| 1156 | + puzzling: json["puzzling"], | |
| 1157 | + splanchnoskeleton: json["splanchnoskeleton"], | |
| 1158 | + unloveliness: json["unloveliness"], | |
| 1159 | + unquarantined: json["unquarantined"], | |
| 1160 | + unrenounceable: json["unrenounceable"], | |
| 1161 | + ); | |
| 1162 | + | |
| 1163 | + Map<String, dynamic> toJson() => { | |
| 1164 | + "albarco": albarco, | |
| 1165 | + "Bunodonta": bunodonta, | |
| 1166 | + "hornify": hornify, | |
| 1167 | + "Hydrocorisae": hydrocorisae, | |
| 1168 | + "hypoglossus": hypoglossus, | |
| 1169 | + "inexpiably": inexpiably, | |
| 1170 | + "ingratitude": ingratitude, | |
| 1171 | + "ladyfly": ladyfly, | |
| 1172 | + "medicament": medicament, | |
| 1173 | + "monogrammatic": monogrammatic, | |
| 1174 | + "nobbut": nobbut, | |
| 1175 | + "Notacanthidae": notacanthidae, | |
| 1176 | + "polyplacophore": polyplacophore, | |
| 1177 | + "proexercise": proexercise, | |
| 1178 | + "protoplast": protoplast, | |
| 1179 | + "puzzling": puzzling, | |
| 1180 | + "splanchnoskeleton": splanchnoskeleton, | |
| 1181 | + "unloveliness": unloveliness, | |
| 1182 | + "unquarantined": unquarantined, | |
| 1183 | + "unrenounceable": unrenounceable, | |
| 1184 | + }; | |
| 1185 | +} | |
| 1186 | + | |
| 1187 | +class HemocoeleClass { | |
| 1188 | + dynamic acrogamy; | |
| 1189 | + dynamic amelification; | |
| 1190 | + dynamic autobiographic; | |
| 1191 | + dynamic berat; | |
| 1192 | + double? catharticalness; | |
| 1193 | + int? chirotherium; | |
| 1194 | + String? disdiapason; | |
| 1195 | + dynamic disproportionably; | |
| 1196 | + dynamic erythrite; | |
| 1197 | + dynamic graphic; | |
| 1198 | + dynamic hepatological; | |
| 1199 | + bool? homocerc; | |
| 1200 | + dynamic incommensurably; | |
| 1201 | + dynamic misaffirm; | |
| 1202 | + dynamic nonbookish; | |
| 1203 | + dynamic pocketbook; | |
| 1204 | + dynamic sclerometric; | |
| 1205 | + dynamic stambouline; | |
| 1206 | + dynamic stickpin; | |
| 1207 | + dynamic tubulure; | |
| 1208 | + dynamic undelated; | |
| 1209 | + dynamic unsalt; | |
| 1210 | + dynamic untutelar; | |
| 1211 | + dynamic vagrant; | |
| 1212 | + dynamic walt; | |
| 1213 | + | |
| 1214 | + HemocoeleClass({ | |
| 1215 | + this.acrogamy, | |
| 1216 | + this.amelification, | |
| 1217 | + this.autobiographic, | |
| 1218 | + this.berat, | |
| 1219 | + this.catharticalness, | |
| 1220 | + this.chirotherium, | |
| 1221 | + this.disdiapason, | |
| 1222 | + this.disproportionably, | |
| 1223 | + this.erythrite, | |
| 1224 | + this.graphic, | |
| 1225 | + this.hepatological, | |
| 1226 | + this.homocerc, | |
| 1227 | + this.incommensurably, | |
| 1228 | + this.misaffirm, | |
| 1229 | + this.nonbookish, | |
| 1230 | + this.pocketbook, | |
| 1231 | + this.sclerometric, | |
| 1232 | + this.stambouline, | |
| 1233 | + this.stickpin, | |
| 1234 | + this.tubulure, | |
| 1235 | + this.undelated, | |
| 1236 | + this.unsalt, | |
| 1237 | + this.untutelar, | |
| 1238 | + this.vagrant, | |
| 1239 | + this.walt, | |
| 1240 | + }); | |
| 1241 | + | |
| 1242 | + factory HemocoeleClass.fromJson(Map<String, dynamic> json) => HemocoeleClass( | |
| 1243 | + acrogamy: json["acrogamy"], | |
| 1244 | + amelification: json["amelification"], | |
| 1245 | + autobiographic: json["autobiographic"], | |
| 1246 | + berat: json["berat"], | |
| 1247 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 1248 | + chirotherium: json["Chirotherium"], | |
| 1249 | + disdiapason: json["disdiapason"], | |
| 1250 | + disproportionably: json["disproportionably"], | |
| 1251 | + erythrite: json["erythrite"], | |
| 1252 | + graphic: json["graphic"], | |
| 1253 | + hepatological: json["hepatological"], | |
| 1254 | + homocerc: json["homocerc"], | |
| 1255 | + incommensurably: json["incommensurably"], | |
| 1256 | + misaffirm: json["misaffirm"], | |
| 1257 | + nonbookish: json["nonbookish"], | |
| 1258 | + pocketbook: json["pocketbook"], | |
| 1259 | + sclerometric: json["sclerometric"], | |
| 1260 | + stambouline: json["stambouline"], | |
| 1261 | + stickpin: json["stickpin"], | |
| 1262 | + tubulure: json["tubulure"], | |
| 1263 | + undelated: json["undelated"], | |
| 1264 | + unsalt: json["unsalt"], | |
| 1265 | + untutelar: json["untutelar"], | |
| 1266 | + vagrant: json["vagrant"], | |
| 1267 | + walt: json["Walt"], | |
| 1268 | + ); | |
| 1269 | + | |
| 1270 | + Map<String, dynamic> toJson() => { | |
| 1271 | + "acrogamy": acrogamy, | |
| 1272 | + "amelification": amelification, | |
| 1273 | + "autobiographic": autobiographic, | |
| 1274 | + "berat": berat, | |
| 1275 | + "catharticalness": catharticalness, | |
| 1276 | + "Chirotherium": chirotherium, | |
| 1277 | + "disdiapason": disdiapason, | |
| 1278 | + "disproportionably": disproportionably, | |
| 1279 | + "erythrite": erythrite, | |
| 1280 | + "graphic": graphic, | |
| 1281 | + "hepatological": hepatological, | |
| 1282 | + "homocerc": homocerc, | |
| 1283 | + "incommensurably": incommensurably, | |
| 1284 | + "misaffirm": misaffirm, | |
| 1285 | + "nonbookish": nonbookish, | |
| 1286 | + "pocketbook": pocketbook, | |
| 1287 | + "sclerometric": sclerometric, | |
| 1288 | + "stambouline": stambouline, | |
| 1289 | + "stickpin": stickpin, | |
| 1290 | + "tubulure": tubulure, | |
| 1291 | + "undelated": undelated, | |
| 1292 | + "unsalt": unsalt, | |
| 1293 | + "untutelar": untutelar, | |
| 1294 | + "vagrant": vagrant, | |
| 1295 | + "Walt": walt, | |
| 1296 | + }; | |
| 1297 | +} | |
| 1298 | + | |
| 1299 | +class Interacinar { | |
| 1300 | + double assapan; | |
| 1301 | + bool benefactorship; | |
| 1302 | + String triseriatim; | |
| 1303 | + int tubbing; | |
| 1304 | + dynamic untrimmed; | |
| 1305 | + | |
| 1306 | + Interacinar({ | |
| 1307 | + required this.assapan, | |
| 1308 | + required this.benefactorship, | |
| 1309 | + required this.triseriatim, | |
| 1310 | + required this.tubbing, | |
| 1311 | + required this.untrimmed, | |
| 1312 | + }); | |
| 1313 | + | |
| 1314 | + factory Interacinar.fromJson(Map<String, dynamic> json) => Interacinar( | |
| 1315 | + assapan: json["assapan"]?.toDouble(), | |
| 1316 | + benefactorship: json["benefactorship"], | |
| 1317 | + triseriatim: json["triseriatim"], | |
| 1318 | + tubbing: json["tubbing"], | |
| 1319 | + untrimmed: json["untrimmed"], | |
| 1320 | + ); | |
| 1321 | + | |
| 1322 | + Map<String, dynamic> toJson() => { | |
| 1323 | + "assapan": assapan, | |
| 1324 | + "benefactorship": benefactorship, | |
| 1325 | + "triseriatim": triseriatim, | |
| 1326 | + "tubbing": tubbing, | |
| 1327 | + "untrimmed": untrimmed, | |
| 1328 | + }; | |
| 1329 | +} |
Test case
2 generated files · +2,242 −0test/inputs/json/priority/combinations2.json
Adartdefault / TopLevel.dart+1,121 −0
| @@ -0,0 +1,1121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final List<dynamic> abranchiata; | |
| 13 | + final List<dynamic> academe; | |
| 14 | + final List<dynamic> acquirable; | |
| 15 | + final List<dynamic> aerometry; | |
| 16 | + final List<dynamic> alexin; | |
| 17 | + final List<dynamic> alleviate; | |
| 18 | + final List<dynamic> amaas; | |
| 19 | + final List<dynamic> ambassage; | |
| 20 | + final List<Amphithyron?> amphithyron; | |
| 21 | + final List<String?> andriana; | |
| 22 | + final List<dynamic> ankee; | |
| 23 | + final List<Map<String, int?>?> annihilator; | |
| 24 | + final dynamic annulose; | |
| 25 | + final List<dynamic> ansarie; | |
| 26 | + final List<dynamic> aphasia; | |
| 27 | + final List<dynamic> asprawl; | |
| 28 | + final List<bool?> attractive; | |
| 29 | + final Map<String, int> barksome; | |
| 30 | + final List<dynamic> bedesman; | |
| 31 | + final List<dynamic> belard; | |
| 32 | + final List<dynamic> bocking; | |
| 33 | + final List<dynamic> brawlingly; | |
| 34 | + final List<dynamic> brookie; | |
| 35 | + final List<dynamic> bumboatman; | |
| 36 | + final List<dynamic> bystreet; | |
| 37 | + final List<dynamic> calaverite; | |
| 38 | + final List<dynamic> catallactic; | |
| 39 | + final List<dynamic> cemental; | |
| 40 | + final List<dynamic> chytridiaceae; | |
| 41 | + final List<dynamic> discordia; | |
| 42 | + final List<dynamic> endomyces; | |
| 43 | + final List<dynamic> epinephelidae; | |
| 44 | + final List<dynamic> eupatorium; | |
| 45 | + final List<dynamic> gryphosaurus; | |
| 46 | + final List<dynamic> koryak; | |
| 47 | + final List<dynamic> lavinia; | |
| 48 | + final List<dynamic> oskar; | |
| 49 | + final List<dynamic> rebecca; | |
| 50 | + final List<dynamic> rhomboganoidei; | |
| 51 | + final bool rigsmal; | |
| 52 | + final List<dynamic> ruellia; | |
| 53 | + final List<dynamic> school; | |
| 54 | + final List<dynamic> shakespearolater; | |
| 55 | + final List<double> svan; | |
| 56 | + final Map<String, double> wayao; | |
| 57 | + | |
| 58 | + TopLevel({ | |
| 59 | + required this.abranchiata, | |
| 60 | + required this.academe, | |
| 61 | + required this.acquirable, | |
| 62 | + required this.aerometry, | |
| 63 | + required this.alexin, | |
| 64 | + required this.alleviate, | |
| 65 | + required this.amaas, | |
| 66 | + required this.ambassage, | |
| 67 | + required this.amphithyron, | |
| 68 | + required this.andriana, | |
| 69 | + required this.ankee, | |
| 70 | + required this.annihilator, | |
| 71 | + required this.annulose, | |
| 72 | + required this.ansarie, | |
| 73 | + required this.aphasia, | |
| 74 | + required this.asprawl, | |
| 75 | + required this.attractive, | |
| 76 | + required this.barksome, | |
| 77 | + required this.bedesman, | |
| 78 | + required this.belard, | |
| 79 | + required this.bocking, | |
| 80 | + required this.brawlingly, | |
| 81 | + required this.brookie, | |
| 82 | + required this.bumboatman, | |
| 83 | + required this.bystreet, | |
| 84 | + required this.calaverite, | |
| 85 | + required this.catallactic, | |
| 86 | + required this.cemental, | |
| 87 | + required this.chytridiaceae, | |
| 88 | + required this.discordia, | |
| 89 | + required this.endomyces, | |
| 90 | + required this.epinephelidae, | |
| 91 | + required this.eupatorium, | |
| 92 | + required this.gryphosaurus, | |
| 93 | + required this.koryak, | |
| 94 | + required this.lavinia, | |
| 95 | + required this.oskar, | |
| 96 | + required this.rebecca, | |
| 97 | + required this.rhomboganoidei, | |
| 98 | + required this.rigsmal, | |
| 99 | + required this.ruellia, | |
| 100 | + required this.school, | |
| 101 | + required this.shakespearolater, | |
| 102 | + required this.svan, | |
| 103 | + required this.wayao, | |
| 104 | + }); | |
| 105 | + | |
| 106 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 107 | + abranchiata: List<dynamic>.from(json["Abranchiata"].map((x) => x)), | |
| 108 | + academe: List<dynamic>.from(json["academe"].map((x) => x)), | |
| 109 | + acquirable: List<dynamic>.from(json["acquirable"].map((x) => x)), | |
| 110 | + aerometry: List<dynamic>.from(json["aerometry"].map((x) => x)), | |
| 111 | + alexin: List<dynamic>.from(json["alexin"].map((x) => x)), | |
| 112 | + alleviate: List<dynamic>.from(json["alleviate"].map((x) => x)), | |
| 113 | + amaas: List<dynamic>.from(json["amaas"].map((x) => x)), | |
| 114 | + ambassage: List<dynamic>.from(json["ambassage"].map((x) => x)), | |
| 115 | + amphithyron: List<Amphithyron?>.from(json["amphithyron"].map((x) => x == null ? null : Amphithyron.fromJson(x))), | |
| 116 | + andriana: List<String?>.from(json["Andriana"].map((x) => x)), | |
| 117 | + ankee: List<dynamic>.from(json["ankee"].map((x) => x)), | |
| 118 | + annihilator: List<Map<String, int?>?>.from(json["annihilator"].map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, int?>(k, v)))), | |
| 119 | + annulose: json["annulose"], | |
| 120 | + ansarie: List<dynamic>.from(json["Ansarie"].map((x) => x)), | |
| 121 | + aphasia: List<dynamic>.from(json["aphasia"].map((x) => x)), | |
| 122 | + asprawl: List<dynamic>.from(json["asprawl"].map((x) => x)), | |
| 123 | + attractive: List<bool?>.from(json["attractive"].map((x) => x)), | |
| 124 | + barksome: Map.from(json["barksome"]).map((k, v) => MapEntry<String, int>(k, v)), | |
| 125 | + bedesman: List<dynamic>.from(json["bedesman"].map((x) => x)), | |
| 126 | + belard: List<dynamic>.from(json["belard"].map((x) => x)), | |
| 127 | + bocking: List<dynamic>.from(json["bocking"].map((x) => x)), | |
| 128 | + brawlingly: List<dynamic>.from(json["brawlingly"].map((x) => x)), | |
| 129 | + brookie: List<dynamic>.from(json["brookie"].map((x) => x)), | |
| 130 | + bumboatman: List<dynamic>.from(json["bumboatman"].map((x) => x)), | |
| 131 | + bystreet: List<dynamic>.from(json["bystreet"].map((x) => x)), | |
| 132 | + calaverite: List<dynamic>.from(json["calaverite"].map((x) => x)), | |
| 133 | + catallactic: List<dynamic>.from(json["catallactic"].map((x) => x)), | |
| 134 | + cemental: List<dynamic>.from(json["cemental"].map((x) => x)), | |
| 135 | + chytridiaceae: List<dynamic>.from(json["Chytridiaceae"].map((x) => x)), | |
| 136 | + discordia: List<dynamic>.from(json["Discordia"].map((x) => x)), | |
| 137 | + endomyces: List<dynamic>.from(json["Endomyces"].map((x) => x)), | |
| 138 | + epinephelidae: List<dynamic>.from(json["Epinephelidae"].map((x) => x)), | |
| 139 | + eupatorium: List<dynamic>.from(json["Eupatorium"].map((x) => x)), | |
| 140 | + gryphosaurus: List<dynamic>.from(json["Gryphosaurus"].map((x) => x)), | |
| 141 | + koryak: List<dynamic>.from(json["Koryak"].map((x) => x)), | |
| 142 | + lavinia: List<dynamic>.from(json["Lavinia"].map((x) => x)), | |
| 143 | + oskar: List<dynamic>.from(json["Oskar"].map((x) => x)), | |
| 144 | + rebecca: List<dynamic>.from(json["Rebecca"].map((x) => x)), | |
| 145 | + rhomboganoidei: List<dynamic>.from(json["Rhomboganoidei"].map((x) => x)), | |
| 146 | + rigsmal: json["Rigsmal"], | |
| 147 | + ruellia: List<dynamic>.from(json["Ruellia"].map((x) => x)), | |
| 148 | + school: List<dynamic>.from(json["School"].map((x) => x)), | |
| 149 | + shakespearolater: List<dynamic>.from(json["Shakespearolater"].map((x) => x)), | |
| 150 | + svan: List<double>.from(json["Svan"].map((x) => x?.toDouble())), | |
| 151 | + wayao: Map.from(json["Wayao"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 152 | + ); | |
| 153 | + | |
| 154 | + Map<String, dynamic> toJson() => { | |
| 155 | + "Abranchiata": List<dynamic>.from(abranchiata.map((x) => x)), | |
| 156 | + "academe": List<dynamic>.from(academe.map((x) => x)), | |
| 157 | + "acquirable": List<dynamic>.from(acquirable.map((x) => x)), | |
| 158 | + "aerometry": List<dynamic>.from(aerometry.map((x) => x)), | |
| 159 | + "alexin": List<dynamic>.from(alexin.map((x) => x)), | |
| 160 | + "alleviate": List<dynamic>.from(alleviate.map((x) => x)), | |
| 161 | + "amaas": List<dynamic>.from(amaas.map((x) => x)), | |
| 162 | + "ambassage": List<dynamic>.from(ambassage.map((x) => x)), | |
| 163 | + "amphithyron": List<dynamic>.from(amphithyron.map((x) => x?.toJson())), | |
| 164 | + "Andriana": List<dynamic>.from(andriana.map((x) => x)), | |
| 165 | + "ankee": List<dynamic>.from(ankee.map((x) => x)), | |
| 166 | + "annihilator": List<dynamic>.from(annihilator.map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, dynamic>(k, v)))), | |
| 167 | + "annulose": annulose, | |
| 168 | + "Ansarie": List<dynamic>.from(ansarie.map((x) => x)), | |
| 169 | + "aphasia": List<dynamic>.from(aphasia.map((x) => x)), | |
| 170 | + "asprawl": List<dynamic>.from(asprawl.map((x) => x)), | |
| 171 | + "attractive": List<dynamic>.from(attractive.map((x) => x)), | |
| 172 | + "barksome": Map.from(barksome).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 173 | + "bedesman": List<dynamic>.from(bedesman.map((x) => x)), | |
| 174 | + "belard": List<dynamic>.from(belard.map((x) => x)), | |
| 175 | + "bocking": List<dynamic>.from(bocking.map((x) => x)), | |
| 176 | + "brawlingly": List<dynamic>.from(brawlingly.map((x) => x)), | |
| 177 | + "brookie": List<dynamic>.from(brookie.map((x) => x)), | |
| 178 | + "bumboatman": List<dynamic>.from(bumboatman.map((x) => x)), | |
| 179 | + "bystreet": List<dynamic>.from(bystreet.map((x) => x)), | |
| 180 | + "calaverite": List<dynamic>.from(calaverite.map((x) => x)), | |
| 181 | + "catallactic": List<dynamic>.from(catallactic.map((x) => x)), | |
| 182 | + "cemental": List<dynamic>.from(cemental.map((x) => x)), | |
| 183 | + "Chytridiaceae": List<dynamic>.from(chytridiaceae.map((x) => x)), | |
| 184 | + "Discordia": List<dynamic>.from(discordia.map((x) => x)), | |
| 185 | + "Endomyces": List<dynamic>.from(endomyces.map((x) => x)), | |
| 186 | + "Epinephelidae": List<dynamic>.from(epinephelidae.map((x) => x)), | |
| 187 | + "Eupatorium": List<dynamic>.from(eupatorium.map((x) => x)), | |
| 188 | + "Gryphosaurus": List<dynamic>.from(gryphosaurus.map((x) => x)), | |
| 189 | + "Koryak": List<dynamic>.from(koryak.map((x) => x)), | |
| 190 | + "Lavinia": List<dynamic>.from(lavinia.map((x) => x)), | |
| 191 | + "Oskar": List<dynamic>.from(oskar.map((x) => x)), | |
| 192 | + "Rebecca": List<dynamic>.from(rebecca.map((x) => x)), | |
| 193 | + "Rhomboganoidei": List<dynamic>.from(rhomboganoidei.map((x) => x)), | |
| 194 | + "Rigsmal": rigsmal, | |
| 195 | + "Ruellia": List<dynamic>.from(ruellia.map((x) => x)), | |
| 196 | + "School": List<dynamic>.from(school.map((x) => x)), | |
| 197 | + "Shakespearolater": List<dynamic>.from(shakespearolater.map((x) => x)), | |
| 198 | + "Svan": List<dynamic>.from(svan.map((x) => x)), | |
| 199 | + "Wayao": Map.from(wayao).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 200 | + }; | |
| 201 | +} | |
| 202 | + | |
| 203 | +class AlleviateClass { | |
| 204 | + final dynamic apriori; | |
| 205 | + final dynamic beggarer; | |
| 206 | + final dynamic brokenheartedly; | |
| 207 | + final dynamic debilitation; | |
| 208 | + final dynamic frike; | |
| 209 | + final dynamic gastrolith; | |
| 210 | + final dynamic hulsean; | |
| 211 | + final dynamic orthocentric; | |
| 212 | + final dynamic petaly; | |
| 213 | + final dynamic probudgeting; | |
| 214 | + final dynamic reacquire; | |
| 215 | + final dynamic scow; | |
| 216 | + final dynamic shutoff; | |
| 217 | + final dynamic subcontiguous; | |
| 218 | + final dynamic suffumigate; | |
| 219 | + final dynamic transformable; | |
| 220 | + final dynamic uncoroneted; | |
| 221 | + final dynamic unparking; | |
| 222 | + final dynamic unvarnishedness; | |
| 223 | + final dynamic wherewithal; | |
| 224 | + | |
| 225 | + AlleviateClass({ | |
| 226 | + required this.apriori, | |
| 227 | + required this.beggarer, | |
| 228 | + required this.brokenheartedly, | |
| 229 | + required this.debilitation, | |
| 230 | + required this.frike, | |
| 231 | + required this.gastrolith, | |
| 232 | + required this.hulsean, | |
| 233 | + required this.orthocentric, | |
| 234 | + required this.petaly, | |
| 235 | + required this.probudgeting, | |
| 236 | + required this.reacquire, | |
| 237 | + required this.scow, | |
| 238 | + required this.shutoff, | |
| 239 | + required this.subcontiguous, | |
| 240 | + required this.suffumigate, | |
| 241 | + required this.transformable, | |
| 242 | + required this.uncoroneted, | |
| 243 | + required this.unparking, | |
| 244 | + required this.unvarnishedness, | |
| 245 | + required this.wherewithal, | |
| 246 | + }); | |
| 247 | + | |
| 248 | + factory AlleviateClass.fromJson(Map<String, dynamic> json) => AlleviateClass( | |
| 249 | + apriori: json["apriori"], | |
| 250 | + beggarer: json["beggarer"], | |
| 251 | + brokenheartedly: json["brokenheartedly"], | |
| 252 | + debilitation: json["debilitation"], | |
| 253 | + frike: json["frike"], | |
| 254 | + gastrolith: json["gastrolith"], | |
| 255 | + hulsean: json["Hulsean"], | |
| 256 | + orthocentric: json["orthocentric"], | |
| 257 | + petaly: json["petaly"], | |
| 258 | + probudgeting: json["probudgeting"], | |
| 259 | + reacquire: json["reacquire"], | |
| 260 | + scow: json["scow"], | |
| 261 | + shutoff: json["shutoff"], | |
| 262 | + subcontiguous: json["subcontiguous"], | |
| 263 | + suffumigate: json["suffumigate"], | |
| 264 | + transformable: json["transformable"], | |
| 265 | + uncoroneted: json["uncoroneted"], | |
| 266 | + unparking: json["unparking"], | |
| 267 | + unvarnishedness: json["unvarnishedness"], | |
| 268 | + wherewithal: json["wherewithal"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "apriori": apriori, | |
| 273 | + "beggarer": beggarer, | |
| 274 | + "brokenheartedly": brokenheartedly, | |
| 275 | + "debilitation": debilitation, | |
| 276 | + "frike": frike, | |
| 277 | + "gastrolith": gastrolith, | |
| 278 | + "Hulsean": hulsean, | |
| 279 | + "orthocentric": orthocentric, | |
| 280 | + "petaly": petaly, | |
| 281 | + "probudgeting": probudgeting, | |
| 282 | + "reacquire": reacquire, | |
| 283 | + "scow": scow, | |
| 284 | + "shutoff": shutoff, | |
| 285 | + "subcontiguous": subcontiguous, | |
| 286 | + "suffumigate": suffumigate, | |
| 287 | + "transformable": transformable, | |
| 288 | + "uncoroneted": uncoroneted, | |
| 289 | + "unparking": unparking, | |
| 290 | + "unvarnishedness": unvarnishedness, | |
| 291 | + "wherewithal": wherewithal, | |
| 292 | + }; | |
| 293 | +} | |
| 294 | + | |
| 295 | +class Rebecca { | |
| 296 | + final double catharticalness; | |
| 297 | + final int chirotherium; | |
| 298 | + final String disdiapason; | |
| 299 | + final bool homocerc; | |
| 300 | + final dynamic nonbookish; | |
| 301 | + | |
| 302 | + Rebecca({ | |
| 303 | + required this.catharticalness, | |
| 304 | + required this.chirotherium, | |
| 305 | + required this.disdiapason, | |
| 306 | + required this.homocerc, | |
| 307 | + required this.nonbookish, | |
| 308 | + }); | |
| 309 | + | |
| 310 | + factory Rebecca.fromJson(Map<String, dynamic> json) => Rebecca( | |
| 311 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 312 | + chirotherium: json["Chirotherium"], | |
| 313 | + disdiapason: json["disdiapason"], | |
| 314 | + homocerc: json["homocerc"], | |
| 315 | + nonbookish: json["nonbookish"], | |
| 316 | + ); | |
| 317 | + | |
| 318 | + Map<String, dynamic> toJson() => { | |
| 319 | + "catharticalness": catharticalness, | |
| 320 | + "Chirotherium": chirotherium, | |
| 321 | + "disdiapason": disdiapason, | |
| 322 | + "homocerc": homocerc, | |
| 323 | + "nonbookish": nonbookish, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Amphithyron { | |
| 328 | + final int? akroasis; | |
| 329 | + final int? antiphonical; | |
| 330 | + final int? basebred; | |
| 331 | + final double? catharticalness; | |
| 332 | + final int? chirotherium; | |
| 333 | + final int? conductometric; | |
| 334 | + final String? disdiapason; | |
| 335 | + final int? ensilation; | |
| 336 | + final int? eyebolt; | |
| 337 | + final int? fistulated; | |
| 338 | + final int? heteropod; | |
| 339 | + final bool? homocerc; | |
| 340 | + final int? juniperus; | |
| 341 | + final int? labyrinthically; | |
| 342 | + final int? martyrization; | |
| 343 | + final int? mispolicy; | |
| 344 | + final int? multipara; | |
| 345 | + final int? nazirite; | |
| 346 | + final dynamic nonbookish; | |
| 347 | + final int? possessorial; | |
| 348 | + final int? shamed; | |
| 349 | + final int? shelfworn; | |
| 350 | + final int? stagnum; | |
| 351 | + final int? those; | |
| 352 | + final int? undecimal; | |
| 353 | + | |
| 354 | + Amphithyron({ | |
| 355 | + this.akroasis, | |
| 356 | + this.antiphonical, | |
| 357 | + this.basebred, | |
| 358 | + this.catharticalness, | |
| 359 | + this.chirotherium, | |
| 360 | + this.conductometric, | |
| 361 | + this.disdiapason, | |
| 362 | + this.ensilation, | |
| 363 | + this.eyebolt, | |
| 364 | + this.fistulated, | |
| 365 | + this.heteropod, | |
| 366 | + this.homocerc, | |
| 367 | + this.juniperus, | |
| 368 | + this.labyrinthically, | |
| 369 | + this.martyrization, | |
| 370 | + this.mispolicy, | |
| 371 | + this.multipara, | |
| 372 | + this.nazirite, | |
| 373 | + this.nonbookish, | |
| 374 | + this.possessorial, | |
| 375 | + this.shamed, | |
| 376 | + this.shelfworn, | |
| 377 | + this.stagnum, | |
| 378 | + this.those, | |
| 379 | + this.undecimal, | |
| 380 | + }); | |
| 381 | + | |
| 382 | + factory Amphithyron.fromJson(Map<String, dynamic> json) => Amphithyron( | |
| 383 | + akroasis: json["akroasis"], | |
| 384 | + antiphonical: json["antiphonical"], | |
| 385 | + basebred: json["basebred"], | |
| 386 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 387 | + chirotherium: json["Chirotherium"], | |
| 388 | + conductometric: json["conductometric"], | |
| 389 | + disdiapason: json["disdiapason"], | |
| 390 | + ensilation: json["ensilation"], | |
| 391 | + eyebolt: json["eyebolt"], | |
| 392 | + fistulated: json["fistulated"], | |
| 393 | + heteropod: json["heteropod"], | |
| 394 | + homocerc: json["homocerc"], | |
| 395 | + juniperus: json["Juniperus"], | |
| 396 | + labyrinthically: json["labyrinthically"], | |
| 397 | + martyrization: json["martyrization"], | |
| 398 | + mispolicy: json["mispolicy"], | |
| 399 | + multipara: json["multipara"], | |
| 400 | + nazirite: json["Nazirite"], | |
| 401 | + nonbookish: json["nonbookish"], | |
| 402 | + possessorial: json["possessorial"], | |
| 403 | + shamed: json["shamed"], | |
| 404 | + shelfworn: json["shelfworn"], | |
| 405 | + stagnum: json["stagnum"], | |
| 406 | + those: json["Those"], | |
| 407 | + undecimal: json["undecimal"], | |
| 408 | + ); | |
| 409 | + | |
| 410 | + Map<String, dynamic> toJson() => { | |
| 411 | + "akroasis": akroasis, | |
| 412 | + "antiphonical": antiphonical, | |
| 413 | + "basebred": basebred, | |
| 414 | + "catharticalness": catharticalness, | |
| 415 | + "Chirotherium": chirotherium, | |
| 416 | + "conductometric": conductometric, | |
| 417 | + "disdiapason": disdiapason, | |
| 418 | + "ensilation": ensilation, | |
| 419 | + "eyebolt": eyebolt, | |
| 420 | + "fistulated": fistulated, | |
| 421 | + "heteropod": heteropod, | |
| 422 | + "homocerc": homocerc, | |
| 423 | + "Juniperus": juniperus, | |
| 424 | + "labyrinthically": labyrinthically, | |
| 425 | + "martyrization": martyrization, | |
| 426 | + "mispolicy": mispolicy, | |
| 427 | + "multipara": multipara, | |
| 428 | + "Nazirite": nazirite, | |
| 429 | + "nonbookish": nonbookish, | |
| 430 | + "possessorial": possessorial, | |
| 431 | + "shamed": shamed, | |
| 432 | + "shelfworn": shelfworn, | |
| 433 | + "stagnum": stagnum, | |
| 434 | + "Those": those, | |
| 435 | + "undecimal": undecimal, | |
| 436 | + }; | |
| 437 | +} | |
| 438 | + | |
| 439 | +class AnkeeClass { | |
| 440 | + final dynamic anomoean; | |
| 441 | + final dynamic barleyhood; | |
| 442 | + final dynamic befriender; | |
| 443 | + final dynamic brutishness; | |
| 444 | + final dynamic cephalalgy; | |
| 445 | + final dynamic cirurgian; | |
| 446 | + final dynamic conventionally; | |
| 447 | + final dynamic jackshay; | |
| 448 | + final dynamic milammeter; | |
| 449 | + final dynamic naja; | |
| 450 | + final dynamic ombrological; | |
| 451 | + final dynamic phonasthenia; | |
| 452 | + final dynamic retrievableness; | |
| 453 | + final dynamic snakily; | |
| 454 | + final dynamic swot; | |
| 455 | + final dynamic tartlet; | |
| 456 | + final dynamic thiofuran; | |
| 457 | + final dynamic tracheophone; | |
| 458 | + final dynamic tuglike; | |
| 459 | + final dynamic unscratchingly; | |
| 460 | + | |
| 461 | + AnkeeClass({ | |
| 462 | + required this.anomoean, | |
| 463 | + required this.barleyhood, | |
| 464 | + required this.befriender, | |
| 465 | + required this.brutishness, | |
| 466 | + required this.cephalalgy, | |
| 467 | + required this.cirurgian, | |
| 468 | + required this.conventionally, | |
| 469 | + required this.jackshay, | |
| 470 | + required this.milammeter, | |
| 471 | + required this.naja, | |
| 472 | + required this.ombrological, | |
| 473 | + required this.phonasthenia, | |
| 474 | + required this.retrievableness, | |
| 475 | + required this.snakily, | |
| 476 | + required this.swot, | |
| 477 | + required this.tartlet, | |
| 478 | + required this.thiofuran, | |
| 479 | + required this.tracheophone, | |
| 480 | + required this.tuglike, | |
| 481 | + required this.unscratchingly, | |
| 482 | + }); | |
| 483 | + | |
| 484 | + factory AnkeeClass.fromJson(Map<String, dynamic> json) => AnkeeClass( | |
| 485 | + anomoean: json["Anomoean"], | |
| 486 | + barleyhood: json["barleyhood"], | |
| 487 | + befriender: json["befriender"], | |
| 488 | + brutishness: json["brutishness"], | |
| 489 | + cephalalgy: json["cephalalgy"], | |
| 490 | + cirurgian: json["cirurgian"], | |
| 491 | + conventionally: json["conventionally"], | |
| 492 | + jackshay: json["jackshay"], | |
| 493 | + milammeter: json["milammeter"], | |
| 494 | + naja: json["Naja"], | |
| 495 | + ombrological: json["ombrological"], | |
| 496 | + phonasthenia: json["phonasthenia"], | |
| 497 | + retrievableness: json["retrievableness"], | |
| 498 | + snakily: json["snakily"], | |
| 499 | + swot: json["swot"], | |
| 500 | + tartlet: json["tartlet"], | |
| 501 | + thiofuran: json["thiofuran"], | |
| 502 | + tracheophone: json["tracheophone"], | |
| 503 | + tuglike: json["tuglike"], | |
| 504 | + unscratchingly: json["unscratchingly"], | |
| 505 | + ); | |
| 506 | + | |
| 507 | + Map<String, dynamic> toJson() => { | |
| 508 | + "Anomoean": anomoean, | |
| 509 | + "barleyhood": barleyhood, | |
| 510 | + "befriender": befriender, | |
| 511 | + "brutishness": brutishness, | |
| 512 | + "cephalalgy": cephalalgy, | |
| 513 | + "cirurgian": cirurgian, | |
| 514 | + "conventionally": conventionally, | |
| 515 | + "jackshay": jackshay, | |
| 516 | + "milammeter": milammeter, | |
| 517 | + "Naja": naja, | |
| 518 | + "ombrological": ombrological, | |
| 519 | + "phonasthenia": phonasthenia, | |
| 520 | + "retrievableness": retrievableness, | |
| 521 | + "snakily": snakily, | |
| 522 | + "swot": swot, | |
| 523 | + "tartlet": tartlet, | |
| 524 | + "thiofuran": thiofuran, | |
| 525 | + "tracheophone": tracheophone, | |
| 526 | + "tuglike": tuglike, | |
| 527 | + "unscratchingly": unscratchingly, | |
| 528 | + }; | |
| 529 | +} | |
| 530 | + | |
| 531 | +class AnsarieClass { | |
| 532 | + final dynamic accension; | |
| 533 | + final dynamic alida; | |
| 534 | + final dynamic asteria; | |
| 535 | + final dynamic beriberic; | |
| 536 | + final dynamic edgebone; | |
| 537 | + final dynamic gastrodialysis; | |
| 538 | + final dynamic geographic; | |
| 539 | + final dynamic ictonyx; | |
| 540 | + final dynamic metrocele; | |
| 541 | + final dynamic misgraft; | |
| 542 | + final dynamic monteith; | |
| 543 | + final dynamic notcher; | |
| 544 | + final dynamic prorestriction; | |
| 545 | + final dynamic ramist; | |
| 546 | + final dynamic throatlet; | |
| 547 | + final dynamic unfair; | |
| 548 | + final dynamic unsynonymous; | |
| 549 | + final dynamic water; | |
| 550 | + final dynamic zestfully; | |
| 551 | + final dynamic zincic; | |
| 552 | + | |
| 553 | + AnsarieClass({ | |
| 554 | + required this.accension, | |
| 555 | + required this.alida, | |
| 556 | + required this.asteria, | |
| 557 | + required this.beriberic, | |
| 558 | + required this.edgebone, | |
| 559 | + required this.gastrodialysis, | |
| 560 | + required this.geographic, | |
| 561 | + required this.ictonyx, | |
| 562 | + required this.metrocele, | |
| 563 | + required this.misgraft, | |
| 564 | + required this.monteith, | |
| 565 | + required this.notcher, | |
| 566 | + required this.prorestriction, | |
| 567 | + required this.ramist, | |
| 568 | + required this.throatlet, | |
| 569 | + required this.unfair, | |
| 570 | + required this.unsynonymous, | |
| 571 | + required this.water, | |
| 572 | + required this.zestfully, | |
| 573 | + required this.zincic, | |
| 574 | + }); | |
| 575 | + | |
| 576 | + factory AnsarieClass.fromJson(Map<String, dynamic> json) => AnsarieClass( | |
| 577 | + accension: json["accension"], | |
| 578 | + alida: json["Alida"], | |
| 579 | + asteria: json["asteria"], | |
| 580 | + beriberic: json["beriberic"], | |
| 581 | + edgebone: json["edgebone"], | |
| 582 | + gastrodialysis: json["gastrodialysis"], | |
| 583 | + geographic: json["geographic"], | |
| 584 | + ictonyx: json["Ictonyx"], | |
| 585 | + metrocele: json["metrocele"], | |
| 586 | + misgraft: json["misgraft"], | |
| 587 | + monteith: json["monteith"], | |
| 588 | + notcher: json["notcher"], | |
| 589 | + prorestriction: json["prorestriction"], | |
| 590 | + ramist: json["Ramist"], | |
| 591 | + throatlet: json["throatlet"], | |
| 592 | + unfair: json["unfair"], | |
| 593 | + unsynonymous: json["unsynonymous"], | |
| 594 | + water: json["water"], | |
| 595 | + zestfully: json["zestfully"], | |
| 596 | + zincic: json["zincic"], | |
| 597 | + ); | |
| 598 | + | |
| 599 | + Map<String, dynamic> toJson() => { | |
| 600 | + "accension": accension, | |
| 601 | + "Alida": alida, | |
| 602 | + "asteria": asteria, | |
| 603 | + "beriberic": beriberic, | |
| 604 | + "edgebone": edgebone, | |
| 605 | + "gastrodialysis": gastrodialysis, | |
| 606 | + "geographic": geographic, | |
| 607 | + "Ictonyx": ictonyx, | |
| 608 | + "metrocele": metrocele, | |
| 609 | + "misgraft": misgraft, | |
| 610 | + "monteith": monteith, | |
| 611 | + "notcher": notcher, | |
| 612 | + "prorestriction": prorestriction, | |
| 613 | + "Ramist": ramist, | |
| 614 | + "throatlet": throatlet, | |
| 615 | + "unfair": unfair, | |
| 616 | + "unsynonymous": unsynonymous, | |
| 617 | + "water": water, | |
| 618 | + "zestfully": zestfully, | |
| 619 | + "zincic": zincic, | |
| 620 | + }; | |
| 621 | +} | |
| 622 | + | |
| 623 | +class ChytridiaceaeClass { | |
| 624 | + final dynamic batidaceae; | |
| 625 | + final dynamic brechites; | |
| 626 | + final dynamic codespairer; | |
| 627 | + final dynamic emery; | |
| 628 | + final dynamic enervative; | |
| 629 | + final dynamic excriminate; | |
| 630 | + final dynamic goshenite; | |
| 631 | + final dynamic grime; | |
| 632 | + final dynamic gritten; | |
| 633 | + final dynamic hectorly; | |
| 634 | + final dynamic intermediation; | |
| 635 | + final dynamic meeterly; | |
| 636 | + final dynamic narraganset; | |
| 637 | + final dynamic onymatic; | |
| 638 | + final dynamic paddlecock; | |
| 639 | + final dynamic thana; | |
| 640 | + final dynamic thornily; | |
| 641 | + final dynamic uckia; | |
| 642 | + final dynamic unmettle; | |
| 643 | + final dynamic vorticellid; | |
| 644 | + | |
| 645 | + ChytridiaceaeClass({ | |
| 646 | + required this.batidaceae, | |
| 647 | + required this.brechites, | |
| 648 | + required this.codespairer, | |
| 649 | + required this.emery, | |
| 650 | + required this.enervative, | |
| 651 | + required this.excriminate, | |
| 652 | + required this.goshenite, | |
| 653 | + required this.grime, | |
| 654 | + required this.gritten, | |
| 655 | + required this.hectorly, | |
| 656 | + required this.intermediation, | |
| 657 | + required this.meeterly, | |
| 658 | + required this.narraganset, | |
| 659 | + required this.onymatic, | |
| 660 | + required this.paddlecock, | |
| 661 | + required this.thana, | |
| 662 | + required this.thornily, | |
| 663 | + required this.uckia, | |
| 664 | + required this.unmettle, | |
| 665 | + required this.vorticellid, | |
| 666 | + }); | |
| 667 | + | |
| 668 | + factory ChytridiaceaeClass.fromJson(Map<String, dynamic> json) => ChytridiaceaeClass( | |
| 669 | + batidaceae: json["Batidaceae"], | |
| 670 | + brechites: json["Brechites"], | |
| 671 | + codespairer: json["codespairer"], | |
| 672 | + emery: json["Emery"], | |
| 673 | + enervative: json["enervative"], | |
| 674 | + excriminate: json["excriminate"], | |
| 675 | + goshenite: json["goshenite"], | |
| 676 | + grime: json["grime"], | |
| 677 | + gritten: json["gritten"], | |
| 678 | + hectorly: json["hectorly"], | |
| 679 | + intermediation: json["intermediation"], | |
| 680 | + meeterly: json["meeterly"], | |
| 681 | + narraganset: json["Narraganset"], | |
| 682 | + onymatic: json["onymatic"], | |
| 683 | + paddlecock: json["paddlecock"], | |
| 684 | + thana: json["thana"], | |
| 685 | + thornily: json["thornily"], | |
| 686 | + uckia: json["uckia"], | |
| 687 | + unmettle: json["unmettle"], | |
| 688 | + vorticellid: json["vorticellid"], | |
| 689 | + ); | |
| 690 | + | |
| 691 | + Map<String, dynamic> toJson() => { | |
| 692 | + "Batidaceae": batidaceae, | |
| 693 | + "Brechites": brechites, | |
| 694 | + "codespairer": codespairer, | |
| 695 | + "Emery": emery, | |
| 696 | + "enervative": enervative, | |
| 697 | + "excriminate": excriminate, | |
| 698 | + "goshenite": goshenite, | |
| 699 | + "grime": grime, | |
| 700 | + "gritten": gritten, | |
| 701 | + "hectorly": hectorly, | |
| 702 | + "intermediation": intermediation, | |
| 703 | + "meeterly": meeterly, | |
| 704 | + "Narraganset": narraganset, | |
| 705 | + "onymatic": onymatic, | |
| 706 | + "paddlecock": paddlecock, | |
| 707 | + "thana": thana, | |
| 708 | + "thornily": thornily, | |
| 709 | + "uckia": uckia, | |
| 710 | + "unmettle": unmettle, | |
| 711 | + "vorticellid": vorticellid, | |
| 712 | + }; | |
| 713 | +} | |
| 714 | + | |
| 715 | +class DiscordiaClass { | |
| 716 | + final int? altaic; | |
| 717 | + final int? amoristic; | |
| 718 | + final int? blennophthalmia; | |
| 719 | + final double? catharticalness; | |
| 720 | + final int? chirotherium; | |
| 721 | + final int? disciplinability; | |
| 722 | + final String? disdiapason; | |
| 723 | + final int? goofer; | |
| 724 | + final bool? homocerc; | |
| 725 | + final int? laryngograph; | |
| 726 | + final int? leucitis; | |
| 727 | + final int? lymphocyst; | |
| 728 | + final int? microcosmology; | |
| 729 | + final int? nauseation; | |
| 730 | + final dynamic nonbookish; | |
| 731 | + final int? patarin; | |
| 732 | + final int? preliberal; | |
| 733 | + final int? prettifier; | |
| 734 | + final int? rangework; | |
| 735 | + final int? redient; | |
| 736 | + final int? subfusiform; | |
| 737 | + final int? suicidical; | |
| 738 | + final int? swow; | |
| 739 | + final int? wastrel; | |
| 740 | + final int? wingle; | |
| 741 | + | |
| 742 | + DiscordiaClass({ | |
| 743 | + this.altaic, | |
| 744 | + this.amoristic, | |
| 745 | + this.blennophthalmia, | |
| 746 | + this.catharticalness, | |
| 747 | + this.chirotherium, | |
| 748 | + this.disciplinability, | |
| 749 | + this.disdiapason, | |
| 750 | + this.goofer, | |
| 751 | + this.homocerc, | |
| 752 | + this.laryngograph, | |
| 753 | + this.leucitis, | |
| 754 | + this.lymphocyst, | |
| 755 | + this.microcosmology, | |
| 756 | + this.nauseation, | |
| 757 | + this.nonbookish, | |
| 758 | + this.patarin, | |
| 759 | + this.preliberal, | |
| 760 | + this.prettifier, | |
| 761 | + this.rangework, | |
| 762 | + this.redient, | |
| 763 | + this.subfusiform, | |
| 764 | + this.suicidical, | |
| 765 | + this.swow, | |
| 766 | + this.wastrel, | |
| 767 | + this.wingle, | |
| 768 | + }); | |
| 769 | + | |
| 770 | + factory DiscordiaClass.fromJson(Map<String, dynamic> json) => DiscordiaClass( | |
| 771 | + altaic: json["Altaic"], | |
| 772 | + amoristic: json["amoristic"], | |
| 773 | + blennophthalmia: json["blennophthalmia"], | |
| 774 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 775 | + chirotherium: json["Chirotherium"], | |
| 776 | + disciplinability: json["disciplinability"], | |
| 777 | + disdiapason: json["disdiapason"], | |
| 778 | + goofer: json["goofer"], | |
| 779 | + homocerc: json["homocerc"], | |
| 780 | + laryngograph: json["laryngograph"], | |
| 781 | + leucitis: json["leucitis"], | |
| 782 | + lymphocyst: json["lymphocyst"], | |
| 783 | + microcosmology: json["microcosmology"], | |
| 784 | + nauseation: json["nauseation"], | |
| 785 | + nonbookish: json["nonbookish"], | |
| 786 | + patarin: json["Patarin"], | |
| 787 | + preliberal: json["preliberal"], | |
| 788 | + prettifier: json["prettifier"], | |
| 789 | + rangework: json["rangework"], | |
| 790 | + redient: json["redient"], | |
| 791 | + subfusiform: json["subfusiform"], | |
| 792 | + suicidical: json["suicidical"], | |
| 793 | + swow: json["swow"], | |
| 794 | + wastrel: json["wastrel"], | |
| 795 | + wingle: json["wingle"], | |
| 796 | + ); | |
| 797 | + | |
| 798 | + Map<String, dynamic> toJson() => { | |
| 799 | + "Altaic": altaic, | |
| 800 | + "amoristic": amoristic, | |
| 801 | + "blennophthalmia": blennophthalmia, | |
| 802 | + "catharticalness": catharticalness, | |
| 803 | + "Chirotherium": chirotherium, | |
| 804 | + "disciplinability": disciplinability, | |
| 805 | + "disdiapason": disdiapason, | |
| 806 | + "goofer": goofer, | |
| 807 | + "homocerc": homocerc, | |
| 808 | + "laryngograph": laryngograph, | |
| 809 | + "leucitis": leucitis, | |
| 810 | + "lymphocyst": lymphocyst, | |
| 811 | + "microcosmology": microcosmology, | |
| 812 | + "nauseation": nauseation, | |
| 813 | + "nonbookish": nonbookish, | |
| 814 | + "Patarin": patarin, | |
| 815 | + "preliberal": preliberal, | |
| 816 | + "prettifier": prettifier, | |
| 817 | + "rangework": rangework, | |
| 818 | + "redient": redient, | |
| 819 | + "subfusiform": subfusiform, | |
| 820 | + "suicidical": suicidical, | |
| 821 | + "swow": swow, | |
| 822 | + "wastrel": wastrel, | |
| 823 | + "wingle": wingle, | |
| 824 | + }; | |
| 825 | +} | |
| 826 | + | |
| 827 | +class GryphosaurusClass { | |
| 828 | + final dynamic amissibility; | |
| 829 | + final dynamic burushaski; | |
| 830 | + final dynamic citronin; | |
| 831 | + final dynamic coplaintiff; | |
| 832 | + final dynamic disquisitionary; | |
| 833 | + final dynamic enoplan; | |
| 834 | + final dynamic faintness; | |
| 835 | + final dynamic hebetomy; | |
| 836 | + final dynamic islandry; | |
| 837 | + final dynamic lameduck; | |
| 838 | + final dynamic overbattle; | |
| 839 | + final dynamic overinterested; | |
| 840 | + final dynamic phrenologic; | |
| 841 | + final dynamic rainband; | |
| 842 | + final dynamic shiningly; | |
| 843 | + final dynamic stamineous; | |
| 844 | + final dynamic subscapularis; | |
| 845 | + final dynamic tahami; | |
| 846 | + final dynamic undaubed; | |
| 847 | + final dynamic underntime; | |
| 848 | + | |
| 849 | + GryphosaurusClass({ | |
| 850 | + required this.amissibility, | |
| 851 | + required this.burushaski, | |
| 852 | + required this.citronin, | |
| 853 | + required this.coplaintiff, | |
| 854 | + required this.disquisitionary, | |
| 855 | + required this.enoplan, | |
| 856 | + required this.faintness, | |
| 857 | + required this.hebetomy, | |
| 858 | + required this.islandry, | |
| 859 | + required this.lameduck, | |
| 860 | + required this.overbattle, | |
| 861 | + required this.overinterested, | |
| 862 | + required this.phrenologic, | |
| 863 | + required this.rainband, | |
| 864 | + required this.shiningly, | |
| 865 | + required this.stamineous, | |
| 866 | + required this.subscapularis, | |
| 867 | + required this.tahami, | |
| 868 | + required this.undaubed, | |
| 869 | + required this.underntime, | |
| 870 | + }); | |
| 871 | + | |
| 872 | + factory GryphosaurusClass.fromJson(Map<String, dynamic> json) => GryphosaurusClass( | |
| 873 | + amissibility: json["amissibility"], | |
| 874 | + burushaski: json["Burushaski"], | |
| 875 | + citronin: json["citronin"], | |
| 876 | + coplaintiff: json["coplaintiff"], | |
| 877 | + disquisitionary: json["disquisitionary"], | |
| 878 | + enoplan: json["enoplan"], | |
| 879 | + faintness: json["faintness"], | |
| 880 | + hebetomy: json["hebetomy"], | |
| 881 | + islandry: json["islandry"], | |
| 882 | + lameduck: json["lameduck"], | |
| 883 | + overbattle: json["overbattle"], | |
| 884 | + overinterested: json["overinterested"], | |
| 885 | + phrenologic: json["phrenologic"], | |
| 886 | + rainband: json["rainband"], | |
| 887 | + shiningly: json["shiningly"], | |
| 888 | + stamineous: json["stamineous"], | |
| 889 | + subscapularis: json["subscapularis"], | |
| 890 | + tahami: json["Tahami"], | |
| 891 | + undaubed: json["undaubed"], | |
| 892 | + underntime: json["underntime"], | |
| 893 | + ); | |
| 894 | + | |
| 895 | + Map<String, dynamic> toJson() => { | |
| 896 | + "amissibility": amissibility, | |
| 897 | + "Burushaski": burushaski, | |
| 898 | + "citronin": citronin, | |
| 899 | + "coplaintiff": coplaintiff, | |
| 900 | + "disquisitionary": disquisitionary, | |
| 901 | + "enoplan": enoplan, | |
| 902 | + "faintness": faintness, | |
| 903 | + "hebetomy": hebetomy, | |
| 904 | + "islandry": islandry, | |
| 905 | + "lameduck": lameduck, | |
| 906 | + "overbattle": overbattle, | |
| 907 | + "overinterested": overinterested, | |
| 908 | + "phrenologic": phrenologic, | |
| 909 | + "rainband": rainband, | |
| 910 | + "shiningly": shiningly, | |
| 911 | + "stamineous": stamineous, | |
| 912 | + "subscapularis": subscapularis, | |
| 913 | + "Tahami": tahami, | |
| 914 | + "undaubed": undaubed, | |
| 915 | + "underntime": underntime, | |
| 916 | + }; | |
| 917 | +} | |
| 918 | + | |
| 919 | +class LaviniaClass { | |
| 920 | + final int? agitable; | |
| 921 | + final int? asininity; | |
| 922 | + final int? benefiter; | |
| 923 | + final int? bronzelike; | |
| 924 | + final double? catharticalness; | |
| 925 | + final int? chirotherium; | |
| 926 | + final int? cholesteatomatous; | |
| 927 | + final int? deprivement; | |
| 928 | + final String? disdiapason; | |
| 929 | + final int? flippantness; | |
| 930 | + final int? fogproof; | |
| 931 | + final bool? homocerc; | |
| 932 | + final int? merrymeeting; | |
| 933 | + final dynamic nonbookish; | |
| 934 | + final int? overcareful; | |
| 935 | + final int? panaris; | |
| 936 | + final int? preacceptance; | |
| 937 | + final int? quinoxaline; | |
| 938 | + final int? sig; | |
| 939 | + final int? superconfusion; | |
| 940 | + final int? tacana; | |
| 941 | + final int? tillotter; | |
| 942 | + final int? tranquillize; | |
| 943 | + final int? unquestionable; | |
| 944 | + final int? uproute; | |
| 945 | + | |
| 946 | + LaviniaClass({ | |
| 947 | + this.agitable, | |
| 948 | + this.asininity, | |
| 949 | + this.benefiter, | |
| 950 | + this.bronzelike, | |
| 951 | + this.catharticalness, | |
| 952 | + this.chirotherium, | |
| 953 | + this.cholesteatomatous, | |
| 954 | + this.deprivement, | |
| 955 | + this.disdiapason, | |
| 956 | + this.flippantness, | |
| 957 | + this.fogproof, | |
| 958 | + this.homocerc, | |
| 959 | + this.merrymeeting, | |
| 960 | + this.nonbookish, | |
| 961 | + this.overcareful, | |
| 962 | + this.panaris, | |
| 963 | + this.preacceptance, | |
| 964 | + this.quinoxaline, | |
| 965 | + this.sig, | |
| 966 | + this.superconfusion, | |
| 967 | + this.tacana, | |
| 968 | + this.tillotter, | |
| 969 | + this.tranquillize, | |
| 970 | + this.unquestionable, | |
| 971 | + this.uproute, | |
| 972 | + }); | |
| 973 | + | |
| 974 | + factory LaviniaClass.fromJson(Map<String, dynamic> json) => LaviniaClass( | |
| 975 | + agitable: json["agitable"], | |
| 976 | + asininity: json["asininity"], | |
| 977 | + benefiter: json["benefiter"], | |
| 978 | + bronzelike: json["bronzelike"], | |
| 979 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 980 | + chirotherium: json["Chirotherium"], | |
| 981 | + cholesteatomatous: json["cholesteatomatous"], | |
| 982 | + deprivement: json["deprivement"], | |
| 983 | + disdiapason: json["disdiapason"], | |
| 984 | + flippantness: json["flippantness"], | |
| 985 | + fogproof: json["fogproof"], | |
| 986 | + homocerc: json["homocerc"], | |
| 987 | + merrymeeting: json["merrymeeting"], | |
| 988 | + nonbookish: json["nonbookish"], | |
| 989 | + overcareful: json["overcareful"], | |
| 990 | + panaris: json["panaris"], | |
| 991 | + preacceptance: json["preacceptance"], | |
| 992 | + quinoxaline: json["quinoxaline"], | |
| 993 | + sig: json["sig"], | |
| 994 | + superconfusion: json["superconfusion"], | |
| 995 | + tacana: json["Tacana"], | |
| 996 | + tillotter: json["tillotter"], | |
| 997 | + tranquillize: json["tranquillize"], | |
| 998 | + unquestionable: json["unquestionable"], | |
| 999 | + uproute: json["uproute"], | |
| 1000 | + ); | |
| 1001 | + | |
| 1002 | + Map<String, dynamic> toJson() => { | |
| 1003 | + "agitable": agitable, | |
| 1004 | + "asininity": asininity, | |
| 1005 | + "benefiter": benefiter, | |
| 1006 | + "bronzelike": bronzelike, | |
| 1007 | + "catharticalness": catharticalness, | |
| 1008 | + "Chirotherium": chirotherium, | |
| 1009 | + "cholesteatomatous": cholesteatomatous, | |
| 1010 | + "deprivement": deprivement, | |
| 1011 | + "disdiapason": disdiapason, | |
| 1012 | + "flippantness": flippantness, | |
| 1013 | + "fogproof": fogproof, | |
| 1014 | + "homocerc": homocerc, | |
| 1015 | + "merrymeeting": merrymeeting, | |
| 1016 | + "nonbookish": nonbookish, | |
| 1017 | + "overcareful": overcareful, | |
| 1018 | + "panaris": panaris, | |
| 1019 | + "preacceptance": preacceptance, | |
| 1020 | + "quinoxaline": quinoxaline, | |
| 1021 | + "sig": sig, | |
| 1022 | + "superconfusion": superconfusion, | |
| 1023 | + "Tacana": tacana, | |
| 1024 | + "tillotter": tillotter, | |
| 1025 | + "tranquillize": tranquillize, | |
| 1026 | + "unquestionable": unquestionable, | |
| 1027 | + "uproute": uproute, | |
| 1028 | + }; | |
| 1029 | +} | |
| 1030 | + | |
| 1031 | +class OskarClass { | |
| 1032 | + final dynamic acrobates; | |
| 1033 | + final dynamic beanshooter; | |
| 1034 | + final dynamic bearhound; | |
| 1035 | + final dynamic cayuga; | |
| 1036 | + final dynamic guarneri; | |
| 1037 | + final dynamic hypochondriacism; | |
| 1038 | + final dynamic indication; | |
| 1039 | + final dynamic jaculative; | |
| 1040 | + final dynamic nagana; | |
| 1041 | + final dynamic netherlandish; | |
| 1042 | + final dynamic noctivagous; | |
| 1043 | + final dynamic nonphysiological; | |
| 1044 | + final dynamic praxis; | |
| 1045 | + final dynamic provision; | |
| 1046 | + final dynamic subterhuman; | |
| 1047 | + final dynamic sunlit; | |
| 1048 | + final dynamic syncraniate; | |
| 1049 | + final dynamic teachment; | |
| 1050 | + final dynamic unmutinous; | |
| 1051 | + final dynamic unstoppable; | |
| 1052 | + | |
| 1053 | + OskarClass({ | |
| 1054 | + required this.acrobates, | |
| 1055 | + required this.beanshooter, | |
| 1056 | + required this.bearhound, | |
| 1057 | + required this.cayuga, | |
| 1058 | + required this.guarneri, | |
| 1059 | + required this.hypochondriacism, | |
| 1060 | + required this.indication, | |
| 1061 | + required this.jaculative, | |
| 1062 | + required this.nagana, | |
| 1063 | + required this.netherlandish, | |
| 1064 | + required this.noctivagous, | |
| 1065 | + required this.nonphysiological, | |
| 1066 | + required this.praxis, | |
| 1067 | + required this.provision, | |
| 1068 | + required this.subterhuman, | |
| 1069 | + required this.sunlit, | |
| 1070 | + required this.syncraniate, | |
| 1071 | + required this.teachment, | |
| 1072 | + required this.unmutinous, | |
| 1073 | + required this.unstoppable, | |
| 1074 | + }); | |
| 1075 | + | |
| 1076 | + factory OskarClass.fromJson(Map<String, dynamic> json) => OskarClass( | |
| 1077 | + acrobates: json["Acrobates"], | |
| 1078 | + beanshooter: json["beanshooter"], | |
| 1079 | + bearhound: json["bearhound"], | |
| 1080 | + cayuga: json["Cayuga"], | |
| 1081 | + guarneri: json["guarneri"], | |
| 1082 | + hypochondriacism: json["hypochondriacism"], | |
| 1083 | + indication: json["indication"], | |
| 1084 | + jaculative: json["jaculative"], | |
| 1085 | + nagana: json["nagana"], | |
| 1086 | + netherlandish: json["Netherlandish"], | |
| 1087 | + noctivagous: json["noctivagous"], | |
| 1088 | + nonphysiological: json["nonphysiological"], | |
| 1089 | + praxis: json["praxis"], | |
| 1090 | + provision: json["provision"], | |
| 1091 | + subterhuman: json["subterhuman"], | |
| 1092 | + sunlit: json["sunlit"], | |
| 1093 | + syncraniate: json["syncraniate"], | |
| 1094 | + teachment: json["teachment"], | |
| 1095 | + unmutinous: json["unmutinous"], | |
| 1096 | + unstoppable: json["unstoppable"], | |
| 1097 | + ); | |
| 1098 | + | |
| 1099 | + Map<String, dynamic> toJson() => { | |
| 1100 | + "Acrobates": acrobates, | |
| 1101 | + "beanshooter": beanshooter, | |
| 1102 | + "bearhound": bearhound, | |
| 1103 | + "Cayuga": cayuga, | |
| 1104 | + "guarneri": guarneri, | |
| 1105 | + "hypochondriacism": hypochondriacism, | |
| 1106 | + "indication": indication, | |
| 1107 | + "jaculative": jaculative, | |
| 1108 | + "nagana": nagana, | |
| 1109 | + "Netherlandish": netherlandish, | |
| 1110 | + "noctivagous": noctivagous, | |
| 1111 | + "nonphysiological": nonphysiological, | |
| 1112 | + "praxis": praxis, | |
| 1113 | + "provision": provision, | |
| 1114 | + "subterhuman": subterhuman, | |
| 1115 | + "sunlit": sunlit, | |
| 1116 | + "syncraniate": syncraniate, | |
| 1117 | + "teachment": teachment, | |
| 1118 | + "unmutinous": unmutinous, | |
| 1119 | + "unstoppable": unstoppable, | |
| 1120 | + }; | |
| 1121 | +} |
Adartfinal-props-false--58a791807e0c / TopLevel.dart+1,121 −0
| @@ -0,0 +1,1121 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + List<dynamic> abranchiata; | |
| 13 | + List<dynamic> academe; | |
| 14 | + List<dynamic> acquirable; | |
| 15 | + List<dynamic> aerometry; | |
| 16 | + List<dynamic> alexin; | |
| 17 | + List<dynamic> alleviate; | |
| 18 | + List<dynamic> amaas; | |
| 19 | + List<dynamic> ambassage; | |
| 20 | + List<Amphithyron?> amphithyron; | |
| 21 | + List<String?> andriana; | |
| 22 | + List<dynamic> ankee; | |
| 23 | + List<Map<String, int?>?> annihilator; | |
| 24 | + dynamic annulose; | |
| 25 | + List<dynamic> ansarie; | |
| 26 | + List<dynamic> aphasia; | |
| 27 | + List<dynamic> asprawl; | |
| 28 | + List<bool?> attractive; | |
| 29 | + Map<String, int> barksome; | |
| 30 | + List<dynamic> bedesman; | |
| 31 | + List<dynamic> belard; | |
| 32 | + List<dynamic> bocking; | |
| 33 | + List<dynamic> brawlingly; | |
| 34 | + List<dynamic> brookie; | |
| 35 | + List<dynamic> bumboatman; | |
| 36 | + List<dynamic> bystreet; | |
| 37 | + List<dynamic> calaverite; | |
| 38 | + List<dynamic> catallactic; | |
| 39 | + List<dynamic> cemental; | |
| 40 | + List<dynamic> chytridiaceae; | |
| 41 | + List<dynamic> discordia; | |
| 42 | + List<dynamic> endomyces; | |
| 43 | + List<dynamic> epinephelidae; | |
| 44 | + List<dynamic> eupatorium; | |
| 45 | + List<dynamic> gryphosaurus; | |
| 46 | + List<dynamic> koryak; | |
| 47 | + List<dynamic> lavinia; | |
| 48 | + List<dynamic> oskar; | |
| 49 | + List<dynamic> rebecca; | |
| 50 | + List<dynamic> rhomboganoidei; | |
| 51 | + bool rigsmal; | |
| 52 | + List<dynamic> ruellia; | |
| 53 | + List<dynamic> school; | |
| 54 | + List<dynamic> shakespearolater; | |
| 55 | + List<double> svan; | |
| 56 | + Map<String, double> wayao; | |
| 57 | + | |
| 58 | + TopLevel({ | |
| 59 | + required this.abranchiata, | |
| 60 | + required this.academe, | |
| 61 | + required this.acquirable, | |
| 62 | + required this.aerometry, | |
| 63 | + required this.alexin, | |
| 64 | + required this.alleviate, | |
| 65 | + required this.amaas, | |
| 66 | + required this.ambassage, | |
| 67 | + required this.amphithyron, | |
| 68 | + required this.andriana, | |
| 69 | + required this.ankee, | |
| 70 | + required this.annihilator, | |
| 71 | + required this.annulose, | |
| 72 | + required this.ansarie, | |
| 73 | + required this.aphasia, | |
| 74 | + required this.asprawl, | |
| 75 | + required this.attractive, | |
| 76 | + required this.barksome, | |
| 77 | + required this.bedesman, | |
| 78 | + required this.belard, | |
| 79 | + required this.bocking, | |
| 80 | + required this.brawlingly, | |
| 81 | + required this.brookie, | |
| 82 | + required this.bumboatman, | |
| 83 | + required this.bystreet, | |
| 84 | + required this.calaverite, | |
| 85 | + required this.catallactic, | |
| 86 | + required this.cemental, | |
| 87 | + required this.chytridiaceae, | |
| 88 | + required this.discordia, | |
| 89 | + required this.endomyces, | |
| 90 | + required this.epinephelidae, | |
| 91 | + required this.eupatorium, | |
| 92 | + required this.gryphosaurus, | |
| 93 | + required this.koryak, | |
| 94 | + required this.lavinia, | |
| 95 | + required this.oskar, | |
| 96 | + required this.rebecca, | |
| 97 | + required this.rhomboganoidei, | |
| 98 | + required this.rigsmal, | |
| 99 | + required this.ruellia, | |
| 100 | + required this.school, | |
| 101 | + required this.shakespearolater, | |
| 102 | + required this.svan, | |
| 103 | + required this.wayao, | |
| 104 | + }); | |
| 105 | + | |
| 106 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 107 | + abranchiata: List<dynamic>.from(json["Abranchiata"].map((x) => x)), | |
| 108 | + academe: List<dynamic>.from(json["academe"].map((x) => x)), | |
| 109 | + acquirable: List<dynamic>.from(json["acquirable"].map((x) => x)), | |
| 110 | + aerometry: List<dynamic>.from(json["aerometry"].map((x) => x)), | |
| 111 | + alexin: List<dynamic>.from(json["alexin"].map((x) => x)), | |
| 112 | + alleviate: List<dynamic>.from(json["alleviate"].map((x) => x)), | |
| 113 | + amaas: List<dynamic>.from(json["amaas"].map((x) => x)), | |
| 114 | + ambassage: List<dynamic>.from(json["ambassage"].map((x) => x)), | |
| 115 | + amphithyron: List<Amphithyron?>.from(json["amphithyron"].map((x) => x == null ? null : Amphithyron.fromJson(x))), | |
| 116 | + andriana: List<String?>.from(json["Andriana"].map((x) => x)), | |
| 117 | + ankee: List<dynamic>.from(json["ankee"].map((x) => x)), | |
| 118 | + annihilator: List<Map<String, int?>?>.from(json["annihilator"].map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, int?>(k, v)))), | |
| 119 | + annulose: json["annulose"], | |
| 120 | + ansarie: List<dynamic>.from(json["Ansarie"].map((x) => x)), | |
| 121 | + aphasia: List<dynamic>.from(json["aphasia"].map((x) => x)), | |
| 122 | + asprawl: List<dynamic>.from(json["asprawl"].map((x) => x)), | |
| 123 | + attractive: List<bool?>.from(json["attractive"].map((x) => x)), | |
| 124 | + barksome: Map.from(json["barksome"]).map((k, v) => MapEntry<String, int>(k, v)), | |
| 125 | + bedesman: List<dynamic>.from(json["bedesman"].map((x) => x)), | |
| 126 | + belard: List<dynamic>.from(json["belard"].map((x) => x)), | |
| 127 | + bocking: List<dynamic>.from(json["bocking"].map((x) => x)), | |
| 128 | + brawlingly: List<dynamic>.from(json["brawlingly"].map((x) => x)), | |
| 129 | + brookie: List<dynamic>.from(json["brookie"].map((x) => x)), | |
| 130 | + bumboatman: List<dynamic>.from(json["bumboatman"].map((x) => x)), | |
| 131 | + bystreet: List<dynamic>.from(json["bystreet"].map((x) => x)), | |
| 132 | + calaverite: List<dynamic>.from(json["calaverite"].map((x) => x)), | |
| 133 | + catallactic: List<dynamic>.from(json["catallactic"].map((x) => x)), | |
| 134 | + cemental: List<dynamic>.from(json["cemental"].map((x) => x)), | |
| 135 | + chytridiaceae: List<dynamic>.from(json["Chytridiaceae"].map((x) => x)), | |
| 136 | + discordia: List<dynamic>.from(json["Discordia"].map((x) => x)), | |
| 137 | + endomyces: List<dynamic>.from(json["Endomyces"].map((x) => x)), | |
| 138 | + epinephelidae: List<dynamic>.from(json["Epinephelidae"].map((x) => x)), | |
| 139 | + eupatorium: List<dynamic>.from(json["Eupatorium"].map((x) => x)), | |
| 140 | + gryphosaurus: List<dynamic>.from(json["Gryphosaurus"].map((x) => x)), | |
| 141 | + koryak: List<dynamic>.from(json["Koryak"].map((x) => x)), | |
| 142 | + lavinia: List<dynamic>.from(json["Lavinia"].map((x) => x)), | |
| 143 | + oskar: List<dynamic>.from(json["Oskar"].map((x) => x)), | |
| 144 | + rebecca: List<dynamic>.from(json["Rebecca"].map((x) => x)), | |
| 145 | + rhomboganoidei: List<dynamic>.from(json["Rhomboganoidei"].map((x) => x)), | |
| 146 | + rigsmal: json["Rigsmal"], | |
| 147 | + ruellia: List<dynamic>.from(json["Ruellia"].map((x) => x)), | |
| 148 | + school: List<dynamic>.from(json["School"].map((x) => x)), | |
| 149 | + shakespearolater: List<dynamic>.from(json["Shakespearolater"].map((x) => x)), | |
| 150 | + svan: List<double>.from(json["Svan"].map((x) => x?.toDouble())), | |
| 151 | + wayao: Map.from(json["Wayao"]).map((k, v) => MapEntry<String, double>(k, v?.toDouble())), | |
| 152 | + ); | |
| 153 | + | |
| 154 | + Map<String, dynamic> toJson() => { | |
| 155 | + "Abranchiata": List<dynamic>.from(abranchiata.map((x) => x)), | |
| 156 | + "academe": List<dynamic>.from(academe.map((x) => x)), | |
| 157 | + "acquirable": List<dynamic>.from(acquirable.map((x) => x)), | |
| 158 | + "aerometry": List<dynamic>.from(aerometry.map((x) => x)), | |
| 159 | + "alexin": List<dynamic>.from(alexin.map((x) => x)), | |
| 160 | + "alleviate": List<dynamic>.from(alleviate.map((x) => x)), | |
| 161 | + "amaas": List<dynamic>.from(amaas.map((x) => x)), | |
| 162 | + "ambassage": List<dynamic>.from(ambassage.map((x) => x)), | |
| 163 | + "amphithyron": List<dynamic>.from(amphithyron.map((x) => x?.toJson())), | |
| 164 | + "Andriana": List<dynamic>.from(andriana.map((x) => x)), | |
| 165 | + "ankee": List<dynamic>.from(ankee.map((x) => x)), | |
| 166 | + "annihilator": List<dynamic>.from(annihilator.map((x) => x == null ? null : Map.from(x!).map((k, v) => MapEntry<String, dynamic>(k, v)))), | |
| 167 | + "annulose": annulose, | |
| 168 | + "Ansarie": List<dynamic>.from(ansarie.map((x) => x)), | |
| 169 | + "aphasia": List<dynamic>.from(aphasia.map((x) => x)), | |
| 170 | + "asprawl": List<dynamic>.from(asprawl.map((x) => x)), | |
| 171 | + "attractive": List<dynamic>.from(attractive.map((x) => x)), | |
| 172 | + "barksome": Map.from(barksome).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 173 | + "bedesman": List<dynamic>.from(bedesman.map((x) => x)), | |
| 174 | + "belard": List<dynamic>.from(belard.map((x) => x)), | |
| 175 | + "bocking": List<dynamic>.from(bocking.map((x) => x)), | |
| 176 | + "brawlingly": List<dynamic>.from(brawlingly.map((x) => x)), | |
| 177 | + "brookie": List<dynamic>.from(brookie.map((x) => x)), | |
| 178 | + "bumboatman": List<dynamic>.from(bumboatman.map((x) => x)), | |
| 179 | + "bystreet": List<dynamic>.from(bystreet.map((x) => x)), | |
| 180 | + "calaverite": List<dynamic>.from(calaverite.map((x) => x)), | |
| 181 | + "catallactic": List<dynamic>.from(catallactic.map((x) => x)), | |
| 182 | + "cemental": List<dynamic>.from(cemental.map((x) => x)), | |
| 183 | + "Chytridiaceae": List<dynamic>.from(chytridiaceae.map((x) => x)), | |
| 184 | + "Discordia": List<dynamic>.from(discordia.map((x) => x)), | |
| 185 | + "Endomyces": List<dynamic>.from(endomyces.map((x) => x)), | |
| 186 | + "Epinephelidae": List<dynamic>.from(epinephelidae.map((x) => x)), | |
| 187 | + "Eupatorium": List<dynamic>.from(eupatorium.map((x) => x)), | |
| 188 | + "Gryphosaurus": List<dynamic>.from(gryphosaurus.map((x) => x)), | |
| 189 | + "Koryak": List<dynamic>.from(koryak.map((x) => x)), | |
| 190 | + "Lavinia": List<dynamic>.from(lavinia.map((x) => x)), | |
| 191 | + "Oskar": List<dynamic>.from(oskar.map((x) => x)), | |
| 192 | + "Rebecca": List<dynamic>.from(rebecca.map((x) => x)), | |
| 193 | + "Rhomboganoidei": List<dynamic>.from(rhomboganoidei.map((x) => x)), | |
| 194 | + "Rigsmal": rigsmal, | |
| 195 | + "Ruellia": List<dynamic>.from(ruellia.map((x) => x)), | |
| 196 | + "School": List<dynamic>.from(school.map((x) => x)), | |
| 197 | + "Shakespearolater": List<dynamic>.from(shakespearolater.map((x) => x)), | |
| 198 | + "Svan": List<dynamic>.from(svan.map((x) => x)), | |
| 199 | + "Wayao": Map.from(wayao).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 200 | + }; | |
| 201 | +} | |
| 202 | + | |
| 203 | +class AlleviateClass { | |
| 204 | + dynamic apriori; | |
| 205 | + dynamic beggarer; | |
| 206 | + dynamic brokenheartedly; | |
| 207 | + dynamic debilitation; | |
| 208 | + dynamic frike; | |
| 209 | + dynamic gastrolith; | |
| 210 | + dynamic hulsean; | |
| 211 | + dynamic orthocentric; | |
| 212 | + dynamic petaly; | |
| 213 | + dynamic probudgeting; | |
| 214 | + dynamic reacquire; | |
| 215 | + dynamic scow; | |
| 216 | + dynamic shutoff; | |
| 217 | + dynamic subcontiguous; | |
| 218 | + dynamic suffumigate; | |
| 219 | + dynamic transformable; | |
| 220 | + dynamic uncoroneted; | |
| 221 | + dynamic unparking; | |
| 222 | + dynamic unvarnishedness; | |
| 223 | + dynamic wherewithal; | |
| 224 | + | |
| 225 | + AlleviateClass({ | |
| 226 | + required this.apriori, | |
| 227 | + required this.beggarer, | |
| 228 | + required this.brokenheartedly, | |
| 229 | + required this.debilitation, | |
| 230 | + required this.frike, | |
| 231 | + required this.gastrolith, | |
| 232 | + required this.hulsean, | |
| 233 | + required this.orthocentric, | |
| 234 | + required this.petaly, | |
| 235 | + required this.probudgeting, | |
| 236 | + required this.reacquire, | |
| 237 | + required this.scow, | |
| 238 | + required this.shutoff, | |
| 239 | + required this.subcontiguous, | |
| 240 | + required this.suffumigate, | |
| 241 | + required this.transformable, | |
| 242 | + required this.uncoroneted, | |
| 243 | + required this.unparking, | |
| 244 | + required this.unvarnishedness, | |
| 245 | + required this.wherewithal, | |
| 246 | + }); | |
| 247 | + | |
| 248 | + factory AlleviateClass.fromJson(Map<String, dynamic> json) => AlleviateClass( | |
| 249 | + apriori: json["apriori"], | |
| 250 | + beggarer: json["beggarer"], | |
| 251 | + brokenheartedly: json["brokenheartedly"], | |
| 252 | + debilitation: json["debilitation"], | |
| 253 | + frike: json["frike"], | |
| 254 | + gastrolith: json["gastrolith"], | |
| 255 | + hulsean: json["Hulsean"], | |
| 256 | + orthocentric: json["orthocentric"], | |
| 257 | + petaly: json["petaly"], | |
| 258 | + probudgeting: json["probudgeting"], | |
| 259 | + reacquire: json["reacquire"], | |
| 260 | + scow: json["scow"], | |
| 261 | + shutoff: json["shutoff"], | |
| 262 | + subcontiguous: json["subcontiguous"], | |
| 263 | + suffumigate: json["suffumigate"], | |
| 264 | + transformable: json["transformable"], | |
| 265 | + uncoroneted: json["uncoroneted"], | |
| 266 | + unparking: json["unparking"], | |
| 267 | + unvarnishedness: json["unvarnishedness"], | |
| 268 | + wherewithal: json["wherewithal"], | |
| 269 | + ); | |
| 270 | + | |
| 271 | + Map<String, dynamic> toJson() => { | |
| 272 | + "apriori": apriori, | |
| 273 | + "beggarer": beggarer, | |
| 274 | + "brokenheartedly": brokenheartedly, | |
| 275 | + "debilitation": debilitation, | |
| 276 | + "frike": frike, | |
| 277 | + "gastrolith": gastrolith, | |
| 278 | + "Hulsean": hulsean, | |
| 279 | + "orthocentric": orthocentric, | |
| 280 | + "petaly": petaly, | |
| 281 | + "probudgeting": probudgeting, | |
| 282 | + "reacquire": reacquire, | |
| 283 | + "scow": scow, | |
| 284 | + "shutoff": shutoff, | |
| 285 | + "subcontiguous": subcontiguous, | |
| 286 | + "suffumigate": suffumigate, | |
| 287 | + "transformable": transformable, | |
| 288 | + "uncoroneted": uncoroneted, | |
| 289 | + "unparking": unparking, | |
| 290 | + "unvarnishedness": unvarnishedness, | |
| 291 | + "wherewithal": wherewithal, | |
| 292 | + }; | |
| 293 | +} | |
| 294 | + | |
| 295 | +class Rebecca { | |
| 296 | + double catharticalness; | |
| 297 | + int chirotherium; | |
| 298 | + String disdiapason; | |
| 299 | + bool homocerc; | |
| 300 | + dynamic nonbookish; | |
| 301 | + | |
| 302 | + Rebecca({ | |
| 303 | + required this.catharticalness, | |
| 304 | + required this.chirotherium, | |
| 305 | + required this.disdiapason, | |
| 306 | + required this.homocerc, | |
| 307 | + required this.nonbookish, | |
| 308 | + }); | |
| 309 | + | |
| 310 | + factory Rebecca.fromJson(Map<String, dynamic> json) => Rebecca( | |
| 311 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 312 | + chirotherium: json["Chirotherium"], | |
| 313 | + disdiapason: json["disdiapason"], | |
| 314 | + homocerc: json["homocerc"], | |
| 315 | + nonbookish: json["nonbookish"], | |
| 316 | + ); | |
| 317 | + | |
| 318 | + Map<String, dynamic> toJson() => { | |
| 319 | + "catharticalness": catharticalness, | |
| 320 | + "Chirotherium": chirotherium, | |
| 321 | + "disdiapason": disdiapason, | |
| 322 | + "homocerc": homocerc, | |
| 323 | + "nonbookish": nonbookish, | |
| 324 | + }; | |
| 325 | +} | |
| 326 | + | |
| 327 | +class Amphithyron { | |
| 328 | + int? akroasis; | |
| 329 | + int? antiphonical; | |
| 330 | + int? basebred; | |
| 331 | + double? catharticalness; | |
| 332 | + int? chirotherium; | |
| 333 | + int? conductometric; | |
| 334 | + String? disdiapason; | |
| 335 | + int? ensilation; | |
| 336 | + int? eyebolt; | |
| 337 | + int? fistulated; | |
| 338 | + int? heteropod; | |
| 339 | + bool? homocerc; | |
| 340 | + int? juniperus; | |
| 341 | + int? labyrinthically; | |
| 342 | + int? martyrization; | |
| 343 | + int? mispolicy; | |
| 344 | + int? multipara; | |
| 345 | + int? nazirite; | |
| 346 | + dynamic nonbookish; | |
| 347 | + int? possessorial; | |
| 348 | + int? shamed; | |
| 349 | + int? shelfworn; | |
| 350 | + int? stagnum; | |
| 351 | + int? those; | |
| 352 | + int? undecimal; | |
| 353 | + | |
| 354 | + Amphithyron({ | |
| 355 | + this.akroasis, | |
| 356 | + this.antiphonical, | |
| 357 | + this.basebred, | |
| 358 | + this.catharticalness, | |
| 359 | + this.chirotherium, | |
| 360 | + this.conductometric, | |
| 361 | + this.disdiapason, | |
| 362 | + this.ensilation, | |
| 363 | + this.eyebolt, | |
| 364 | + this.fistulated, | |
| 365 | + this.heteropod, | |
| 366 | + this.homocerc, | |
| 367 | + this.juniperus, | |
| 368 | + this.labyrinthically, | |
| 369 | + this.martyrization, | |
| 370 | + this.mispolicy, | |
| 371 | + this.multipara, | |
| 372 | + this.nazirite, | |
| 373 | + this.nonbookish, | |
| 374 | + this.possessorial, | |
| 375 | + this.shamed, | |
| 376 | + this.shelfworn, | |
| 377 | + this.stagnum, | |
| 378 | + this.those, | |
| 379 | + this.undecimal, | |
| 380 | + }); | |
| 381 | + | |
| 382 | + factory Amphithyron.fromJson(Map<String, dynamic> json) => Amphithyron( | |
| 383 | + akroasis: json["akroasis"], | |
| 384 | + antiphonical: json["antiphonical"], | |
| 385 | + basebred: json["basebred"], | |
| 386 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 387 | + chirotherium: json["Chirotherium"], | |
| 388 | + conductometric: json["conductometric"], | |
| 389 | + disdiapason: json["disdiapason"], | |
| 390 | + ensilation: json["ensilation"], | |
| 391 | + eyebolt: json["eyebolt"], | |
| 392 | + fistulated: json["fistulated"], | |
| 393 | + heteropod: json["heteropod"], | |
| 394 | + homocerc: json["homocerc"], | |
| 395 | + juniperus: json["Juniperus"], | |
| 396 | + labyrinthically: json["labyrinthically"], | |
| 397 | + martyrization: json["martyrization"], | |
| 398 | + mispolicy: json["mispolicy"], | |
| 399 | + multipara: json["multipara"], | |
| 400 | + nazirite: json["Nazirite"], | |
| 401 | + nonbookish: json["nonbookish"], | |
| 402 | + possessorial: json["possessorial"], | |
| 403 | + shamed: json["shamed"], | |
| 404 | + shelfworn: json["shelfworn"], | |
| 405 | + stagnum: json["stagnum"], | |
| 406 | + those: json["Those"], | |
| 407 | + undecimal: json["undecimal"], | |
| 408 | + ); | |
| 409 | + | |
| 410 | + Map<String, dynamic> toJson() => { | |
| 411 | + "akroasis": akroasis, | |
| 412 | + "antiphonical": antiphonical, | |
| 413 | + "basebred": basebred, | |
| 414 | + "catharticalness": catharticalness, | |
| 415 | + "Chirotherium": chirotherium, | |
| 416 | + "conductometric": conductometric, | |
| 417 | + "disdiapason": disdiapason, | |
| 418 | + "ensilation": ensilation, | |
| 419 | + "eyebolt": eyebolt, | |
| 420 | + "fistulated": fistulated, | |
| 421 | + "heteropod": heteropod, | |
| 422 | + "homocerc": homocerc, | |
| 423 | + "Juniperus": juniperus, | |
| 424 | + "labyrinthically": labyrinthically, | |
| 425 | + "martyrization": martyrization, | |
| 426 | + "mispolicy": mispolicy, | |
| 427 | + "multipara": multipara, | |
| 428 | + "Nazirite": nazirite, | |
| 429 | + "nonbookish": nonbookish, | |
| 430 | + "possessorial": possessorial, | |
| 431 | + "shamed": shamed, | |
| 432 | + "shelfworn": shelfworn, | |
| 433 | + "stagnum": stagnum, | |
| 434 | + "Those": those, | |
| 435 | + "undecimal": undecimal, | |
| 436 | + }; | |
| 437 | +} | |
| 438 | + | |
| 439 | +class AnkeeClass { | |
| 440 | + dynamic anomoean; | |
| 441 | + dynamic barleyhood; | |
| 442 | + dynamic befriender; | |
| 443 | + dynamic brutishness; | |
| 444 | + dynamic cephalalgy; | |
| 445 | + dynamic cirurgian; | |
| 446 | + dynamic conventionally; | |
| 447 | + dynamic jackshay; | |
| 448 | + dynamic milammeter; | |
| 449 | + dynamic naja; | |
| 450 | + dynamic ombrological; | |
| 451 | + dynamic phonasthenia; | |
| 452 | + dynamic retrievableness; | |
| 453 | + dynamic snakily; | |
| 454 | + dynamic swot; | |
| 455 | + dynamic tartlet; | |
| 456 | + dynamic thiofuran; | |
| 457 | + dynamic tracheophone; | |
| 458 | + dynamic tuglike; | |
| 459 | + dynamic unscratchingly; | |
| 460 | + | |
| 461 | + AnkeeClass({ | |
| 462 | + required this.anomoean, | |
| 463 | + required this.barleyhood, | |
| 464 | + required this.befriender, | |
| 465 | + required this.brutishness, | |
| 466 | + required this.cephalalgy, | |
| 467 | + required this.cirurgian, | |
| 468 | + required this.conventionally, | |
| 469 | + required this.jackshay, | |
| 470 | + required this.milammeter, | |
| 471 | + required this.naja, | |
| 472 | + required this.ombrological, | |
| 473 | + required this.phonasthenia, | |
| 474 | + required this.retrievableness, | |
| 475 | + required this.snakily, | |
| 476 | + required this.swot, | |
| 477 | + required this.tartlet, | |
| 478 | + required this.thiofuran, | |
| 479 | + required this.tracheophone, | |
| 480 | + required this.tuglike, | |
| 481 | + required this.unscratchingly, | |
| 482 | + }); | |
| 483 | + | |
| 484 | + factory AnkeeClass.fromJson(Map<String, dynamic> json) => AnkeeClass( | |
| 485 | + anomoean: json["Anomoean"], | |
| 486 | + barleyhood: json["barleyhood"], | |
| 487 | + befriender: json["befriender"], | |
| 488 | + brutishness: json["brutishness"], | |
| 489 | + cephalalgy: json["cephalalgy"], | |
| 490 | + cirurgian: json["cirurgian"], | |
| 491 | + conventionally: json["conventionally"], | |
| 492 | + jackshay: json["jackshay"], | |
| 493 | + milammeter: json["milammeter"], | |
| 494 | + naja: json["Naja"], | |
| 495 | + ombrological: json["ombrological"], | |
| 496 | + phonasthenia: json["phonasthenia"], | |
| 497 | + retrievableness: json["retrievableness"], | |
| 498 | + snakily: json["snakily"], | |
| 499 | + swot: json["swot"], | |
| 500 | + tartlet: json["tartlet"], | |
| 501 | + thiofuran: json["thiofuran"], | |
| 502 | + tracheophone: json["tracheophone"], | |
| 503 | + tuglike: json["tuglike"], | |
| 504 | + unscratchingly: json["unscratchingly"], | |
| 505 | + ); | |
| 506 | + | |
| 507 | + Map<String, dynamic> toJson() => { | |
| 508 | + "Anomoean": anomoean, | |
| 509 | + "barleyhood": barleyhood, | |
| 510 | + "befriender": befriender, | |
| 511 | + "brutishness": brutishness, | |
| 512 | + "cephalalgy": cephalalgy, | |
| 513 | + "cirurgian": cirurgian, | |
| 514 | + "conventionally": conventionally, | |
| 515 | + "jackshay": jackshay, | |
| 516 | + "milammeter": milammeter, | |
| 517 | + "Naja": naja, | |
| 518 | + "ombrological": ombrological, | |
| 519 | + "phonasthenia": phonasthenia, | |
| 520 | + "retrievableness": retrievableness, | |
| 521 | + "snakily": snakily, | |
| 522 | + "swot": swot, | |
| 523 | + "tartlet": tartlet, | |
| 524 | + "thiofuran": thiofuran, | |
| 525 | + "tracheophone": tracheophone, | |
| 526 | + "tuglike": tuglike, | |
| 527 | + "unscratchingly": unscratchingly, | |
| 528 | + }; | |
| 529 | +} | |
| 530 | + | |
| 531 | +class AnsarieClass { | |
| 532 | + dynamic accension; | |
| 533 | + dynamic alida; | |
| 534 | + dynamic asteria; | |
| 535 | + dynamic beriberic; | |
| 536 | + dynamic edgebone; | |
| 537 | + dynamic gastrodialysis; | |
| 538 | + dynamic geographic; | |
| 539 | + dynamic ictonyx; | |
| 540 | + dynamic metrocele; | |
| 541 | + dynamic misgraft; | |
| 542 | + dynamic monteith; | |
| 543 | + dynamic notcher; | |
| 544 | + dynamic prorestriction; | |
| 545 | + dynamic ramist; | |
| 546 | + dynamic throatlet; | |
| 547 | + dynamic unfair; | |
| 548 | + dynamic unsynonymous; | |
| 549 | + dynamic water; | |
| 550 | + dynamic zestfully; | |
| 551 | + dynamic zincic; | |
| 552 | + | |
| 553 | + AnsarieClass({ | |
| 554 | + required this.accension, | |
| 555 | + required this.alida, | |
| 556 | + required this.asteria, | |
| 557 | + required this.beriberic, | |
| 558 | + required this.edgebone, | |
| 559 | + required this.gastrodialysis, | |
| 560 | + required this.geographic, | |
| 561 | + required this.ictonyx, | |
| 562 | + required this.metrocele, | |
| 563 | + required this.misgraft, | |
| 564 | + required this.monteith, | |
| 565 | + required this.notcher, | |
| 566 | + required this.prorestriction, | |
| 567 | + required this.ramist, | |
| 568 | + required this.throatlet, | |
| 569 | + required this.unfair, | |
| 570 | + required this.unsynonymous, | |
| 571 | + required this.water, | |
| 572 | + required this.zestfully, | |
| 573 | + required this.zincic, | |
| 574 | + }); | |
| 575 | + | |
| 576 | + factory AnsarieClass.fromJson(Map<String, dynamic> json) => AnsarieClass( | |
| 577 | + accension: json["accension"], | |
| 578 | + alida: json["Alida"], | |
| 579 | + asteria: json["asteria"], | |
| 580 | + beriberic: json["beriberic"], | |
| 581 | + edgebone: json["edgebone"], | |
| 582 | + gastrodialysis: json["gastrodialysis"], | |
| 583 | + geographic: json["geographic"], | |
| 584 | + ictonyx: json["Ictonyx"], | |
| 585 | + metrocele: json["metrocele"], | |
| 586 | + misgraft: json["misgraft"], | |
| 587 | + monteith: json["monteith"], | |
| 588 | + notcher: json["notcher"], | |
| 589 | + prorestriction: json["prorestriction"], | |
| 590 | + ramist: json["Ramist"], | |
| 591 | + throatlet: json["throatlet"], | |
| 592 | + unfair: json["unfair"], | |
| 593 | + unsynonymous: json["unsynonymous"], | |
| 594 | + water: json["water"], | |
| 595 | + zestfully: json["zestfully"], | |
| 596 | + zincic: json["zincic"], | |
| 597 | + ); | |
| 598 | + | |
| 599 | + Map<String, dynamic> toJson() => { | |
| 600 | + "accension": accension, | |
| 601 | + "Alida": alida, | |
| 602 | + "asteria": asteria, | |
| 603 | + "beriberic": beriberic, | |
| 604 | + "edgebone": edgebone, | |
| 605 | + "gastrodialysis": gastrodialysis, | |
| 606 | + "geographic": geographic, | |
| 607 | + "Ictonyx": ictonyx, | |
| 608 | + "metrocele": metrocele, | |
| 609 | + "misgraft": misgraft, | |
| 610 | + "monteith": monteith, | |
| 611 | + "notcher": notcher, | |
| 612 | + "prorestriction": prorestriction, | |
| 613 | + "Ramist": ramist, | |
| 614 | + "throatlet": throatlet, | |
| 615 | + "unfair": unfair, | |
| 616 | + "unsynonymous": unsynonymous, | |
| 617 | + "water": water, | |
| 618 | + "zestfully": zestfully, | |
| 619 | + "zincic": zincic, | |
| 620 | + }; | |
| 621 | +} | |
| 622 | + | |
| 623 | +class ChytridiaceaeClass { | |
| 624 | + dynamic batidaceae; | |
| 625 | + dynamic brechites; | |
| 626 | + dynamic codespairer; | |
| 627 | + dynamic emery; | |
| 628 | + dynamic enervative; | |
| 629 | + dynamic excriminate; | |
| 630 | + dynamic goshenite; | |
| 631 | + dynamic grime; | |
| 632 | + dynamic gritten; | |
| 633 | + dynamic hectorly; | |
| 634 | + dynamic intermediation; | |
| 635 | + dynamic meeterly; | |
| 636 | + dynamic narraganset; | |
| 637 | + dynamic onymatic; | |
| 638 | + dynamic paddlecock; | |
| 639 | + dynamic thana; | |
| 640 | + dynamic thornily; | |
| 641 | + dynamic uckia; | |
| 642 | + dynamic unmettle; | |
| 643 | + dynamic vorticellid; | |
| 644 | + | |
| 645 | + ChytridiaceaeClass({ | |
| 646 | + required this.batidaceae, | |
| 647 | + required this.brechites, | |
| 648 | + required this.codespairer, | |
| 649 | + required this.emery, | |
| 650 | + required this.enervative, | |
| 651 | + required this.excriminate, | |
| 652 | + required this.goshenite, | |
| 653 | + required this.grime, | |
| 654 | + required this.gritten, | |
| 655 | + required this.hectorly, | |
| 656 | + required this.intermediation, | |
| 657 | + required this.meeterly, | |
| 658 | + required this.narraganset, | |
| 659 | + required this.onymatic, | |
| 660 | + required this.paddlecock, | |
| 661 | + required this.thana, | |
| 662 | + required this.thornily, | |
| 663 | + required this.uckia, | |
| 664 | + required this.unmettle, | |
| 665 | + required this.vorticellid, | |
| 666 | + }); | |
| 667 | + | |
| 668 | + factory ChytridiaceaeClass.fromJson(Map<String, dynamic> json) => ChytridiaceaeClass( | |
| 669 | + batidaceae: json["Batidaceae"], | |
| 670 | + brechites: json["Brechites"], | |
| 671 | + codespairer: json["codespairer"], | |
| 672 | + emery: json["Emery"], | |
| 673 | + enervative: json["enervative"], | |
| 674 | + excriminate: json["excriminate"], | |
| 675 | + goshenite: json["goshenite"], | |
| 676 | + grime: json["grime"], | |
| 677 | + gritten: json["gritten"], | |
| 678 | + hectorly: json["hectorly"], | |
| 679 | + intermediation: json["intermediation"], | |
| 680 | + meeterly: json["meeterly"], | |
| 681 | + narraganset: json["Narraganset"], | |
| 682 | + onymatic: json["onymatic"], | |
| 683 | + paddlecock: json["paddlecock"], | |
| 684 | + thana: json["thana"], | |
| 685 | + thornily: json["thornily"], | |
| 686 | + uckia: json["uckia"], | |
| 687 | + unmettle: json["unmettle"], | |
| 688 | + vorticellid: json["vorticellid"], | |
| 689 | + ); | |
| 690 | + | |
| 691 | + Map<String, dynamic> toJson() => { | |
| 692 | + "Batidaceae": batidaceae, | |
| 693 | + "Brechites": brechites, | |
| 694 | + "codespairer": codespairer, | |
| 695 | + "Emery": emery, | |
| 696 | + "enervative": enervative, | |
| 697 | + "excriminate": excriminate, | |
| 698 | + "goshenite": goshenite, | |
| 699 | + "grime": grime, | |
| 700 | + "gritten": gritten, | |
| 701 | + "hectorly": hectorly, | |
| 702 | + "intermediation": intermediation, | |
| 703 | + "meeterly": meeterly, | |
| 704 | + "Narraganset": narraganset, | |
| 705 | + "onymatic": onymatic, | |
| 706 | + "paddlecock": paddlecock, | |
| 707 | + "thana": thana, | |
| 708 | + "thornily": thornily, | |
| 709 | + "uckia": uckia, | |
| 710 | + "unmettle": unmettle, | |
| 711 | + "vorticellid": vorticellid, | |
| 712 | + }; | |
| 713 | +} | |
| 714 | + | |
| 715 | +class DiscordiaClass { | |
| 716 | + int? altaic; | |
| 717 | + int? amoristic; | |
| 718 | + int? blennophthalmia; | |
| 719 | + double? catharticalness; | |
| 720 | + int? chirotherium; | |
| 721 | + int? disciplinability; | |
| 722 | + String? disdiapason; | |
| 723 | + int? goofer; | |
| 724 | + bool? homocerc; | |
| 725 | + int? laryngograph; | |
| 726 | + int? leucitis; | |
| 727 | + int? lymphocyst; | |
| 728 | + int? microcosmology; | |
| 729 | + int? nauseation; | |
| 730 | + dynamic nonbookish; | |
| 731 | + int? patarin; | |
| 732 | + int? preliberal; | |
| 733 | + int? prettifier; | |
| 734 | + int? rangework; | |
| 735 | + int? redient; | |
| 736 | + int? subfusiform; | |
| 737 | + int? suicidical; | |
| 738 | + int? swow; | |
| 739 | + int? wastrel; | |
| 740 | + int? wingle; | |
| 741 | + | |
| 742 | + DiscordiaClass({ | |
| 743 | + this.altaic, | |
| 744 | + this.amoristic, | |
| 745 | + this.blennophthalmia, | |
| 746 | + this.catharticalness, | |
| 747 | + this.chirotherium, | |
| 748 | + this.disciplinability, | |
| 749 | + this.disdiapason, | |
| 750 | + this.goofer, | |
| 751 | + this.homocerc, | |
| 752 | + this.laryngograph, | |
| 753 | + this.leucitis, | |
| 754 | + this.lymphocyst, | |
| 755 | + this.microcosmology, | |
| 756 | + this.nauseation, | |
| 757 | + this.nonbookish, | |
| 758 | + this.patarin, | |
| 759 | + this.preliberal, | |
| 760 | + this.prettifier, | |
| 761 | + this.rangework, | |
| 762 | + this.redient, | |
| 763 | + this.subfusiform, | |
| 764 | + this.suicidical, | |
| 765 | + this.swow, | |
| 766 | + this.wastrel, | |
| 767 | + this.wingle, | |
| 768 | + }); | |
| 769 | + | |
| 770 | + factory DiscordiaClass.fromJson(Map<String, dynamic> json) => DiscordiaClass( | |
| 771 | + altaic: json["Altaic"], | |
| 772 | + amoristic: json["amoristic"], | |
| 773 | + blennophthalmia: json["blennophthalmia"], | |
| 774 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 775 | + chirotherium: json["Chirotherium"], | |
| 776 | + disciplinability: json["disciplinability"], | |
| 777 | + disdiapason: json["disdiapason"], | |
| 778 | + goofer: json["goofer"], | |
| 779 | + homocerc: json["homocerc"], | |
| 780 | + laryngograph: json["laryngograph"], | |
| 781 | + leucitis: json["leucitis"], | |
| 782 | + lymphocyst: json["lymphocyst"], | |
| 783 | + microcosmology: json["microcosmology"], | |
| 784 | + nauseation: json["nauseation"], | |
| 785 | + nonbookish: json["nonbookish"], | |
| 786 | + patarin: json["Patarin"], | |
| 787 | + preliberal: json["preliberal"], | |
| 788 | + prettifier: json["prettifier"], | |
| 789 | + rangework: json["rangework"], | |
| 790 | + redient: json["redient"], | |
| 791 | + subfusiform: json["subfusiform"], | |
| 792 | + suicidical: json["suicidical"], | |
| 793 | + swow: json["swow"], | |
| 794 | + wastrel: json["wastrel"], | |
| 795 | + wingle: json["wingle"], | |
| 796 | + ); | |
| 797 | + | |
| 798 | + Map<String, dynamic> toJson() => { | |
| 799 | + "Altaic": altaic, | |
| 800 | + "amoristic": amoristic, | |
| 801 | + "blennophthalmia": blennophthalmia, | |
| 802 | + "catharticalness": catharticalness, | |
| 803 | + "Chirotherium": chirotherium, | |
| 804 | + "disciplinability": disciplinability, | |
| 805 | + "disdiapason": disdiapason, | |
| 806 | + "goofer": goofer, | |
| 807 | + "homocerc": homocerc, | |
| 808 | + "laryngograph": laryngograph, | |
| 809 | + "leucitis": leucitis, | |
| 810 | + "lymphocyst": lymphocyst, | |
| 811 | + "microcosmology": microcosmology, | |
| 812 | + "nauseation": nauseation, | |
| 813 | + "nonbookish": nonbookish, | |
| 814 | + "Patarin": patarin, | |
| 815 | + "preliberal": preliberal, | |
| 816 | + "prettifier": prettifier, | |
| 817 | + "rangework": rangework, | |
| 818 | + "redient": redient, | |
| 819 | + "subfusiform": subfusiform, | |
| 820 | + "suicidical": suicidical, | |
| 821 | + "swow": swow, | |
| 822 | + "wastrel": wastrel, | |
| 823 | + "wingle": wingle, | |
| 824 | + }; | |
| 825 | +} | |
| 826 | + | |
| 827 | +class GryphosaurusClass { | |
| 828 | + dynamic amissibility; | |
| 829 | + dynamic burushaski; | |
| 830 | + dynamic citronin; | |
| 831 | + dynamic coplaintiff; | |
| 832 | + dynamic disquisitionary; | |
| 833 | + dynamic enoplan; | |
| 834 | + dynamic faintness; | |
| 835 | + dynamic hebetomy; | |
| 836 | + dynamic islandry; | |
| 837 | + dynamic lameduck; | |
| 838 | + dynamic overbattle; | |
| 839 | + dynamic overinterested; | |
| 840 | + dynamic phrenologic; | |
| 841 | + dynamic rainband; | |
| 842 | + dynamic shiningly; | |
| 843 | + dynamic stamineous; | |
| 844 | + dynamic subscapularis; | |
| 845 | + dynamic tahami; | |
| 846 | + dynamic undaubed; | |
| 847 | + dynamic underntime; | |
| 848 | + | |
| 849 | + GryphosaurusClass({ | |
| 850 | + required this.amissibility, | |
| 851 | + required this.burushaski, | |
| 852 | + required this.citronin, | |
| 853 | + required this.coplaintiff, | |
| 854 | + required this.disquisitionary, | |
| 855 | + required this.enoplan, | |
| 856 | + required this.faintness, | |
| 857 | + required this.hebetomy, | |
| 858 | + required this.islandry, | |
| 859 | + required this.lameduck, | |
| 860 | + required this.overbattle, | |
| 861 | + required this.overinterested, | |
| 862 | + required this.phrenologic, | |
| 863 | + required this.rainband, | |
| 864 | + required this.shiningly, | |
| 865 | + required this.stamineous, | |
| 866 | + required this.subscapularis, | |
| 867 | + required this.tahami, | |
| 868 | + required this.undaubed, | |
| 869 | + required this.underntime, | |
| 870 | + }); | |
| 871 | + | |
| 872 | + factory GryphosaurusClass.fromJson(Map<String, dynamic> json) => GryphosaurusClass( | |
| 873 | + amissibility: json["amissibility"], | |
| 874 | + burushaski: json["Burushaski"], | |
| 875 | + citronin: json["citronin"], | |
| 876 | + coplaintiff: json["coplaintiff"], | |
| 877 | + disquisitionary: json["disquisitionary"], | |
| 878 | + enoplan: json["enoplan"], | |
| 879 | + faintness: json["faintness"], | |
| 880 | + hebetomy: json["hebetomy"], | |
| 881 | + islandry: json["islandry"], | |
| 882 | + lameduck: json["lameduck"], | |
| 883 | + overbattle: json["overbattle"], | |
| 884 | + overinterested: json["overinterested"], | |
| 885 | + phrenologic: json["phrenologic"], | |
| 886 | + rainband: json["rainband"], | |
| 887 | + shiningly: json["shiningly"], | |
| 888 | + stamineous: json["stamineous"], | |
| 889 | + subscapularis: json["subscapularis"], | |
| 890 | + tahami: json["Tahami"], | |
| 891 | + undaubed: json["undaubed"], | |
| 892 | + underntime: json["underntime"], | |
| 893 | + ); | |
| 894 | + | |
| 895 | + Map<String, dynamic> toJson() => { | |
| 896 | + "amissibility": amissibility, | |
| 897 | + "Burushaski": burushaski, | |
| 898 | + "citronin": citronin, | |
| 899 | + "coplaintiff": coplaintiff, | |
| 900 | + "disquisitionary": disquisitionary, | |
| 901 | + "enoplan": enoplan, | |
| 902 | + "faintness": faintness, | |
| 903 | + "hebetomy": hebetomy, | |
| 904 | + "islandry": islandry, | |
| 905 | + "lameduck": lameduck, | |
| 906 | + "overbattle": overbattle, | |
| 907 | + "overinterested": overinterested, | |
| 908 | + "phrenologic": phrenologic, | |
| 909 | + "rainband": rainband, | |
| 910 | + "shiningly": shiningly, | |
| 911 | + "stamineous": stamineous, | |
| 912 | + "subscapularis": subscapularis, | |
| 913 | + "Tahami": tahami, | |
| 914 | + "undaubed": undaubed, | |
| 915 | + "underntime": underntime, | |
| 916 | + }; | |
| 917 | +} | |
| 918 | + | |
| 919 | +class LaviniaClass { | |
| 920 | + int? agitable; | |
| 921 | + int? asininity; | |
| 922 | + int? benefiter; | |
| 923 | + int? bronzelike; | |
| 924 | + double? catharticalness; | |
| 925 | + int? chirotherium; | |
| 926 | + int? cholesteatomatous; | |
| 927 | + int? deprivement; | |
| 928 | + String? disdiapason; | |
| 929 | + int? flippantness; | |
| 930 | + int? fogproof; | |
| 931 | + bool? homocerc; | |
| 932 | + int? merrymeeting; | |
| 933 | + dynamic nonbookish; | |
| 934 | + int? overcareful; | |
| 935 | + int? panaris; | |
| 936 | + int? preacceptance; | |
| 937 | + int? quinoxaline; | |
| 938 | + int? sig; | |
| 939 | + int? superconfusion; | |
| 940 | + int? tacana; | |
| 941 | + int? tillotter; | |
| 942 | + int? tranquillize; | |
| 943 | + int? unquestionable; | |
| 944 | + int? uproute; | |
| 945 | + | |
| 946 | + LaviniaClass({ | |
| 947 | + this.agitable, | |
| 948 | + this.asininity, | |
| 949 | + this.benefiter, | |
| 950 | + this.bronzelike, | |
| 951 | + this.catharticalness, | |
| 952 | + this.chirotherium, | |
| 953 | + this.cholesteatomatous, | |
| 954 | + this.deprivement, | |
| 955 | + this.disdiapason, | |
| 956 | + this.flippantness, | |
| 957 | + this.fogproof, | |
| 958 | + this.homocerc, | |
| 959 | + this.merrymeeting, | |
| 960 | + this.nonbookish, | |
| 961 | + this.overcareful, | |
| 962 | + this.panaris, | |
| 963 | + this.preacceptance, | |
| 964 | + this.quinoxaline, | |
| 965 | + this.sig, | |
| 966 | + this.superconfusion, | |
| 967 | + this.tacana, | |
| 968 | + this.tillotter, | |
| 969 | + this.tranquillize, | |
| 970 | + this.unquestionable, | |
| 971 | + this.uproute, | |
| 972 | + }); | |
| 973 | + | |
| 974 | + factory LaviniaClass.fromJson(Map<String, dynamic> json) => LaviniaClass( | |
| 975 | + agitable: json["agitable"], | |
| 976 | + asininity: json["asininity"], | |
| 977 | + benefiter: json["benefiter"], | |
| 978 | + bronzelike: json["bronzelike"], | |
| 979 | + catharticalness: json["catharticalness"]?.toDouble(), | |
| 980 | + chirotherium: json["Chirotherium"], | |
| 981 | + cholesteatomatous: json["cholesteatomatous"], | |
| 982 | + deprivement: json["deprivement"], | |
| 983 | + disdiapason: json["disdiapason"], | |
| 984 | + flippantness: json["flippantness"], | |
| 985 | + fogproof: json["fogproof"], | |
| 986 | + homocerc: json["homocerc"], | |
| 987 | + merrymeeting: json["merrymeeting"], | |
| 988 | + nonbookish: json["nonbookish"], | |
| 989 | + overcareful: json["overcareful"], | |
| 990 | + panaris: json["panaris"], | |
| 991 | + preacceptance: json["preacceptance"], | |
| 992 | + quinoxaline: json["quinoxaline"], | |
| 993 | + sig: json["sig"], | |
| 994 | + superconfusion: json["superconfusion"], | |
| 995 | + tacana: json["Tacana"], | |
| 996 | + tillotter: json["tillotter"], | |
| 997 | + tranquillize: json["tranquillize"], | |
| 998 | + unquestionable: json["unquestionable"], | |
| 999 | + uproute: json["uproute"], | |
| 1000 | + ); | |
| 1001 | + | |
| 1002 | + Map<String, dynamic> toJson() => { | |
| 1003 | + "agitable": agitable, | |
| 1004 | + "asininity": asininity, | |
| 1005 | + "benefiter": benefiter, | |
| 1006 | + "bronzelike": bronzelike, | |
| 1007 | + "catharticalness": catharticalness, | |
| 1008 | + "Chirotherium": chirotherium, | |
| 1009 | + "cholesteatomatous": cholesteatomatous, | |
| 1010 | + "deprivement": deprivement, | |
| 1011 | + "disdiapason": disdiapason, | |
| 1012 | + "flippantness": flippantness, | |
| 1013 | + "fogproof": fogproof, | |
| 1014 | + "homocerc": homocerc, | |
| 1015 | + "merrymeeting": merrymeeting, | |
| 1016 | + "nonbookish": nonbookish, | |
| 1017 | + "overcareful": overcareful, | |
| 1018 | + "panaris": panaris, | |
| 1019 | + "preacceptance": preacceptance, | |
| 1020 | + "quinoxaline": quinoxaline, | |
| 1021 | + "sig": sig, | |
| 1022 | + "superconfusion": superconfusion, | |
| 1023 | + "Tacana": tacana, | |
| 1024 | + "tillotter": tillotter, | |
| 1025 | + "tranquillize": tranquillize, | |
| 1026 | + "unquestionable": unquestionable, | |
| 1027 | + "uproute": uproute, | |
| 1028 | + }; | |
| 1029 | +} | |
| 1030 | + | |
| 1031 | +class OskarClass { | |
| 1032 | + dynamic acrobates; | |
| 1033 | + dynamic beanshooter; | |
| 1034 | + dynamic bearhound; | |
| 1035 | + dynamic cayuga; | |
| 1036 | + dynamic guarneri; | |
| 1037 | + dynamic hypochondriacism; | |
| 1038 | + dynamic indication; | |
| 1039 | + dynamic jaculative; | |
| 1040 | + dynamic nagana; | |
| 1041 | + dynamic netherlandish; | |
| 1042 | + dynamic noctivagous; | |
| 1043 | + dynamic nonphysiological; | |
| 1044 | + dynamic praxis; | |
| 1045 | + dynamic provision; | |
| 1046 | + dynamic subterhuman; | |
| 1047 | + dynamic sunlit; | |
| 1048 | + dynamic syncraniate; | |
| 1049 | + dynamic teachment; | |
| 1050 | + dynamic unmutinous; | |
| 1051 | + dynamic unstoppable; | |
| 1052 | + | |
| 1053 | + OskarClass({ | |
| 1054 | + required this.acrobates, | |
| 1055 | + required this.beanshooter, | |
| 1056 | + required this.bearhound, | |
| 1057 | + required this.cayuga, | |
| 1058 | + required this.guarneri, | |
| 1059 | + required this.hypochondriacism, | |
| 1060 | + required this.indication, | |
| 1061 | + required this.jaculative, | |
| 1062 | + required this.nagana, | |
| 1063 | + required this.netherlandish, | |
| 1064 | + required this.noctivagous, | |
| 1065 | + required this.nonphysiological, | |
| 1066 | + required this.praxis, | |
| 1067 | + required this.provision, | |
| 1068 | + required this.subterhuman, | |
| 1069 | + required this.sunlit, | |
| 1070 | + required this.syncraniate, | |
| 1071 | + required this.teachment, | |
| 1072 | + required this.unmutinous, | |
| 1073 | + required this.unstoppable, | |
| 1074 | + }); | |
| 1075 | + | |
| 1076 | + factory OskarClass.fromJson(Map<String, dynamic> json) => OskarClass( | |
| 1077 | + acrobates: json["Acrobates"], | |
| 1078 | + beanshooter: json["beanshooter"], | |
| 1079 | + bearhound: json["bearhound"], | |
| 1080 | + cayuga: json["Cayuga"], | |
| 1081 | + guarneri: json["guarneri"], | |
| 1082 | + hypochondriacism: json["hypochondriacism"], | |
| 1083 | + indication: json["indication"], | |
| 1084 | + jaculative: json["jaculative"], | |
| 1085 | + nagana: json["nagana"], | |
| 1086 | + netherlandish: json["Netherlandish"], | |
| 1087 | + noctivagous: json["noctivagous"], | |
| 1088 | + nonphysiological: json["nonphysiological"], | |
| 1089 | + praxis: json["praxis"], | |
| 1090 | + provision: json["provision"], | |
| 1091 | + subterhuman: json["subterhuman"], | |
| 1092 | + sunlit: json["sunlit"], | |
| 1093 | + syncraniate: json["syncraniate"], | |
| 1094 | + teachment: json["teachment"], | |
| 1095 | + unmutinous: json["unmutinous"], | |
| 1096 | + unstoppable: json["unstoppable"], | |
| 1097 | + ); | |
| 1098 | + | |
| 1099 | + Map<String, dynamic> toJson() => { | |
| 1100 | + "Acrobates": acrobates, | |
| 1101 | + "beanshooter": beanshooter, | |
| 1102 | + "bearhound": bearhound, | |
| 1103 | + "Cayuga": cayuga, | |
| 1104 | + "guarneri": guarneri, | |
| 1105 | + "hypochondriacism": hypochondriacism, | |
| 1106 | + "indication": indication, | |
| 1107 | + "jaculative": jaculative, | |
| 1108 | + "nagana": nagana, | |
| 1109 | + "Netherlandish": netherlandish, | |
| 1110 | + "noctivagous": noctivagous, | |
| 1111 | + "nonphysiological": nonphysiological, | |
| 1112 | + "praxis": praxis, | |
| 1113 | + "provision": provision, | |
| 1114 | + "subterhuman": subterhuman, | |
| 1115 | + "sunlit": sunlit, | |
| 1116 | + "syncraniate": syncraniate, | |
| 1117 | + "teachment": teachment, | |
| 1118 | + "unmutinous": unmutinous, | |
| 1119 | + "unstoppable": unstoppable, | |
| 1120 | + }; | |
| 1121 | +} |
Test case
1 generated file · +5,705 −0test/inputs/json/priority/keywords.json
Adartdefault / TopLevel.dart+5,705 −0
| @@ -0,0 +1,5705 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final int dummy; | |
| 13 | + final Obj1 obj1; | |
| 14 | + final Obj2 obj2; | |
| 15 | + final Obj3 obj3; | |
| 16 | + final Obj4 obj4; | |
| 17 | + final Obj5 obj5; | |
| 18 | + | |
| 19 | + TopLevel({ | |
| 20 | + required this.dummy, | |
| 21 | + required this.obj1, | |
| 22 | + required this.obj2, | |
| 23 | + required this.obj3, | |
| 24 | + required this.obj4, | |
| 25 | + required this.obj5, | |
| 26 | + }); | |
| 27 | + | |
| 28 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 29 | + dummy: json["dummy"], | |
| 30 | + obj1: Obj1.fromJson(json["obj1"]), | |
| 31 | + obj2: Obj2.fromJson(json["obj2"]), | |
| 32 | + obj3: Obj3.fromJson(json["obj3"]), | |
| 33 | + obj4: Obj4.fromJson(json["obj4"]), | |
| 34 | + obj5: Obj5.fromJson(json["obj5"]), | |
| 35 | + ); | |
| 36 | + | |
| 37 | + Map<String, dynamic> toJson() => { | |
| 38 | + "dummy": dummy, | |
| 39 | + "obj1": obj1.toJson(), | |
| 40 | + "obj2": obj2.toJson(), | |
| 41 | + "obj3": obj3.toJson(), | |
| 42 | + "obj4": obj4.toJson(), | |
| 43 | + "obj5": obj5.toJson(), | |
| 44 | + }; | |
| 45 | +} | |
| 46 | + | |
| 47 | +class Obj1 { | |
| 48 | + final Alignas alignas; | |
| 49 | + final Alignof alignof; | |
| 50 | + final And and; | |
| 51 | + final AndEq andEq; | |
| 52 | + final Any any; | |
| 53 | + final Array array; | |
| 54 | + final Asm asm; | |
| 55 | + final Associatedtype associatedtype; | |
| 56 | + final Associativity associativity; | |
| 57 | + final Atomic atomic; | |
| 58 | + final AtomicCancel atomicCancel; | |
| 59 | + final AtomicCommit atomicCommit; | |
| 60 | + final AtomicNoexcept atomicNoexcept; | |
| 61 | + final Auto auto; | |
| 62 | + final Base base; | |
| 63 | + final Bitand bitand; | |
| 64 | + final Bitor bitor; | |
| 65 | + final Boolean boolean; | |
| 66 | + final Bycopy bycopy; | |
| 67 | + final Byref byref; | |
| 68 | + final Byte byte; | |
| 69 | + final Chan chan; | |
| 70 | + final Char char; | |
| 71 | + final Char16T char16T; | |
| 72 | + final Char32T char32T; | |
| 73 | + final Checked checked; | |
| 74 | + final Clone clone; | |
| 75 | + final CoAwait coAwait; | |
| 76 | + final CoReturn coReturn; | |
| 77 | + final CoYield coYield; | |
| 78 | + final Compl compl; | |
| 79 | + final Complex complex; | |
| 80 | + final Concept concept; | |
| 81 | + final Console console; | |
| 82 | + final ConstCast constCast; | |
| 83 | + final Constexpr constexpr; | |
| 84 | + final Constructor constructor; | |
| 85 | + final Convenience convenience; | |
| 86 | + final Convert convert; | |
| 87 | + final Converter converter; | |
| 88 | + final Date date; | |
| 89 | + final DateParseHandling dateParseHandling; | |
| 90 | + final Debugger debugger; | |
| 91 | + final Decimal decimal; | |
| 92 | + final Declare declare; | |
| 93 | + final Decltype decltype; | |
| 94 | + final DecodeString decodeString; | |
| 95 | + final int dummy; | |
| 96 | + final Empty empty; | |
| 97 | + final Obj1Bool fluffyBool; | |
| 98 | + final Imaginery imaginery; | |
| 99 | + final Abstract obj1Abstract; | |
| 100 | + final AnyClass obj1Any; | |
| 101 | + final As obj1As; | |
| 102 | + final Assert obj1Assert; | |
| 103 | + final Async obj1Async; | |
| 104 | + final Await obj1Await; | |
| 105 | + final Bool obj1Bool; | |
| 106 | + final Break obj1Break; | |
| 107 | + final Case obj1Case; | |
| 108 | + final Catch obj1Catch; | |
| 109 | + final Class obj1Class; | |
| 110 | + final Const obj1Const; | |
| 111 | + final Continue obj1Continue; | |
| 112 | + final BoolClass purpleBool; | |
| 113 | + final ClassClass purpleClass; | |
| 114 | + | |
| 115 | + Obj1({ | |
| 116 | + required this.alignas, | |
| 117 | + required this.alignof, | |
| 118 | + required this.and, | |
| 119 | + required this.andEq, | |
| 120 | + required this.any, | |
| 121 | + required this.array, | |
| 122 | + required this.asm, | |
| 123 | + required this.associatedtype, | |
| 124 | + required this.associativity, | |
| 125 | + required this.atomic, | |
| 126 | + required this.atomicCancel, | |
| 127 | + required this.atomicCommit, | |
| 128 | + required this.atomicNoexcept, | |
| 129 | + required this.auto, | |
| 130 | + required this.base, | |
| 131 | + required this.bitand, | |
| 132 | + required this.bitor, | |
| 133 | + required this.boolean, | |
| 134 | + required this.bycopy, | |
| 135 | + required this.byref, | |
| 136 | + required this.byte, | |
| 137 | + required this.chan, | |
| 138 | + required this.char, | |
| 139 | + required this.char16T, | |
| 140 | + required this.char32T, | |
| 141 | + required this.checked, | |
| 142 | + required this.clone, | |
| 143 | + required this.coAwait, | |
| 144 | + required this.coReturn, | |
| 145 | + required this.coYield, | |
| 146 | + required this.compl, | |
| 147 | + required this.complex, | |
| 148 | + required this.concept, | |
| 149 | + required this.console, | |
| 150 | + required this.constCast, | |
| 151 | + required this.constexpr, | |
| 152 | + required this.constructor, | |
| 153 | + required this.convenience, | |
| 154 | + required this.convert, | |
| 155 | + required this.converter, | |
| 156 | + required this.date, | |
| 157 | + required this.dateParseHandling, | |
| 158 | + required this.debugger, | |
| 159 | + required this.decimal, | |
| 160 | + required this.declare, | |
| 161 | + required this.decltype, | |
| 162 | + required this.decodeString, | |
| 163 | + required this.dummy, | |
| 164 | + required this.empty, | |
| 165 | + required this.fluffyBool, | |
| 166 | + required this.imaginery, | |
| 167 | + required this.obj1Abstract, | |
| 168 | + required this.obj1Any, | |
| 169 | + required this.obj1As, | |
| 170 | + required this.obj1Assert, | |
| 171 | + required this.obj1Async, | |
| 172 | + required this.obj1Await, | |
| 173 | + required this.obj1Bool, | |
| 174 | + required this.obj1Break, | |
| 175 | + required this.obj1Case, | |
| 176 | + required this.obj1Catch, | |
| 177 | + required this.obj1Class, | |
| 178 | + required this.obj1Const, | |
| 179 | + required this.obj1Continue, | |
| 180 | + required this.purpleBool, | |
| 181 | + required this.purpleClass, | |
| 182 | + }); | |
| 183 | + | |
| 184 | + factory Obj1.fromJson(Map<String, dynamic> json) => Obj1( | |
| 185 | + alignas: Alignas.fromJson(json["alignas"]), | |
| 186 | + alignof: Alignof.fromJson(json["alignof"]), | |
| 187 | + and: And.fromJson(json["and"]), | |
| 188 | + andEq: AndEq.fromJson(json["and_eq"]), | |
| 189 | + any: Any.fromJson(json["Any"]), | |
| 190 | + array: Array.fromJson(json["array"]), | |
| 191 | + asm: Asm.fromJson(json["asm"]), | |
| 192 | + associatedtype: Associatedtype.fromJson(json["associatedtype"]), | |
| 193 | + associativity: Associativity.fromJson(json["associativity"]), | |
| 194 | + atomic: Atomic.fromJson(json["atomic"]), | |
| 195 | + atomicCancel: AtomicCancel.fromJson(json["atomic_cancel"]), | |
| 196 | + atomicCommit: AtomicCommit.fromJson(json["atomic_commit"]), | |
| 197 | + atomicNoexcept: AtomicNoexcept.fromJson(json["atomic_noexcept"]), | |
| 198 | + auto: Auto.fromJson(json["auto"]), | |
| 199 | + base: Base.fromJson(json["base"]), | |
| 200 | + bitand: Bitand.fromJson(json["bitand"]), | |
| 201 | + bitor: Bitor.fromJson(json["bitor"]), | |
| 202 | + boolean: Boolean.fromJson(json["boolean"]), | |
| 203 | + bycopy: Bycopy.fromJson(json["bycopy"]), | |
| 204 | + byref: Byref.fromJson(json["byref"]), | |
| 205 | + byte: Byte.fromJson(json["byte"]), | |
| 206 | + chan: Chan.fromJson(json["chan"]), | |
| 207 | + char: Char.fromJson(json["char"]), | |
| 208 | + char16T: Char16T.fromJson(json["char16_t"]), | |
| 209 | + char32T: Char32T.fromJson(json["char32_t"]), | |
| 210 | + checked: Checked.fromJson(json["checked"]), | |
| 211 | + clone: Clone.fromJson(json["clone"]), | |
| 212 | + coAwait: CoAwait.fromJson(json["co_await"]), | |
| 213 | + coReturn: CoReturn.fromJson(json["co_return"]), | |
| 214 | + coYield: CoYield.fromJson(json["co_yield"]), | |
| 215 | + compl: Compl.fromJson(json["compl"]), | |
| 216 | + complex: Complex.fromJson(json["_Complex"]), | |
| 217 | + concept: Concept.fromJson(json["concept"]), | |
| 218 | + console: Console.fromJson(json["console"]), | |
| 219 | + constCast: ConstCast.fromJson(json["const_cast"]), | |
| 220 | + constexpr: Constexpr.fromJson(json["constexpr"]), | |
| 221 | + constructor: Constructor.fromJson(json["constructor"]), | |
| 222 | + convenience: Convenience.fromJson(json["convenience"]), | |
| 223 | + convert: Convert.fromJson(json["convert"]), | |
| 224 | + converter: Converter.fromJson(json["converter"]), | |
| 225 | + date: Date.fromJson(json["date"]), | |
| 226 | + dateParseHandling: DateParseHandling.fromJson(json["date_parse_handling"]), | |
| 227 | + debugger: Debugger.fromJson(json["debugger"]), | |
| 228 | + decimal: Decimal.fromJson(json["decimal"]), | |
| 229 | + declare: Declare.fromJson(json["declare"]), | |
| 230 | + decltype: Decltype.fromJson(json["decltype"]), | |
| 231 | + decodeString: DecodeString.fromJson(json["decode_string"]), | |
| 232 | + dummy: json["dummy"], | |
| 233 | + empty: Empty.fromJson(json["_"]), | |
| 234 | + fluffyBool: Obj1Bool.fromJson(json["bool"]), | |
| 235 | + imaginery: Imaginery.fromJson(json["_Imaginery"]), | |
| 236 | + obj1Abstract: Abstract.fromJson(json["abstract"]), | |
| 237 | + obj1Any: AnyClass.fromJson(json["any"]), | |
| 238 | + obj1As: As.fromJson(json["as"]), | |
| 239 | + obj1Assert: Assert.fromJson(json["assert"]), | |
| 240 | + obj1Async: Async.fromJson(json["async"]), | |
| 241 | + obj1Await: Await.fromJson(json["await"]), | |
| 242 | + obj1Bool: Bool.fromJson(json["BOOL"]), | |
| 243 | + obj1Break: Break.fromJson(json["break"]), | |
| 244 | + obj1Case: Case.fromJson(json["case"]), | |
| 245 | + obj1Catch: Catch.fromJson(json["catch"]), | |
| 246 | + obj1Class: Class.fromJson(json["Class"]), | |
| 247 | + obj1Const: Const.fromJson(json["const"]), | |
| 248 | + obj1Continue: Continue.fromJson(json["continue"]), | |
| 249 | + purpleBool: BoolClass.fromJson(json["_Bool"]), | |
| 250 | + purpleClass: ClassClass.fromJson(json["class"]), | |
| 251 | + ); | |
| 252 | + | |
| 253 | + Map<String, dynamic> toJson() => { | |
| 254 | + "alignas": alignas.toJson(), | |
| 255 | + "alignof": alignof.toJson(), | |
| 256 | + "and": and.toJson(), | |
| 257 | + "and_eq": andEq.toJson(), | |
| 258 | + "Any": any.toJson(), | |
| 259 | + "array": array.toJson(), | |
| 260 | + "asm": asm.toJson(), | |
| 261 | + "associatedtype": associatedtype.toJson(), | |
| 262 | + "associativity": associativity.toJson(), | |
| 263 | + "atomic": atomic.toJson(), | |
| 264 | + "atomic_cancel": atomicCancel.toJson(), | |
| 265 | + "atomic_commit": atomicCommit.toJson(), | |
| 266 | + "atomic_noexcept": atomicNoexcept.toJson(), | |
| 267 | + "auto": auto.toJson(), | |
| 268 | + "base": base.toJson(), | |
| 269 | + "bitand": bitand.toJson(), | |
| 270 | + "bitor": bitor.toJson(), | |
| 271 | + "boolean": boolean.toJson(), | |
| 272 | + "bycopy": bycopy.toJson(), | |
| 273 | + "byref": byref.toJson(), | |
| 274 | + "byte": byte.toJson(), | |
| 275 | + "chan": chan.toJson(), | |
| 276 | + "char": char.toJson(), | |
| 277 | + "char16_t": char16T.toJson(), | |
| 278 | + "char32_t": char32T.toJson(), | |
| 279 | + "checked": checked.toJson(), | |
| 280 | + "clone": clone.toJson(), | |
| 281 | + "co_await": coAwait.toJson(), | |
| 282 | + "co_return": coReturn.toJson(), | |
| 283 | + "co_yield": coYield.toJson(), | |
| 284 | + "compl": compl.toJson(), | |
| 285 | + "_Complex": complex.toJson(), | |
| 286 | + "concept": concept.toJson(), | |
| 287 | + "console": console.toJson(), | |
| 288 | + "const_cast": constCast.toJson(), | |
| 289 | + "constexpr": constexpr.toJson(), | |
| 290 | + "constructor": constructor.toJson(), | |
| 291 | + "convenience": convenience.toJson(), | |
| 292 | + "convert": convert.toJson(), | |
| 293 | + "converter": converter.toJson(), | |
| 294 | + "date": date.toJson(), | |
| 295 | + "date_parse_handling": dateParseHandling.toJson(), | |
| 296 | + "debugger": debugger.toJson(), | |
| 297 | + "decimal": decimal.toJson(), | |
| 298 | + "declare": declare.toJson(), | |
| 299 | + "decltype": decltype.toJson(), | |
| 300 | + "decode_string": decodeString.toJson(), | |
| 301 | + "dummy": dummy, | |
| 302 | + "_": empty.toJson(), | |
| 303 | + "bool": fluffyBool.toJson(), | |
| 304 | + "_Imaginery": imaginery.toJson(), | |
| 305 | + "abstract": obj1Abstract.toJson(), | |
| 306 | + "any": obj1Any.toJson(), | |
| 307 | + "as": obj1As.toJson(), | |
| 308 | + "assert": obj1Assert.toJson(), | |
| 309 | + "async": obj1Async.toJson(), | |
| 310 | + "await": obj1Await.toJson(), | |
| 311 | + "BOOL": obj1Bool.toJson(), | |
| 312 | + "break": obj1Break.toJson(), | |
| 313 | + "case": obj1Case.toJson(), | |
| 314 | + "catch": obj1Catch.toJson(), | |
| 315 | + "Class": obj1Class.toJson(), | |
| 316 | + "const": obj1Const.toJson(), | |
| 317 | + "continue": obj1Continue.toJson(), | |
| 318 | + "_Bool": purpleBool.toJson(), | |
| 319 | + "class": purpleClass.toJson(), | |
| 320 | + }; | |
| 321 | +} | |
| 322 | + | |
| 323 | +class Alignas { | |
| 324 | + final int alignas; | |
| 325 | + | |
| 326 | + Alignas({ | |
| 327 | + required this.alignas, | |
| 328 | + }); | |
| 329 | + | |
| 330 | + factory Alignas.fromJson(Map<String, dynamic> json) => Alignas( | |
| 331 | + alignas: json["alignas"], | |
| 332 | + ); | |
| 333 | + | |
| 334 | + Map<String, dynamic> toJson() => { | |
| 335 | + "alignas": alignas, | |
| 336 | + }; | |
| 337 | +} | |
| 338 | + | |
| 339 | +class Alignof { | |
| 340 | + final int alignof; | |
| 341 | + | |
| 342 | + Alignof({ | |
| 343 | + required this.alignof, | |
| 344 | + }); | |
| 345 | + | |
| 346 | + factory Alignof.fromJson(Map<String, dynamic> json) => Alignof( | |
| 347 | + alignof: json["alignof"], | |
| 348 | + ); | |
| 349 | + | |
| 350 | + Map<String, dynamic> toJson() => { | |
| 351 | + "alignof": alignof, | |
| 352 | + }; | |
| 353 | +} | |
| 354 | + | |
| 355 | +class And { | |
| 356 | + final int and; | |
| 357 | + | |
| 358 | + And({ | |
| 359 | + required this.and, | |
| 360 | + }); | |
| 361 | + | |
| 362 | + factory And.fromJson(Map<String, dynamic> json) => And( | |
| 363 | + and: json["and"], | |
| 364 | + ); | |
| 365 | + | |
| 366 | + Map<String, dynamic> toJson() => { | |
| 367 | + "and": and, | |
| 368 | + }; | |
| 369 | +} | |
| 370 | + | |
| 371 | +class AndEq { | |
| 372 | + final int andEq; | |
| 373 | + | |
| 374 | + AndEq({ | |
| 375 | + required this.andEq, | |
| 376 | + }); | |
| 377 | + | |
| 378 | + factory AndEq.fromJson(Map<String, dynamic> json) => AndEq( | |
| 379 | + andEq: json["and_eq"], | |
| 380 | + ); | |
| 381 | + | |
| 382 | + Map<String, dynamic> toJson() => { | |
| 383 | + "and_eq": andEq, | |
| 384 | + }; | |
| 385 | +} | |
| 386 | + | |
| 387 | +class Any { | |
| 388 | + final int any; | |
| 389 | + | |
| 390 | + Any({ | |
| 391 | + required this.any, | |
| 392 | + }); | |
| 393 | + | |
| 394 | + factory Any.fromJson(Map<String, dynamic> json) => Any( | |
| 395 | + any: json["Any"], | |
| 396 | + ); | |
| 397 | + | |
| 398 | + Map<String, dynamic> toJson() => { | |
| 399 | + "Any": any, | |
| 400 | + }; | |
| 401 | +} | |
| 402 | + | |
| 403 | +class Array { | |
| 404 | + final int array; | |
| 405 | + | |
| 406 | + Array({ | |
| 407 | + required this.array, | |
| 408 | + }); | |
| 409 | + | |
| 410 | + factory Array.fromJson(Map<String, dynamic> json) => Array( | |
| 411 | + array: json["array"], | |
| 412 | + ); | |
| 413 | + | |
| 414 | + Map<String, dynamic> toJson() => { | |
| 415 | + "array": array, | |
| 416 | + }; | |
| 417 | +} | |
| 418 | + | |
| 419 | +class Asm { | |
| 420 | + final int asm; | |
| 421 | + | |
| 422 | + Asm({ | |
| 423 | + required this.asm, | |
| 424 | + }); | |
| 425 | + | |
| 426 | + factory Asm.fromJson(Map<String, dynamic> json) => Asm( | |
| 427 | + asm: json["asm"], | |
| 428 | + ); | |
| 429 | + | |
| 430 | + Map<String, dynamic> toJson() => { | |
| 431 | + "asm": asm, | |
| 432 | + }; | |
| 433 | +} | |
| 434 | + | |
| 435 | +class Associatedtype { | |
| 436 | + final int associatedtype; | |
| 437 | + | |
| 438 | + Associatedtype({ | |
| 439 | + required this.associatedtype, | |
| 440 | + }); | |
| 441 | + | |
| 442 | + factory Associatedtype.fromJson(Map<String, dynamic> json) => Associatedtype( | |
| 443 | + associatedtype: json["associatedtype"], | |
| 444 | + ); | |
| 445 | + | |
| 446 | + Map<String, dynamic> toJson() => { | |
| 447 | + "associatedtype": associatedtype, | |
| 448 | + }; | |
| 449 | +} | |
| 450 | + | |
| 451 | +class Associativity { | |
| 452 | + final int associativity; | |
| 453 | + | |
| 454 | + Associativity({ | |
| 455 | + required this.associativity, | |
| 456 | + }); | |
| 457 | + | |
| 458 | + factory Associativity.fromJson(Map<String, dynamic> json) => Associativity( | |
| 459 | + associativity: json["associativity"], | |
| 460 | + ); | |
| 461 | + | |
| 462 | + Map<String, dynamic> toJson() => { | |
| 463 | + "associativity": associativity, | |
| 464 | + }; | |
| 465 | +} | |
| 466 | + | |
| 467 | +class Atomic { | |
| 468 | + final int atomic; | |
| 469 | + | |
| 470 | + Atomic({ | |
| 471 | + required this.atomic, | |
| 472 | + }); | |
| 473 | + | |
| 474 | + factory Atomic.fromJson(Map<String, dynamic> json) => Atomic( | |
| 475 | + atomic: json["atomic"], | |
| 476 | + ); | |
| 477 | + | |
| 478 | + Map<String, dynamic> toJson() => { | |
| 479 | + "atomic": atomic, | |
| 480 | + }; | |
| 481 | +} | |
| 482 | + | |
| 483 | +class AtomicCancel { | |
| 484 | + final int atomicCancel; | |
| 485 | + | |
| 486 | + AtomicCancel({ | |
| 487 | + required this.atomicCancel, | |
| 488 | + }); | |
| 489 | + | |
| 490 | + factory AtomicCancel.fromJson(Map<String, dynamic> json) => AtomicCancel( | |
| 491 | + atomicCancel: json["atomic_cancel"], | |
| 492 | + ); | |
| 493 | + | |
| 494 | + Map<String, dynamic> toJson() => { | |
| 495 | + "atomic_cancel": atomicCancel, | |
| 496 | + }; | |
| 497 | +} | |
| 498 | + | |
| 499 | +class AtomicCommit { | |
| 500 | + final int atomicCommit; | |
| 501 | + | |
| 502 | + AtomicCommit({ | |
| 503 | + required this.atomicCommit, | |
| 504 | + }); | |
| 505 | + | |
| 506 | + factory AtomicCommit.fromJson(Map<String, dynamic> json) => AtomicCommit( | |
| 507 | + atomicCommit: json["atomic_commit"], | |
| 508 | + ); | |
| 509 | + | |
| 510 | + Map<String, dynamic> toJson() => { | |
| 511 | + "atomic_commit": atomicCommit, | |
| 512 | + }; | |
| 513 | +} | |
| 514 | + | |
| 515 | +class AtomicNoexcept { | |
| 516 | + final int atomicNoexcept; | |
| 517 | + | |
| 518 | + AtomicNoexcept({ | |
| 519 | + required this.atomicNoexcept, | |
| 520 | + }); | |
| 521 | + | |
| 522 | + factory AtomicNoexcept.fromJson(Map<String, dynamic> json) => AtomicNoexcept( | |
| 523 | + atomicNoexcept: json["atomic_noexcept"], | |
| 524 | + ); | |
| 525 | + | |
| 526 | + Map<String, dynamic> toJson() => { | |
| 527 | + "atomic_noexcept": atomicNoexcept, | |
| 528 | + }; | |
| 529 | +} | |
| 530 | + | |
| 531 | +class Auto { | |
| 532 | + final int auto; | |
| 533 | + | |
| 534 | + Auto({ | |
| 535 | + required this.auto, | |
| 536 | + }); | |
| 537 | + | |
| 538 | + factory Auto.fromJson(Map<String, dynamic> json) => Auto( | |
| 539 | + auto: json["auto"], | |
| 540 | + ); | |
| 541 | + | |
| 542 | + Map<String, dynamic> toJson() => { | |
| 543 | + "auto": auto, | |
| 544 | + }; | |
| 545 | +} | |
| 546 | + | |
| 547 | +class Base { | |
| 548 | + final int base; | |
| 549 | + | |
| 550 | + Base({ | |
| 551 | + required this.base, | |
| 552 | + }); | |
| 553 | + | |
| 554 | + factory Base.fromJson(Map<String, dynamic> json) => Base( | |
| 555 | + base: json["base"], | |
| 556 | + ); | |
| 557 | + | |
| 558 | + Map<String, dynamic> toJson() => { | |
| 559 | + "base": base, | |
| 560 | + }; | |
| 561 | +} | |
| 562 | + | |
| 563 | +class Bitand { | |
| 564 | + final int bitand; | |
| 565 | + | |
| 566 | + Bitand({ | |
| 567 | + required this.bitand, | |
| 568 | + }); | |
| 569 | + | |
| 570 | + factory Bitand.fromJson(Map<String, dynamic> json) => Bitand( | |
| 571 | + bitand: json["bitand"], | |
| 572 | + ); | |
| 573 | + | |
| 574 | + Map<String, dynamic> toJson() => { | |
| 575 | + "bitand": bitand, | |
| 576 | + }; | |
| 577 | +} | |
| 578 | + | |
| 579 | +class Bitor { | |
| 580 | + final int bitor; | |
| 581 | + | |
| 582 | + Bitor({ | |
| 583 | + required this.bitor, | |
| 584 | + }); | |
| 585 | + | |
| 586 | + factory Bitor.fromJson(Map<String, dynamic> json) => Bitor( | |
| 587 | + bitor: json["bitor"], | |
| 588 | + ); | |
| 589 | + | |
| 590 | + Map<String, dynamic> toJson() => { | |
| 591 | + "bitor": bitor, | |
| 592 | + }; | |
| 593 | +} | |
| 594 | + | |
| 595 | +class Boolean { | |
| 596 | + final int boolean; | |
| 597 | + | |
| 598 | + Boolean({ | |
| 599 | + required this.boolean, | |
| 600 | + }); | |
| 601 | + | |
| 602 | + factory Boolean.fromJson(Map<String, dynamic> json) => Boolean( | |
| 603 | + boolean: json["boolean"], | |
| 604 | + ); | |
| 605 | + | |
| 606 | + Map<String, dynamic> toJson() => { | |
| 607 | + "boolean": boolean, | |
| 608 | + }; | |
| 609 | +} | |
| 610 | + | |
| 611 | +class Bycopy { | |
| 612 | + final int bycopy; | |
| 613 | + | |
| 614 | + Bycopy({ | |
| 615 | + required this.bycopy, | |
| 616 | + }); | |
| 617 | + | |
| 618 | + factory Bycopy.fromJson(Map<String, dynamic> json) => Bycopy( | |
| 619 | + bycopy: json["bycopy"], | |
| 620 | + ); | |
| 621 | + | |
| 622 | + Map<String, dynamic> toJson() => { | |
| 623 | + "bycopy": bycopy, | |
| 624 | + }; | |
| 625 | +} | |
| 626 | + | |
| 627 | +class Byref { | |
| 628 | + final int byref; | |
| 629 | + | |
| 630 | + Byref({ | |
| 631 | + required this.byref, | |
| 632 | + }); | |
| 633 | + | |
| 634 | + factory Byref.fromJson(Map<String, dynamic> json) => Byref( | |
| 635 | + byref: json["byref"], | |
| 636 | + ); | |
| 637 | + | |
| 638 | + Map<String, dynamic> toJson() => { | |
| 639 | + "byref": byref, | |
| 640 | + }; | |
| 641 | +} | |
| 642 | + | |
| 643 | +class Byte { | |
| 644 | + final int byte; | |
| 645 | + | |
| 646 | + Byte({ | |
| 647 | + required this.byte, | |
| 648 | + }); | |
| 649 | + | |
| 650 | + factory Byte.fromJson(Map<String, dynamic> json) => Byte( | |
| 651 | + byte: json["byte"], | |
| 652 | + ); | |
| 653 | + | |
| 654 | + Map<String, dynamic> toJson() => { | |
| 655 | + "byte": byte, | |
| 656 | + }; | |
| 657 | +} | |
| 658 | + | |
| 659 | +class Chan { | |
| 660 | + final int chan; | |
| 661 | + | |
| 662 | + Chan({ | |
| 663 | + required this.chan, | |
| 664 | + }); | |
| 665 | + | |
| 666 | + factory Chan.fromJson(Map<String, dynamic> json) => Chan( | |
| 667 | + chan: json["chan"], | |
| 668 | + ); | |
| 669 | + | |
| 670 | + Map<String, dynamic> toJson() => { | |
| 671 | + "chan": chan, | |
| 672 | + }; | |
| 673 | +} | |
| 674 | + | |
| 675 | +class Char { | |
| 676 | + final int char; | |
| 677 | + | |
| 678 | + Char({ | |
| 679 | + required this.char, | |
| 680 | + }); | |
| 681 | + | |
| 682 | + factory Char.fromJson(Map<String, dynamic> json) => Char( | |
| 683 | + char: json["char"], | |
| 684 | + ); | |
| 685 | + | |
| 686 | + Map<String, dynamic> toJson() => { | |
| 687 | + "char": char, | |
| 688 | + }; | |
| 689 | +} | |
| 690 | + | |
| 691 | +class Char16T { | |
| 692 | + final int char16T; | |
| 693 | + | |
| 694 | + Char16T({ | |
| 695 | + required this.char16T, | |
| 696 | + }); | |
| 697 | + | |
| 698 | + factory Char16T.fromJson(Map<String, dynamic> json) => Char16T( | |
| 699 | + char16T: json["char16_t"], | |
| 700 | + ); | |
| 701 | + | |
| 702 | + Map<String, dynamic> toJson() => { | |
| 703 | + "char16_t": char16T, | |
| 704 | + }; | |
| 705 | +} | |
| 706 | + | |
| 707 | +class Char32T { | |
| 708 | + final int char32T; | |
| 709 | + | |
| 710 | + Char32T({ | |
| 711 | + required this.char32T, | |
| 712 | + }); | |
| 713 | + | |
| 714 | + factory Char32T.fromJson(Map<String, dynamic> json) => Char32T( | |
| 715 | + char32T: json["char32_t"], | |
| 716 | + ); | |
| 717 | + | |
| 718 | + Map<String, dynamic> toJson() => { | |
| 719 | + "char32_t": char32T, | |
| 720 | + }; | |
| 721 | +} | |
| 722 | + | |
| 723 | +class Checked { | |
| 724 | + final int checked; | |
| 725 | + | |
| 726 | + Checked({ | |
| 727 | + required this.checked, | |
| 728 | + }); | |
| 729 | + | |
| 730 | + factory Checked.fromJson(Map<String, dynamic> json) => Checked( | |
| 731 | + checked: json["checked"], | |
| 732 | + ); | |
| 733 | + | |
| 734 | + Map<String, dynamic> toJson() => { | |
| 735 | + "checked": checked, | |
| 736 | + }; | |
| 737 | +} | |
| 738 | + | |
| 739 | +class Clone { | |
| 740 | + final int clone; | |
| 741 | + | |
| 742 | + Clone({ | |
| 743 | + required this.clone, | |
| 744 | + }); | |
| 745 | + | |
| 746 | + factory Clone.fromJson(Map<String, dynamic> json) => Clone( | |
| 747 | + clone: json["clone"], | |
| 748 | + ); | |
| 749 | + | |
| 750 | + Map<String, dynamic> toJson() => { | |
| 751 | + "clone": clone, | |
| 752 | + }; | |
| 753 | +} | |
| 754 | + | |
| 755 | +class CoAwait { | |
| 756 | + final int coAwait; | |
| 757 | + | |
| 758 | + CoAwait({ | |
| 759 | + required this.coAwait, | |
| 760 | + }); | |
| 761 | + | |
| 762 | + factory CoAwait.fromJson(Map<String, dynamic> json) => CoAwait( | |
| 763 | + coAwait: json["co_await"], | |
| 764 | + ); | |
| 765 | + | |
| 766 | + Map<String, dynamic> toJson() => { | |
| 767 | + "co_await": coAwait, | |
| 768 | + }; | |
| 769 | +} | |
| 770 | + | |
| 771 | +class CoReturn { | |
| 772 | + final int coReturn; | |
| 773 | + | |
| 774 | + CoReturn({ | |
| 775 | + required this.coReturn, | |
| 776 | + }); | |
| 777 | + | |
| 778 | + factory CoReturn.fromJson(Map<String, dynamic> json) => CoReturn( | |
| 779 | + coReturn: json["co_return"], | |
| 780 | + ); | |
| 781 | + | |
| 782 | + Map<String, dynamic> toJson() => { | |
| 783 | + "co_return": coReturn, | |
| 784 | + }; | |
| 785 | +} | |
| 786 | + | |
| 787 | +class CoYield { | |
| 788 | + final int coYield; | |
| 789 | + | |
| 790 | + CoYield({ | |
| 791 | + required this.coYield, | |
| 792 | + }); | |
| 793 | + | |
| 794 | + factory CoYield.fromJson(Map<String, dynamic> json) => CoYield( | |
| 795 | + coYield: json["co_yield"], | |
| 796 | + ); | |
| 797 | + | |
| 798 | + Map<String, dynamic> toJson() => { | |
| 799 | + "co_yield": coYield, | |
| 800 | + }; | |
| 801 | +} | |
| 802 | + | |
| 803 | +class Compl { | |
| 804 | + final int compl; | |
| 805 | + | |
| 806 | + Compl({ | |
| 807 | + required this.compl, | |
| 808 | + }); | |
| 809 | + | |
| 810 | + factory Compl.fromJson(Map<String, dynamic> json) => Compl( | |
| 811 | + compl: json["compl"], | |
| 812 | + ); | |
| 813 | + | |
| 814 | + Map<String, dynamic> toJson() => { | |
| 815 | + "compl": compl, | |
| 816 | + }; | |
| 817 | +} | |
| 818 | + | |
| 819 | +class Complex { | |
| 820 | + final int complex; | |
| 821 | + | |
| 822 | + Complex({ | |
| 823 | + required this.complex, | |
| 824 | + }); | |
| 825 | + | |
| 826 | + factory Complex.fromJson(Map<String, dynamic> json) => Complex( | |
| 827 | + complex: json["_Complex"], | |
| 828 | + ); | |
| 829 | + | |
| 830 | + Map<String, dynamic> toJson() => { | |
| 831 | + "_Complex": complex, | |
| 832 | + }; | |
| 833 | +} | |
| 834 | + | |
| 835 | +class Concept { | |
| 836 | + final int concept; | |
| 837 | + | |
| 838 | + Concept({ | |
| 839 | + required this.concept, | |
| 840 | + }); | |
| 841 | + | |
| 842 | + factory Concept.fromJson(Map<String, dynamic> json) => Concept( | |
| 843 | + concept: json["concept"], | |
| 844 | + ); | |
| 845 | + | |
| 846 | + Map<String, dynamic> toJson() => { | |
| 847 | + "concept": concept, | |
| 848 | + }; | |
| 849 | +} | |
| 850 | + | |
| 851 | +class Console { | |
| 852 | + final int console; | |
| 853 | + | |
| 854 | + Console({ | |
| 855 | + required this.console, | |
| 856 | + }); | |
| 857 | + | |
| 858 | + factory Console.fromJson(Map<String, dynamic> json) => Console( | |
| 859 | + console: json["console"], | |
| 860 | + ); | |
| 861 | + | |
| 862 | + Map<String, dynamic> toJson() => { | |
| 863 | + "console": console, | |
| 864 | + }; | |
| 865 | +} | |
| 866 | + | |
| 867 | +class ConstCast { | |
| 868 | + final int constCast; | |
| 869 | + | |
| 870 | + ConstCast({ | |
| 871 | + required this.constCast, | |
| 872 | + }); | |
| 873 | + | |
| 874 | + factory ConstCast.fromJson(Map<String, dynamic> json) => ConstCast( | |
| 875 | + constCast: json["const_cast"], | |
| 876 | + ); | |
| 877 | + | |
| 878 | + Map<String, dynamic> toJson() => { | |
| 879 | + "const_cast": constCast, | |
| 880 | + }; | |
| 881 | +} | |
| 882 | + | |
| 883 | +class Constexpr { | |
| 884 | + final int constexpr; | |
| 885 | + | |
| 886 | + Constexpr({ | |
| 887 | + required this.constexpr, | |
| 888 | + }); | |
| 889 | + | |
| 890 | + factory Constexpr.fromJson(Map<String, dynamic> json) => Constexpr( | |
| 891 | + constexpr: json["constexpr"], | |
| 892 | + ); | |
| 893 | + | |
| 894 | + Map<String, dynamic> toJson() => { | |
| 895 | + "constexpr": constexpr, | |
| 896 | + }; | |
| 897 | +} | |
| 898 | + | |
| 899 | +class Constructor { | |
| 900 | + final int constructor; | |
| 901 | + | |
| 902 | + Constructor({ | |
| 903 | + required this.constructor, | |
| 904 | + }); | |
| 905 | + | |
| 906 | + factory Constructor.fromJson(Map<String, dynamic> json) => Constructor( | |
| 907 | + constructor: json["constructor"], | |
| 908 | + ); | |
| 909 | + | |
| 910 | + Map<String, dynamic> toJson() => { | |
| 911 | + "constructor": constructor, | |
| 912 | + }; | |
| 913 | +} | |
| 914 | + | |
| 915 | +class Convenience { | |
| 916 | + final int convenience; | |
| 917 | + | |
| 918 | + Convenience({ | |
| 919 | + required this.convenience, | |
| 920 | + }); | |
| 921 | + | |
| 922 | + factory Convenience.fromJson(Map<String, dynamic> json) => Convenience( | |
| 923 | + convenience: json["convenience"], | |
| 924 | + ); | |
| 925 | + | |
| 926 | + Map<String, dynamic> toJson() => { | |
| 927 | + "convenience": convenience, | |
| 928 | + }; | |
| 929 | +} | |
| 930 | + | |
| 931 | +class Convert { | |
| 932 | + final int convert; | |
| 933 | + | |
| 934 | + Convert({ | |
| 935 | + required this.convert, | |
| 936 | + }); | |
| 937 | + | |
| 938 | + factory Convert.fromJson(Map<String, dynamic> json) => Convert( | |
| 939 | + convert: json["convert"], | |
| 940 | + ); | |
| 941 | + | |
| 942 | + Map<String, dynamic> toJson() => { | |
| 943 | + "convert": convert, | |
| 944 | + }; | |
| 945 | +} | |
| 946 | + | |
| 947 | +class Converter { | |
| 948 | + final int converter; | |
| 949 | + | |
| 950 | + Converter({ | |
| 951 | + required this.converter, | |
| 952 | + }); | |
| 953 | + | |
| 954 | + factory Converter.fromJson(Map<String, dynamic> json) => Converter( | |
| 955 | + converter: json["converter"], | |
| 956 | + ); | |
| 957 | + | |
| 958 | + Map<String, dynamic> toJson() => { | |
| 959 | + "converter": converter, | |
| 960 | + }; | |
| 961 | +} | |
| 962 | + | |
| 963 | +class Date { | |
| 964 | + final int date; | |
| 965 | + | |
| 966 | + Date({ | |
| 967 | + required this.date, | |
| 968 | + }); | |
| 969 | + | |
| 970 | + factory Date.fromJson(Map<String, dynamic> json) => Date( | |
| 971 | + date: json["date"], | |
| 972 | + ); | |
| 973 | + | |
| 974 | + Map<String, dynamic> toJson() => { | |
| 975 | + "date": date, | |
| 976 | + }; | |
| 977 | +} | |
| 978 | + | |
| 979 | +class DateParseHandling { | |
| 980 | + final int dateParseHandling; | |
| 981 | + | |
| 982 | + DateParseHandling({ | |
| 983 | + required this.dateParseHandling, | |
| 984 | + }); | |
| 985 | + | |
| 986 | + factory DateParseHandling.fromJson(Map<String, dynamic> json) => DateParseHandling( | |
| 987 | + dateParseHandling: json["date_parse_handling"], | |
| 988 | + ); | |
| 989 | + | |
| 990 | + Map<String, dynamic> toJson() => { | |
| 991 | + "date_parse_handling": dateParseHandling, | |
| 992 | + }; | |
| 993 | +} | |
| 994 | + | |
| 995 | +class Debugger { | |
| 996 | + final int debugger; | |
| 997 | + | |
| 998 | + Debugger({ | |
| 999 | + required this.debugger, | |
| 1000 | + }); | |
| 1001 | + | |
| 1002 | + factory Debugger.fromJson(Map<String, dynamic> json) => Debugger( | |
| 1003 | + debugger: json["debugger"], | |
| 1004 | + ); | |
| 1005 | + | |
| 1006 | + Map<String, dynamic> toJson() => { | |
| 1007 | + "debugger": debugger, | |
| 1008 | + }; | |
| 1009 | +} | |
| 1010 | + | |
| 1011 | +class Decimal { | |
| 1012 | + final int decimal; | |
| 1013 | + | |
| 1014 | + Decimal({ | |
| 1015 | + required this.decimal, | |
| 1016 | + }); | |
| 1017 | + | |
| 1018 | + factory Decimal.fromJson(Map<String, dynamic> json) => Decimal( | |
| 1019 | + decimal: json["decimal"], | |
| 1020 | + ); | |
| 1021 | + | |
| 1022 | + Map<String, dynamic> toJson() => { | |
| 1023 | + "decimal": decimal, | |
| 1024 | + }; | |
| 1025 | +} | |
| 1026 | + | |
| 1027 | +class Declare { | |
| 1028 | + final int declare; | |
| 1029 | + | |
| 1030 | + Declare({ | |
| 1031 | + required this.declare, | |
| 1032 | + }); | |
| 1033 | + | |
| 1034 | + factory Declare.fromJson(Map<String, dynamic> json) => Declare( | |
| 1035 | + declare: json["declare"], | |
| 1036 | + ); | |
| 1037 | + | |
| 1038 | + Map<String, dynamic> toJson() => { | |
| 1039 | + "declare": declare, | |
| 1040 | + }; | |
| 1041 | +} | |
| 1042 | + | |
| 1043 | +class Decltype { | |
| 1044 | + final int decltype; | |
| 1045 | + | |
| 1046 | + Decltype({ | |
| 1047 | + required this.decltype, | |
| 1048 | + }); | |
| 1049 | + | |
| 1050 | + factory Decltype.fromJson(Map<String, dynamic> json) => Decltype( | |
| 1051 | + decltype: json["decltype"], | |
| 1052 | + ); | |
| 1053 | + | |
| 1054 | + Map<String, dynamic> toJson() => { | |
| 1055 | + "decltype": decltype, | |
| 1056 | + }; | |
| 1057 | +} | |
| 1058 | + | |
| 1059 | +class DecodeString { | |
| 1060 | + final int decodeString; | |
| 1061 | + | |
| 1062 | + DecodeString({ | |
| 1063 | + required this.decodeString, | |
| 1064 | + }); | |
| 1065 | + | |
| 1066 | + factory DecodeString.fromJson(Map<String, dynamic> json) => DecodeString( | |
| 1067 | + decodeString: json["decode_string"], | |
| 1068 | + ); | |
| 1069 | + | |
| 1070 | + Map<String, dynamic> toJson() => { | |
| 1071 | + "decode_string": decodeString, | |
| 1072 | + }; | |
| 1073 | +} | |
| 1074 | + | |
| 1075 | +class Empty { | |
| 1076 | + final int empty; | |
| 1077 | + | |
| 1078 | + Empty({ | |
| 1079 | + required this.empty, | |
| 1080 | + }); | |
| 1081 | + | |
| 1082 | + factory Empty.fromJson(Map<String, dynamic> json) => Empty( | |
| 1083 | + empty: json["_"], | |
| 1084 | + ); | |
| 1085 | + | |
| 1086 | + Map<String, dynamic> toJson() => { | |
| 1087 | + "_": empty, | |
| 1088 | + }; | |
| 1089 | +} | |
| 1090 | + | |
| 1091 | +class Obj1Bool { | |
| 1092 | + final int boolBool; | |
| 1093 | + | |
| 1094 | + Obj1Bool({ | |
| 1095 | + required this.boolBool, | |
| 1096 | + }); | |
| 1097 | + | |
| 1098 | + factory Obj1Bool.fromJson(Map<String, dynamic> json) => Obj1Bool( | |
| 1099 | + boolBool: json["bool"], | |
| 1100 | + ); | |
| 1101 | + | |
| 1102 | + Map<String, dynamic> toJson() => { | |
| 1103 | + "bool": boolBool, | |
| 1104 | + }; | |
| 1105 | +} | |
| 1106 | + | |
| 1107 | +class Imaginery { | |
| 1108 | + final int imaginery; | |
| 1109 | + | |
| 1110 | + Imaginery({ | |
| 1111 | + required this.imaginery, | |
| 1112 | + }); | |
| 1113 | + | |
| 1114 | + factory Imaginery.fromJson(Map<String, dynamic> json) => Imaginery( | |
| 1115 | + imaginery: json["_Imaginery"], | |
| 1116 | + ); | |
| 1117 | + | |
| 1118 | + Map<String, dynamic> toJson() => { | |
| 1119 | + "_Imaginery": imaginery, | |
| 1120 | + }; | |
| 1121 | +} | |
| 1122 | + | |
| 1123 | +class Abstract { | |
| 1124 | + final int abstractAbstract; | |
| 1125 | + | |
| 1126 | + Abstract({ | |
| 1127 | + required this.abstractAbstract, | |
| 1128 | + }); | |
| 1129 | + | |
| 1130 | + factory Abstract.fromJson(Map<String, dynamic> json) => Abstract( | |
| 1131 | + abstractAbstract: json["abstract"], | |
| 1132 | + ); | |
| 1133 | + | |
| 1134 | + Map<String, dynamic> toJson() => { | |
| 1135 | + "abstract": abstractAbstract, | |
| 1136 | + }; | |
| 1137 | +} | |
| 1138 | + | |
| 1139 | +class AnyClass { | |
| 1140 | + final int any; | |
| 1141 | + | |
| 1142 | + AnyClass({ | |
| 1143 | + required this.any, | |
| 1144 | + }); | |
| 1145 | + | |
| 1146 | + factory AnyClass.fromJson(Map<String, dynamic> json) => AnyClass( | |
| 1147 | + any: json["any"], | |
| 1148 | + ); | |
| 1149 | + | |
| 1150 | + Map<String, dynamic> toJson() => { | |
| 1151 | + "any": any, | |
| 1152 | + }; | |
| 1153 | +} | |
| 1154 | + | |
| 1155 | +class As { | |
| 1156 | + final int asAs; | |
| 1157 | + | |
| 1158 | + As({ | |
| 1159 | + required this.asAs, | |
| 1160 | + }); | |
| 1161 | + | |
| 1162 | + factory As.fromJson(Map<String, dynamic> json) => As( | |
| 1163 | + asAs: json["as"], | |
| 1164 | + ); | |
| 1165 | + | |
| 1166 | + Map<String, dynamic> toJson() => { | |
| 1167 | + "as": asAs, | |
| 1168 | + }; | |
| 1169 | +} | |
| 1170 | + | |
| 1171 | +class Assert { | |
| 1172 | + final int assertAssert; | |
| 1173 | + | |
| 1174 | + Assert({ | |
| 1175 | + required this.assertAssert, | |
| 1176 | + }); | |
| 1177 | + | |
| 1178 | + factory Assert.fromJson(Map<String, dynamic> json) => Assert( | |
| 1179 | + assertAssert: json["assert"], | |
| 1180 | + ); | |
| 1181 | + | |
| 1182 | + Map<String, dynamic> toJson() => { | |
| 1183 | + "assert": assertAssert, | |
| 1184 | + }; | |
| 1185 | +} | |
| 1186 | + | |
| 1187 | +class Async { | |
| 1188 | + final int asyncAsync; | |
| 1189 | + | |
| 1190 | + Async({ | |
| 1191 | + required this.asyncAsync, | |
| 1192 | + }); | |
| 1193 | + | |
| 1194 | + factory Async.fromJson(Map<String, dynamic> json) => Async( | |
| 1195 | + asyncAsync: json["async"], | |
| 1196 | + ); | |
| 1197 | + | |
| 1198 | + Map<String, dynamic> toJson() => { | |
| 1199 | + "async": asyncAsync, | |
| 1200 | + }; | |
| 1201 | +} | |
| 1202 | + | |
| 1203 | +class Await { | |
| 1204 | + final int awaitAwait; | |
| 1205 | + | |
| 1206 | + Await({ | |
| 1207 | + required this.awaitAwait, | |
| 1208 | + }); | |
| 1209 | + | |
| 1210 | + factory Await.fromJson(Map<String, dynamic> json) => Await( | |
| 1211 | + awaitAwait: json["await"], | |
| 1212 | + ); | |
| 1213 | + | |
| 1214 | + Map<String, dynamic> toJson() => { | |
| 1215 | + "await": awaitAwait, | |
| 1216 | + }; | |
| 1217 | +} | |
| 1218 | + | |
| 1219 | +class Bool { | |
| 1220 | + final int boolBool; | |
| 1221 | + | |
| 1222 | + Bool({ | |
| 1223 | + required this.boolBool, | |
| 1224 | + }); | |
| 1225 | + | |
| 1226 | + factory Bool.fromJson(Map<String, dynamic> json) => Bool( | |
| 1227 | + boolBool: json["BOOL"], | |
| 1228 | + ); | |
| 1229 | + | |
| 1230 | + Map<String, dynamic> toJson() => { | |
| 1231 | + "BOOL": boolBool, | |
| 1232 | + }; | |
| 1233 | +} | |
| 1234 | + | |
| 1235 | +class Break { | |
| 1236 | + final int breakBreak; | |
| 1237 | + | |
| 1238 | + Break({ | |
| 1239 | + required this.breakBreak, | |
| 1240 | + }); | |
| 1241 | + | |
| 1242 | + factory Break.fromJson(Map<String, dynamic> json) => Break( | |
| 1243 | + breakBreak: json["break"], | |
| 1244 | + ); | |
| 1245 | + | |
| 1246 | + Map<String, dynamic> toJson() => { | |
| 1247 | + "break": breakBreak, | |
| 1248 | + }; | |
| 1249 | +} | |
| 1250 | + | |
| 1251 | +class Case { | |
| 1252 | + final int caseCase; | |
| 1253 | + | |
| 1254 | + Case({ | |
| 1255 | + required this.caseCase, | |
| 1256 | + }); | |
| 1257 | + | |
| 1258 | + factory Case.fromJson(Map<String, dynamic> json) => Case( | |
| 1259 | + caseCase: json["case"], | |
| 1260 | + ); | |
| 1261 | + | |
| 1262 | + Map<String, dynamic> toJson() => { | |
| 1263 | + "case": caseCase, | |
| 1264 | + }; | |
| 1265 | +} | |
| 1266 | + | |
| 1267 | +class Catch { | |
| 1268 | + final int catchCatch; | |
| 1269 | + | |
| 1270 | + Catch({ | |
| 1271 | + required this.catchCatch, | |
| 1272 | + }); | |
| 1273 | + | |
| 1274 | + factory Catch.fromJson(Map<String, dynamic> json) => Catch( | |
| 1275 | + catchCatch: json["catch"], | |
| 1276 | + ); | |
| 1277 | + | |
| 1278 | + Map<String, dynamic> toJson() => { | |
| 1279 | + "catch": catchCatch, | |
| 1280 | + }; | |
| 1281 | +} | |
| 1282 | + | |
| 1283 | +class Class { | |
| 1284 | + final int classClass; | |
| 1285 | + | |
| 1286 | + Class({ | |
| 1287 | + required this.classClass, | |
| 1288 | + }); | |
| 1289 | + | |
| 1290 | + factory Class.fromJson(Map<String, dynamic> json) => Class( | |
| 1291 | + classClass: json["Class"], | |
| 1292 | + ); | |
| 1293 | + | |
| 1294 | + Map<String, dynamic> toJson() => { | |
| 1295 | + "Class": classClass, | |
| 1296 | + }; | |
| 1297 | +} | |
| 1298 | + | |
| 1299 | +class Const { | |
| 1300 | + final int constConst; | |
| 1301 | + | |
| 1302 | + Const({ | |
| 1303 | + required this.constConst, | |
| 1304 | + }); | |
| 1305 | + | |
| 1306 | + factory Const.fromJson(Map<String, dynamic> json) => Const( | |
| 1307 | + constConst: json["const"], | |
| 1308 | + ); | |
| 1309 | + | |
| 1310 | + Map<String, dynamic> toJson() => { | |
| 1311 | + "const": constConst, | |
| 1312 | + }; | |
| 1313 | +} | |
| 1314 | + | |
| 1315 | +class Continue { | |
| 1316 | + final int continueContinue; | |
| 1317 | + | |
| 1318 | + Continue({ | |
| 1319 | + required this.continueContinue, | |
| 1320 | + }); | |
| 1321 | + | |
| 1322 | + factory Continue.fromJson(Map<String, dynamic> json) => Continue( | |
| 1323 | + continueContinue: json["continue"], | |
| 1324 | + ); | |
| 1325 | + | |
| 1326 | + Map<String, dynamic> toJson() => { | |
| 1327 | + "continue": continueContinue, | |
| 1328 | + }; | |
| 1329 | +} | |
| 1330 | + | |
| 1331 | +class BoolClass { | |
| 1332 | + final int boolBool; | |
| 1333 | + | |
| 1334 | + BoolClass({ | |
| 1335 | + required this.boolBool, | |
| 1336 | + }); | |
| 1337 | + | |
| 1338 | + factory BoolClass.fromJson(Map<String, dynamic> json) => BoolClass( | |
| 1339 | + boolBool: json["_Bool"], | |
| 1340 | + ); | |
| 1341 | + | |
| 1342 | + Map<String, dynamic> toJson() => { | |
| 1343 | + "_Bool": boolBool, | |
| 1344 | + }; | |
| 1345 | +} | |
| 1346 | + | |
| 1347 | +class ClassClass { | |
| 1348 | + final int classClass; | |
| 1349 | + | |
| 1350 | + ClassClass({ | |
| 1351 | + required this.classClass, | |
| 1352 | + }); | |
| 1353 | + | |
| 1354 | + factory ClassClass.fromJson(Map<String, dynamic> json) => ClassClass( | |
| 1355 | + classClass: json["class"], | |
| 1356 | + ); | |
| 1357 | + | |
| 1358 | + Map<String, dynamic> toJson() => { | |
| 1359 | + "class": classClass, | |
| 1360 | + }; | |
| 1361 | +} | |
| 1362 | + | |
| 1363 | +class Obj2 { | |
| 1364 | + final Def def; | |
| 1365 | + final Defer defer; | |
| 1366 | + final Deinit deinit; | |
| 1367 | + final Del del; | |
| 1368 | + final Delegate delegate; | |
| 1369 | + final Delete delete; | |
| 1370 | + final Dict dict; | |
| 1371 | + final Dictionary dictionary; | |
| 1372 | + final DidSet didSet; | |
| 1373 | + final int dummy; | |
| 1374 | + final DynamicCast dynamicCast; | |
| 1375 | + final Elif elif; | |
| 1376 | + final EncodeQuickType encodeQuickType; | |
| 1377 | + final EqualityContract equalityContract; | |
| 1378 | + final Event event; | |
| 1379 | + final Except except; | |
| 1380 | + final Exception exception; | |
| 1381 | + final Explicit explicit; | |
| 1382 | + final Exposing exposing; | |
| 1383 | + final Extension extension; | |
| 1384 | + final Extern extern; | |
| 1385 | + final Fallthrough fallthrough; | |
| 1386 | + final Fileprivate fileprivate; | |
| 1387 | + final Fixed fixed; | |
| 1388 | + final Float float; | |
| 1389 | + final Foreach foreach; | |
| 1390 | + final Friend friend; | |
| 1391 | + final From from; | |
| 1392 | + final Func func; | |
| 1393 | + final FunctionClass function; | |
| 1394 | + final Global global; | |
| 1395 | + final Go go; | |
| 1396 | + final Goto goto; | |
| 1397 | + final Guard guard; | |
| 1398 | + final HasOwnProperty hasOwnProperty; | |
| 1399 | + final Id id; | |
| 1400 | + final Imp imp; | |
| 1401 | + final Implicit implicit; | |
| 1402 | + final Indirect indirect; | |
| 1403 | + final Infix infix; | |
| 1404 | + final Init init; | |
| 1405 | + final Inline inline; | |
| 1406 | + final Inout inout; | |
| 1407 | + final Instanceof instanceof; | |
| 1408 | + final Internal internal; | |
| 1409 | + final Default obj2Default; | |
| 1410 | + final Do obj2Do; | |
| 1411 | + final Double obj2Double; | |
| 1412 | + final Dynamic obj2Dynamic; | |
| 1413 | + final Else obj2Else; | |
| 1414 | + final Enum obj2Enum; | |
| 1415 | + final Export obj2Export; | |
| 1416 | + final Extends obj2Extends; | |
| 1417 | + final False obj2False; | |
| 1418 | + final Final obj2Final; | |
| 1419 | + final Finally obj2Finally; | |
| 1420 | + final For obj2For; | |
| 1421 | + final FromJson obj2FromJson; | |
| 1422 | + final Get obj2Get; | |
| 1423 | + final If obj2If; | |
| 1424 | + final Implements obj2Implements; | |
| 1425 | + final Import obj2Import; | |
| 1426 | + final In obj2In; | |
| 1427 | + final Int obj2Int; | |
| 1428 | + final Interface obj2Interface; | |
| 1429 | + final FalseClass purpleFalse; | |
| 1430 | + | |
| 1431 | + Obj2({ | |
| 1432 | + required this.def, | |
| 1433 | + required this.defer, | |
| 1434 | + required this.deinit, | |
| 1435 | + required this.del, | |
| 1436 | + required this.delegate, | |
| 1437 | + required this.delete, | |
| 1438 | + required this.dict, | |
| 1439 | + required this.dictionary, | |
| 1440 | + required this.didSet, | |
| 1441 | + required this.dummy, | |
| 1442 | + required this.dynamicCast, | |
| 1443 | + required this.elif, | |
| 1444 | + required this.encodeQuickType, | |
| 1445 | + required this.equalityContract, | |
| 1446 | + required this.event, | |
| 1447 | + required this.except, | |
| 1448 | + required this.exception, | |
| 1449 | + required this.explicit, | |
| 1450 | + required this.exposing, | |
| 1451 | + required this.extension, | |
| 1452 | + required this.extern, | |
| 1453 | + required this.fallthrough, | |
| 1454 | + required this.fileprivate, | |
| 1455 | + required this.fixed, | |
| 1456 | + required this.float, | |
| 1457 | + required this.foreach, | |
| 1458 | + required this.friend, | |
| 1459 | + required this.from, | |
| 1460 | + required this.func, | |
| 1461 | + required this.function, | |
| 1462 | + required this.global, | |
| 1463 | + required this.go, | |
| 1464 | + required this.goto, | |
| 1465 | + required this.guard, | |
| 1466 | + required this.hasOwnProperty, | |
| 1467 | + required this.id, | |
| 1468 | + required this.imp, | |
| 1469 | + required this.implicit, | |
| 1470 | + required this.indirect, | |
| 1471 | + required this.infix, | |
| 1472 | + required this.init, | |
| 1473 | + required this.inline, | |
| 1474 | + required this.inout, | |
| 1475 | + required this.instanceof, | |
| 1476 | + required this.internal, | |
| 1477 | + required this.obj2Default, | |
| 1478 | + required this.obj2Do, | |
| 1479 | + required this.obj2Double, | |
| 1480 | + required this.obj2Dynamic, | |
| 1481 | + required this.obj2Else, | |
| 1482 | + required this.obj2Enum, | |
| 1483 | + required this.obj2Export, | |
| 1484 | + required this.obj2Extends, | |
| 1485 | + required this.obj2False, | |
| 1486 | + required this.obj2Final, | |
| 1487 | + required this.obj2Finally, | |
| 1488 | + required this.obj2For, | |
| 1489 | + required this.obj2FromJson, | |
| 1490 | + required this.obj2Get, | |
| 1491 | + required this.obj2If, | |
| 1492 | + required this.obj2Implements, | |
| 1493 | + required this.obj2Import, | |
| 1494 | + required this.obj2In, | |
| 1495 | + required this.obj2Int, | |
| 1496 | + required this.obj2Interface, | |
| 1497 | + required this.purpleFalse, | |
| 1498 | + }); | |
| 1499 | + | |
| 1500 | + factory Obj2.fromJson(Map<String, dynamic> json) => Obj2( | |
| 1501 | + def: Def.fromJson(json["def"]), | |
| 1502 | + defer: Defer.fromJson(json["defer"]), | |
| 1503 | + deinit: Deinit.fromJson(json["deinit"]), | |
| 1504 | + del: Del.fromJson(json["del"]), | |
| 1505 | + delegate: Delegate.fromJson(json["delegate"]), | |
| 1506 | + delete: Delete.fromJson(json["delete"]), | |
| 1507 | + dict: Dict.fromJson(json["dict"]), | |
| 1508 | + dictionary: Dictionary.fromJson(json["dictionary"]), | |
| 1509 | + didSet: DidSet.fromJson(json["didSet"]), | |
| 1510 | + dummy: json["dummy"], | |
| 1511 | + dynamicCast: DynamicCast.fromJson(json["dynamic_cast"]), | |
| 1512 | + elif: Elif.fromJson(json["elif"]), | |
| 1513 | + encodeQuickType: EncodeQuickType.fromJson(json["encode_quick_type"]), | |
| 1514 | + equalityContract: EqualityContract.fromJson(json["equalityContract"]), | |
| 1515 | + event: Event.fromJson(json["event"]), | |
| 1516 | + except: Except.fromJson(json["except"]), | |
| 1517 | + exception: Exception.fromJson(json["exception"]), | |
| 1518 | + explicit: Explicit.fromJson(json["explicit"]), | |
| 1519 | + exposing: Exposing.fromJson(json["exposing"]), | |
| 1520 | + extension: Extension.fromJson(json["extension"]), | |
| 1521 | + extern: Extern.fromJson(json["extern"]), | |
| 1522 | + fallthrough: Fallthrough.fromJson(json["fallthrough"]), | |
| 1523 | + fileprivate: Fileprivate.fromJson(json["fileprivate"]), | |
| 1524 | + fixed: Fixed.fromJson(json["fixed"]), | |
| 1525 | + float: Float.fromJson(json["float"]), | |
| 1526 | + foreach: Foreach.fromJson(json["foreach"]), | |
| 1527 | + friend: Friend.fromJson(json["friend"]), | |
| 1528 | + from: From.fromJson(json["from"]), | |
| 1529 | + func: Func.fromJson(json["func"]), | |
| 1530 | + function: FunctionClass.fromJson(json["function"]), | |
| 1531 | + global: Global.fromJson(json["global"]), | |
| 1532 | + go: Go.fromJson(json["go"]), | |
| 1533 | + goto: Goto.fromJson(json["goto"]), | |
| 1534 | + guard: Guard.fromJson(json["guard"]), | |
| 1535 | + hasOwnProperty: HasOwnProperty.fromJson(json["hasOwnProperty"]), | |
| 1536 | + id: Id.fromJson(json["id"]), | |
| 1537 | + imp: Imp.fromJson(json["IMP"]), | |
| 1538 | + implicit: Implicit.fromJson(json["implicit"]), | |
| 1539 | + indirect: Indirect.fromJson(json["indirect"]), | |
| 1540 | + infix: Infix.fromJson(json["infix"]), | |
| 1541 | + init: Init.fromJson(json["init"]), | |
| 1542 | + inline: Inline.fromJson(json["inline"]), | |
| 1543 | + inout: Inout.fromJson(json["inout"]), | |
| 1544 | + instanceof: Instanceof.fromJson(json["instanceof"]), | |
| 1545 | + internal: Internal.fromJson(json["internal"]), | |
| 1546 | + obj2Default: Default.fromJson(json["default"]), | |
| 1547 | + obj2Do: Do.fromJson(json["do"]), | |
| 1548 | + obj2Double: Double.fromJson(json["double"]), | |
| 1549 | + obj2Dynamic: Dynamic.fromJson(json["dynamic"]), | |
| 1550 | + obj2Else: Else.fromJson(json["else"]), | |
| 1551 | + obj2Enum: Enum.fromJson(json["enum"]), | |
| 1552 | + obj2Export: Export.fromJson(json["export"]), | |
| 1553 | + obj2Extends: Extends.fromJson(json["extends"]), | |
| 1554 | + obj2False: False.fromJson(json["False"]), | |
| 1555 | + obj2Final: Final.fromJson(json["final"]), | |
| 1556 | + obj2Finally: Finally.fromJson(json["finally"]), | |
| 1557 | + obj2For: For.fromJson(json["for"]), | |
| 1558 | + obj2FromJson: FromJson.fromJson(json["from_json"]), | |
| 1559 | + obj2Get: Get.fromJson(json["get"]), | |
| 1560 | + obj2If: If.fromJson(json["if"]), | |
| 1561 | + obj2Implements: Implements.fromJson(json["implements"]), | |
| 1562 | + obj2Import: Import.fromJson(json["import"]), | |
| 1563 | + obj2In: In.fromJson(json["in"]), | |
| 1564 | + obj2Int: Int.fromJson(json["int"]), | |
| 1565 | + obj2Interface: Interface.fromJson(json["interface"]), | |
| 1566 | + purpleFalse: FalseClass.fromJson(json["false"]), | |
| 1567 | + ); | |
| 1568 | + | |
| 1569 | + Map<String, dynamic> toJson() => { | |
| 1570 | + "def": def.toJson(), | |
| 1571 | + "defer": defer.toJson(), | |
| 1572 | + "deinit": deinit.toJson(), | |
| 1573 | + "del": del.toJson(), | |
| 1574 | + "delegate": delegate.toJson(), | |
| 1575 | + "delete": delete.toJson(), | |
| 1576 | + "dict": dict.toJson(), | |
| 1577 | + "dictionary": dictionary.toJson(), | |
| 1578 | + "didSet": didSet.toJson(), | |
| 1579 | + "dummy": dummy, | |
| 1580 | + "dynamic_cast": dynamicCast.toJson(), | |
| 1581 | + "elif": elif.toJson(), | |
| 1582 | + "encode_quick_type": encodeQuickType.toJson(), | |
| 1583 | + "equalityContract": equalityContract.toJson(), | |
| 1584 | + "event": event.toJson(), | |
| 1585 | + "except": except.toJson(), | |
| 1586 | + "exception": exception.toJson(), | |
| 1587 | + "explicit": explicit.toJson(), | |
| 1588 | + "exposing": exposing.toJson(), | |
| 1589 | + "extension": extension.toJson(), | |
| 1590 | + "extern": extern.toJson(), | |
| 1591 | + "fallthrough": fallthrough.toJson(), | |
| 1592 | + "fileprivate": fileprivate.toJson(), | |
| 1593 | + "fixed": fixed.toJson(), | |
| 1594 | + "float": float.toJson(), | |
| 1595 | + "foreach": foreach.toJson(), | |
| 1596 | + "friend": friend.toJson(), | |
| 1597 | + "from": from.toJson(), | |
| 1598 | + "func": func.toJson(), | |
| 1599 | + "function": function.toJson(), | |
| 1600 | + "global": global.toJson(), | |
| 1601 | + "go": go.toJson(), | |
| 1602 | + "goto": goto.toJson(), | |
| 1603 | + "guard": guard.toJson(), | |
| 1604 | + "hasOwnProperty": hasOwnProperty.toJson(), | |
| 1605 | + "id": id.toJson(), | |
| 1606 | + "IMP": imp.toJson(), | |
| 1607 | + "implicit": implicit.toJson(), | |
| 1608 | + "indirect": indirect.toJson(), | |
| 1609 | + "infix": infix.toJson(), | |
| 1610 | + "init": init.toJson(), | |
| 1611 | + "inline": inline.toJson(), | |
| 1612 | + "inout": inout.toJson(), | |
| 1613 | + "instanceof": instanceof.toJson(), | |
| 1614 | + "internal": internal.toJson(), | |
| 1615 | + "default": obj2Default.toJson(), | |
| 1616 | + "do": obj2Do.toJson(), | |
| 1617 | + "double": obj2Double.toJson(), | |
| 1618 | + "dynamic": obj2Dynamic.toJson(), | |
| 1619 | + "else": obj2Else.toJson(), | |
| 1620 | + "enum": obj2Enum.toJson(), | |
| 1621 | + "export": obj2Export.toJson(), | |
| 1622 | + "extends": obj2Extends.toJson(), | |
| 1623 | + "False": obj2False.toJson(), | |
| 1624 | + "final": obj2Final.toJson(), | |
| 1625 | + "finally": obj2Finally.toJson(), | |
| 1626 | + "for": obj2For.toJson(), | |
| 1627 | + "from_json": obj2FromJson.toJson(), | |
| 1628 | + "get": obj2Get.toJson(), | |
| 1629 | + "if": obj2If.toJson(), | |
| 1630 | + "implements": obj2Implements.toJson(), | |
| 1631 | + "import": obj2Import.toJson(), | |
| 1632 | + "in": obj2In.toJson(), | |
| 1633 | + "int": obj2Int.toJson(), | |
| 1634 | + "interface": obj2Interface.toJson(), | |
| 1635 | + "false": purpleFalse.toJson(), | |
| 1636 | + }; | |
| 1637 | +} | |
| 1638 | + | |
| 1639 | +class Def { | |
| 1640 | + final int def; | |
| 1641 | + | |
| 1642 | + Def({ | |
| 1643 | + required this.def, | |
| 1644 | + }); | |
| 1645 | + | |
| 1646 | + factory Def.fromJson(Map<String, dynamic> json) => Def( | |
| 1647 | + def: json["def"], | |
| 1648 | + ); | |
| 1649 | + | |
| 1650 | + Map<String, dynamic> toJson() => { | |
| 1651 | + "def": def, | |
| 1652 | + }; | |
| 1653 | +} | |
| 1654 | + | |
| 1655 | +class Defer { | |
| 1656 | + final int defer; | |
| 1657 | + | |
| 1658 | + Defer({ | |
| 1659 | + required this.defer, | |
| 1660 | + }); | |
| 1661 | + | |
| 1662 | + factory Defer.fromJson(Map<String, dynamic> json) => Defer( | |
| 1663 | + defer: json["defer"], | |
| 1664 | + ); | |
| 1665 | + | |
| 1666 | + Map<String, dynamic> toJson() => { | |
| 1667 | + "defer": defer, | |
| 1668 | + }; | |
| 1669 | +} | |
| 1670 | + | |
| 1671 | +class Deinit { | |
| 1672 | + final int deinit; | |
| 1673 | + | |
| 1674 | + Deinit({ | |
| 1675 | + required this.deinit, | |
| 1676 | + }); | |
| 1677 | + | |
| 1678 | + factory Deinit.fromJson(Map<String, dynamic> json) => Deinit( | |
| 1679 | + deinit: json["deinit"], | |
| 1680 | + ); | |
| 1681 | + | |
| 1682 | + Map<String, dynamic> toJson() => { | |
| 1683 | + "deinit": deinit, | |
| 1684 | + }; | |
| 1685 | +} | |
| 1686 | + | |
| 1687 | +class Del { | |
| 1688 | + final int del; | |
| 1689 | + | |
| 1690 | + Del({ | |
| 1691 | + required this.del, | |
| 1692 | + }); | |
| 1693 | + | |
| 1694 | + factory Del.fromJson(Map<String, dynamic> json) => Del( | |
| 1695 | + del: json["del"], | |
| 1696 | + ); | |
| 1697 | + | |
| 1698 | + Map<String, dynamic> toJson() => { | |
| 1699 | + "del": del, | |
| 1700 | + }; | |
| 1701 | +} | |
| 1702 | + | |
| 1703 | +class Delegate { | |
| 1704 | + final int delegate; | |
| 1705 | + | |
| 1706 | + Delegate({ | |
| 1707 | + required this.delegate, | |
| 1708 | + }); | |
| 1709 | + | |
| 1710 | + factory Delegate.fromJson(Map<String, dynamic> json) => Delegate( | |
| 1711 | + delegate: json["delegate"], | |
| 1712 | + ); | |
| 1713 | + | |
| 1714 | + Map<String, dynamic> toJson() => { | |
| 1715 | + "delegate": delegate, | |
| 1716 | + }; | |
| 1717 | +} | |
| 1718 | + | |
| 1719 | +class Delete { | |
| 1720 | + final int delete; | |
| 1721 | + | |
| 1722 | + Delete({ | |
| 1723 | + required this.delete, | |
| 1724 | + }); | |
| 1725 | + | |
| 1726 | + factory Delete.fromJson(Map<String, dynamic> json) => Delete( | |
| 1727 | + delete: json["delete"], | |
| 1728 | + ); | |
| 1729 | + | |
| 1730 | + Map<String, dynamic> toJson() => { | |
| 1731 | + "delete": delete, | |
| 1732 | + }; | |
| 1733 | +} | |
| 1734 | + | |
| 1735 | +class Dict { | |
| 1736 | + final int dict; | |
| 1737 | + | |
| 1738 | + Dict({ | |
| 1739 | + required this.dict, | |
| 1740 | + }); | |
| 1741 | + | |
| 1742 | + factory Dict.fromJson(Map<String, dynamic> json) => Dict( | |
| 1743 | + dict: json["dict"], | |
| 1744 | + ); | |
| 1745 | + | |
| 1746 | + Map<String, dynamic> toJson() => { | |
| 1747 | + "dict": dict, | |
| 1748 | + }; | |
| 1749 | +} | |
| 1750 | + | |
| 1751 | +class Dictionary { | |
| 1752 | + final int dictionary; | |
| 1753 | + | |
| 1754 | + Dictionary({ | |
| 1755 | + required this.dictionary, | |
| 1756 | + }); | |
| 1757 | + | |
| 1758 | + factory Dictionary.fromJson(Map<String, dynamic> json) => Dictionary( | |
| 1759 | + dictionary: json["dictionary"], | |
| 1760 | + ); | |
| 1761 | + | |
| 1762 | + Map<String, dynamic> toJson() => { | |
| 1763 | + "dictionary": dictionary, | |
| 1764 | + }; | |
| 1765 | +} | |
| 1766 | + | |
| 1767 | +class DidSet { | |
| 1768 | + final int didSet; | |
| 1769 | + | |
| 1770 | + DidSet({ | |
| 1771 | + required this.didSet, | |
| 1772 | + }); | |
| 1773 | + | |
| 1774 | + factory DidSet.fromJson(Map<String, dynamic> json) => DidSet( | |
| 1775 | + didSet: json["didSet"], | |
| 1776 | + ); | |
| 1777 | + | |
| 1778 | + Map<String, dynamic> toJson() => { | |
| 1779 | + "didSet": didSet, | |
| 1780 | + }; | |
| 1781 | +} | |
| 1782 | + | |
| 1783 | +class DynamicCast { | |
| 1784 | + final int dynamicCast; | |
| 1785 | + | |
| 1786 | + DynamicCast({ | |
| 1787 | + required this.dynamicCast, | |
| 1788 | + }); | |
| 1789 | + | |
| 1790 | + factory DynamicCast.fromJson(Map<String, dynamic> json) => DynamicCast( | |
| 1791 | + dynamicCast: json["dynamic_cast"], | |
| 1792 | + ); | |
| 1793 | + | |
| 1794 | + Map<String, dynamic> toJson() => { | |
| 1795 | + "dynamic_cast": dynamicCast, | |
| 1796 | + }; | |
| 1797 | +} | |
| 1798 | + | |
| 1799 | +class Elif { | |
| 1800 | + final int elif; | |
| 1801 | + | |
| 1802 | + Elif({ | |
| 1803 | + required this.elif, | |
| 1804 | + }); | |
| 1805 | + | |
| 1806 | + factory Elif.fromJson(Map<String, dynamic> json) => Elif( | |
| 1807 | + elif: json["elif"], | |
| 1808 | + ); | |
| 1809 | + | |
| 1810 | + Map<String, dynamic> toJson() => { | |
| 1811 | + "elif": elif, | |
| 1812 | + }; | |
| 1813 | +} | |
| 1814 | + | |
| 1815 | +class EncodeQuickType { | |
| 1816 | + final int encodeQuickType; | |
| 1817 | + | |
| 1818 | + EncodeQuickType({ | |
| 1819 | + required this.encodeQuickType, | |
| 1820 | + }); | |
| 1821 | + | |
| 1822 | + factory EncodeQuickType.fromJson(Map<String, dynamic> json) => EncodeQuickType( | |
| 1823 | + encodeQuickType: json["encode_quick_type"], | |
| 1824 | + ); | |
| 1825 | + | |
| 1826 | + Map<String, dynamic> toJson() => { | |
| 1827 | + "encode_quick_type": encodeQuickType, | |
| 1828 | + }; | |
| 1829 | +} | |
| 1830 | + | |
| 1831 | +class EqualityContract { | |
| 1832 | + final int equalityContract; | |
| 1833 | + | |
| 1834 | + EqualityContract({ | |
| 1835 | + required this.equalityContract, | |
| 1836 | + }); | |
| 1837 | + | |
| 1838 | + factory EqualityContract.fromJson(Map<String, dynamic> json) => EqualityContract( | |
| 1839 | + equalityContract: json["equalityContract"], | |
| 1840 | + ); | |
| 1841 | + | |
| 1842 | + Map<String, dynamic> toJson() => { | |
| 1843 | + "equalityContract": equalityContract, | |
| 1844 | + }; | |
| 1845 | +} | |
| 1846 | + | |
| 1847 | +class Event { | |
| 1848 | + final int event; | |
| 1849 | + | |
| 1850 | + Event({ | |
| 1851 | + required this.event, | |
| 1852 | + }); | |
| 1853 | + | |
| 1854 | + factory Event.fromJson(Map<String, dynamic> json) => Event( | |
| 1855 | + event: json["event"], | |
| 1856 | + ); | |
| 1857 | + | |
| 1858 | + Map<String, dynamic> toJson() => { | |
| 1859 | + "event": event, | |
| 1860 | + }; | |
| 1861 | +} | |
| 1862 | + | |
| 1863 | +class Except { | |
| 1864 | + final int except; | |
| 1865 | + | |
| 1866 | + Except({ | |
| 1867 | + required this.except, | |
| 1868 | + }); | |
| 1869 | + | |
| 1870 | + factory Except.fromJson(Map<String, dynamic> json) => Except( | |
| 1871 | + except: json["except"], | |
| 1872 | + ); | |
| 1873 | + | |
| 1874 | + Map<String, dynamic> toJson() => { | |
| 1875 | + "except": except, | |
| 1876 | + }; | |
| 1877 | +} | |
| 1878 | + | |
| 1879 | +class Exception { | |
| 1880 | + final int exception; | |
| 1881 | + | |
| 1882 | + Exception({ | |
| 1883 | + required this.exception, | |
| 1884 | + }); | |
| 1885 | + | |
| 1886 | + factory Exception.fromJson(Map<String, dynamic> json) => Exception( | |
| 1887 | + exception: json["exception"], | |
| 1888 | + ); | |
| 1889 | + | |
| 1890 | + Map<String, dynamic> toJson() => { | |
| 1891 | + "exception": exception, | |
| 1892 | + }; | |
| 1893 | +} | |
| 1894 | + | |
| 1895 | +class Explicit { | |
| 1896 | + final int explicit; | |
| 1897 | + | |
| 1898 | + Explicit({ | |
| 1899 | + required this.explicit, | |
| 1900 | + }); | |
| 1901 | + | |
| 1902 | + factory Explicit.fromJson(Map<String, dynamic> json) => Explicit( | |
| 1903 | + explicit: json["explicit"], | |
| 1904 | + ); | |
| 1905 | + | |
| 1906 | + Map<String, dynamic> toJson() => { | |
| 1907 | + "explicit": explicit, | |
| 1908 | + }; | |
| 1909 | +} | |
| 1910 | + | |
| 1911 | +class Exposing { | |
| 1912 | + final int exposing; | |
| 1913 | + | |
| 1914 | + Exposing({ | |
| 1915 | + required this.exposing, | |
| 1916 | + }); | |
| 1917 | + | |
| 1918 | + factory Exposing.fromJson(Map<String, dynamic> json) => Exposing( | |
| 1919 | + exposing: json["exposing"], | |
| 1920 | + ); | |
| 1921 | + | |
| 1922 | + Map<String, dynamic> toJson() => { | |
| 1923 | + "exposing": exposing, | |
| 1924 | + }; | |
| 1925 | +} | |
| 1926 | + | |
| 1927 | +class Extension { | |
| 1928 | + final int extension; | |
| 1929 | + | |
| 1930 | + Extension({ | |
| 1931 | + required this.extension, | |
| 1932 | + }); | |
| 1933 | + | |
| 1934 | + factory Extension.fromJson(Map<String, dynamic> json) => Extension( | |
| 1935 | + extension: json["extension"], | |
| 1936 | + ); | |
| 1937 | + | |
| 1938 | + Map<String, dynamic> toJson() => { | |
| 1939 | + "extension": extension, | |
| 1940 | + }; | |
| 1941 | +} | |
| 1942 | + | |
| 1943 | +class Extern { | |
| 1944 | + final int extern; | |
| 1945 | + | |
| 1946 | + Extern({ | |
| 1947 | + required this.extern, | |
| 1948 | + }); | |
| 1949 | + | |
| 1950 | + factory Extern.fromJson(Map<String, dynamic> json) => Extern( | |
| 1951 | + extern: json["extern"], | |
| 1952 | + ); | |
| 1953 | + | |
| 1954 | + Map<String, dynamic> toJson() => { | |
| 1955 | + "extern": extern, | |
| 1956 | + }; | |
| 1957 | +} | |
| 1958 | + | |
| 1959 | +class Fallthrough { | |
| 1960 | + final int fallthrough; | |
| 1961 | + | |
| 1962 | + Fallthrough({ | |
| 1963 | + required this.fallthrough, | |
| 1964 | + }); | |
| 1965 | + | |
| 1966 | + factory Fallthrough.fromJson(Map<String, dynamic> json) => Fallthrough( | |
| 1967 | + fallthrough: json["fallthrough"], | |
| 1968 | + ); | |
| 1969 | + | |
| 1970 | + Map<String, dynamic> toJson() => { | |
| 1971 | + "fallthrough": fallthrough, | |
| 1972 | + }; | |
| 1973 | +} | |
| 1974 | + | |
| 1975 | +class Fileprivate { | |
| 1976 | + final int fileprivate; | |
| 1977 | + | |
| 1978 | + Fileprivate({ | |
| 1979 | + required this.fileprivate, | |
| 1980 | + }); | |
| 1981 | + | |
| 1982 | + factory Fileprivate.fromJson(Map<String, dynamic> json) => Fileprivate( | |
| 1983 | + fileprivate: json["fileprivate"], | |
| 1984 | + ); | |
| 1985 | + | |
| 1986 | + Map<String, dynamic> toJson() => { | |
| 1987 | + "fileprivate": fileprivate, | |
| 1988 | + }; | |
| 1989 | +} | |
| 1990 | + | |
| 1991 | +class Fixed { | |
| 1992 | + final int fixed; | |
| 1993 | + | |
| 1994 | + Fixed({ | |
| 1995 | + required this.fixed, | |
| 1996 | + }); | |
| 1997 | + | |
| 1998 | + factory Fixed.fromJson(Map<String, dynamic> json) => Fixed( | |
| 1999 | + fixed: json["fixed"], | |
| 2000 | + ); | |
| 2001 | + | |
| 2002 | + Map<String, dynamic> toJson() => { | |
| 2003 | + "fixed": fixed, | |
| 2004 | + }; | |
| 2005 | +} | |
| 2006 | + | |
| 2007 | +class Float { | |
| 2008 | + final int float; | |
| 2009 | + | |
| 2010 | + Float({ | |
| 2011 | + required this.float, | |
| 2012 | + }); | |
| 2013 | + | |
| 2014 | + factory Float.fromJson(Map<String, dynamic> json) => Float( | |
| 2015 | + float: json["float"], | |
| 2016 | + ); | |
| 2017 | + | |
| 2018 | + Map<String, dynamic> toJson() => { | |
| 2019 | + "float": float, | |
| 2020 | + }; | |
| 2021 | +} | |
| 2022 | + | |
| 2023 | +class Foreach { | |
| 2024 | + final int foreach; | |
| 2025 | + | |
| 2026 | + Foreach({ | |
| 2027 | + required this.foreach, | |
| 2028 | + }); | |
| 2029 | + | |
| 2030 | + factory Foreach.fromJson(Map<String, dynamic> json) => Foreach( | |
| 2031 | + foreach: json["foreach"], | |
| 2032 | + ); | |
| 2033 | + | |
| 2034 | + Map<String, dynamic> toJson() => { | |
| 2035 | + "foreach": foreach, | |
| 2036 | + }; | |
| 2037 | +} | |
| 2038 | + | |
| 2039 | +class Friend { | |
| 2040 | + final int friend; | |
| 2041 | + | |
| 2042 | + Friend({ | |
| 2043 | + required this.friend, | |
| 2044 | + }); | |
| 2045 | + | |
| 2046 | + factory Friend.fromJson(Map<String, dynamic> json) => Friend( | |
| 2047 | + friend: json["friend"], | |
| 2048 | + ); | |
| 2049 | + | |
| 2050 | + Map<String, dynamic> toJson() => { | |
| 2051 | + "friend": friend, | |
| 2052 | + }; | |
| 2053 | +} | |
| 2054 | + | |
| 2055 | +class From { | |
| 2056 | + final int from; | |
| 2057 | + | |
| 2058 | + From({ | |
| 2059 | + required this.from, | |
| 2060 | + }); | |
| 2061 | + | |
| 2062 | + factory From.fromJson(Map<String, dynamic> json) => From( | |
| 2063 | + from: json["from"], | |
| 2064 | + ); | |
| 2065 | + | |
| 2066 | + Map<String, dynamic> toJson() => { | |
| 2067 | + "from": from, | |
| 2068 | + }; | |
| 2069 | +} | |
| 2070 | + | |
| 2071 | +class Func { | |
| 2072 | + final int func; | |
| 2073 | + | |
| 2074 | + Func({ | |
| 2075 | + required this.func, | |
| 2076 | + }); | |
| 2077 | + | |
| 2078 | + factory Func.fromJson(Map<String, dynamic> json) => Func( | |
| 2079 | + func: json["func"], | |
| 2080 | + ); | |
| 2081 | + | |
| 2082 | + Map<String, dynamic> toJson() => { | |
| 2083 | + "func": func, | |
| 2084 | + }; | |
| 2085 | +} | |
| 2086 | + | |
| 2087 | +class FunctionClass { | |
| 2088 | + final int function; | |
| 2089 | + | |
| 2090 | + FunctionClass({ | |
| 2091 | + required this.function, | |
| 2092 | + }); | |
| 2093 | + | |
| 2094 | + factory FunctionClass.fromJson(Map<String, dynamic> json) => FunctionClass( | |
| 2095 | + function: json["function"], | |
| 2096 | + ); | |
| 2097 | + | |
| 2098 | + Map<String, dynamic> toJson() => { | |
| 2099 | + "function": function, | |
| 2100 | + }; | |
| 2101 | +} | |
| 2102 | + | |
| 2103 | +class Global { | |
| 2104 | + final int global; | |
| 2105 | + | |
| 2106 | + Global({ | |
| 2107 | + required this.global, | |
| 2108 | + }); | |
| 2109 | + | |
| 2110 | + factory Global.fromJson(Map<String, dynamic> json) => Global( | |
| 2111 | + global: json["global"], | |
| 2112 | + ); | |
| 2113 | + | |
| 2114 | + Map<String, dynamic> toJson() => { | |
| 2115 | + "global": global, | |
| 2116 | + }; | |
| 2117 | +} | |
| 2118 | + | |
| 2119 | +class Go { | |
| 2120 | + final int go; | |
| 2121 | + | |
| 2122 | + Go({ | |
| 2123 | + required this.go, | |
| 2124 | + }); | |
| 2125 | + | |
| 2126 | + factory Go.fromJson(Map<String, dynamic> json) => Go( | |
| 2127 | + go: json["go"], | |
| 2128 | + ); | |
| 2129 | + | |
| 2130 | + Map<String, dynamic> toJson() => { | |
| 2131 | + "go": go, | |
| 2132 | + }; | |
| 2133 | +} | |
| 2134 | + | |
| 2135 | +class Goto { | |
| 2136 | + final int goto; | |
| 2137 | + | |
| 2138 | + Goto({ | |
| 2139 | + required this.goto, | |
| 2140 | + }); | |
| 2141 | + | |
| 2142 | + factory Goto.fromJson(Map<String, dynamic> json) => Goto( | |
| 2143 | + goto: json["goto"], | |
| 2144 | + ); | |
| 2145 | + | |
| 2146 | + Map<String, dynamic> toJson() => { | |
| 2147 | + "goto": goto, | |
| 2148 | + }; | |
| 2149 | +} | |
| 2150 | + | |
| 2151 | +class Guard { | |
| 2152 | + final int guard; | |
| 2153 | + | |
| 2154 | + Guard({ | |
| 2155 | + required this.guard, | |
| 2156 | + }); | |
| 2157 | + | |
| 2158 | + factory Guard.fromJson(Map<String, dynamic> json) => Guard( | |
| 2159 | + guard: json["guard"], | |
| 2160 | + ); | |
| 2161 | + | |
| 2162 | + Map<String, dynamic> toJson() => { | |
| 2163 | + "guard": guard, | |
| 2164 | + }; | |
| 2165 | +} | |
| 2166 | + | |
| 2167 | +class HasOwnProperty { | |
| 2168 | + final int hasOwnProperty; | |
| 2169 | + | |
| 2170 | + HasOwnProperty({ | |
| 2171 | + required this.hasOwnProperty, | |
| 2172 | + }); | |
| 2173 | + | |
| 2174 | + factory HasOwnProperty.fromJson(Map<String, dynamic> json) => HasOwnProperty( | |
| 2175 | + hasOwnProperty: json["hasOwnProperty"], | |
| 2176 | + ); | |
| 2177 | + | |
| 2178 | + Map<String, dynamic> toJson() => { | |
| 2179 | + "hasOwnProperty": hasOwnProperty, | |
| 2180 | + }; | |
| 2181 | +} | |
| 2182 | + | |
| 2183 | +class Id { | |
| 2184 | + final int id; | |
| 2185 | + | |
| 2186 | + Id({ | |
| 2187 | + required this.id, | |
| 2188 | + }); | |
| 2189 | + | |
| 2190 | + factory Id.fromJson(Map<String, dynamic> json) => Id( | |
| 2191 | + id: json["id"], | |
| 2192 | + ); | |
| 2193 | + | |
| 2194 | + Map<String, dynamic> toJson() => { | |
| 2195 | + "id": id, | |
| 2196 | + }; | |
| 2197 | +} | |
| 2198 | + | |
| 2199 | +class Imp { | |
| 2200 | + final int imp; | |
| 2201 | + | |
| 2202 | + Imp({ | |
| 2203 | + required this.imp, | |
| 2204 | + }); | |
| 2205 | + | |
| 2206 | + factory Imp.fromJson(Map<String, dynamic> json) => Imp( | |
| 2207 | + imp: json["IMP"], | |
| 2208 | + ); | |
| 2209 | + | |
| 2210 | + Map<String, dynamic> toJson() => { | |
| 2211 | + "IMP": imp, | |
| 2212 | + }; | |
| 2213 | +} | |
| 2214 | + | |
| 2215 | +class Implicit { | |
| 2216 | + final int implicit; | |
| 2217 | + | |
| 2218 | + Implicit({ | |
| 2219 | + required this.implicit, | |
| 2220 | + }); | |
| 2221 | + | |
| 2222 | + factory Implicit.fromJson(Map<String, dynamic> json) => Implicit( | |
| 2223 | + implicit: json["implicit"], | |
| 2224 | + ); | |
| 2225 | + | |
| 2226 | + Map<String, dynamic> toJson() => { | |
| 2227 | + "implicit": implicit, | |
| 2228 | + }; | |
| 2229 | +} | |
| 2230 | + | |
| 2231 | +class Indirect { | |
| 2232 | + final int indirect; | |
| 2233 | + | |
| 2234 | + Indirect({ | |
| 2235 | + required this.indirect, | |
| 2236 | + }); | |
| 2237 | + | |
| 2238 | + factory Indirect.fromJson(Map<String, dynamic> json) => Indirect( | |
| 2239 | + indirect: json["indirect"], | |
| 2240 | + ); | |
| 2241 | + | |
| 2242 | + Map<String, dynamic> toJson() => { | |
| 2243 | + "indirect": indirect, | |
| 2244 | + }; | |
| 2245 | +} | |
| 2246 | + | |
| 2247 | +class Infix { | |
| 2248 | + final int infix; | |
| 2249 | + | |
| 2250 | + Infix({ | |
| 2251 | + required this.infix, | |
| 2252 | + }); | |
| 2253 | + | |
| 2254 | + factory Infix.fromJson(Map<String, dynamic> json) => Infix( | |
| 2255 | + infix: json["infix"], | |
| 2256 | + ); | |
| 2257 | + | |
| 2258 | + Map<String, dynamic> toJson() => { | |
| 2259 | + "infix": infix, | |
| 2260 | + }; | |
| 2261 | +} | |
| 2262 | + | |
| 2263 | +class Init { | |
| 2264 | + final int init; | |
| 2265 | + | |
| 2266 | + Init({ | |
| 2267 | + required this.init, | |
| 2268 | + }); | |
| 2269 | + | |
| 2270 | + factory Init.fromJson(Map<String, dynamic> json) => Init( | |
| 2271 | + init: json["init"], | |
| 2272 | + ); | |
| 2273 | + | |
| 2274 | + Map<String, dynamic> toJson() => { | |
| 2275 | + "init": init, | |
| 2276 | + }; | |
| 2277 | +} | |
| 2278 | + | |
| 2279 | +class Inline { | |
| 2280 | + final int inline; | |
| 2281 | + | |
| 2282 | + Inline({ | |
| 2283 | + required this.inline, | |
| 2284 | + }); | |
| 2285 | + | |
| 2286 | + factory Inline.fromJson(Map<String, dynamic> json) => Inline( | |
| 2287 | + inline: json["inline"], | |
| 2288 | + ); | |
| 2289 | + | |
| 2290 | + Map<String, dynamic> toJson() => { | |
| 2291 | + "inline": inline, | |
| 2292 | + }; | |
| 2293 | +} | |
| 2294 | + | |
| 2295 | +class Inout { | |
| 2296 | + final int inout; | |
| 2297 | + | |
| 2298 | + Inout({ | |
| 2299 | + required this.inout, | |
| 2300 | + }); | |
| 2301 | + | |
| 2302 | + factory Inout.fromJson(Map<String, dynamic> json) => Inout( | |
| 2303 | + inout: json["inout"], | |
| 2304 | + ); | |
| 2305 | + | |
| 2306 | + Map<String, dynamic> toJson() => { | |
| 2307 | + "inout": inout, | |
| 2308 | + }; | |
| 2309 | +} | |
| 2310 | + | |
| 2311 | +class Instanceof { | |
| 2312 | + final int instanceof; | |
| 2313 | + | |
| 2314 | + Instanceof({ | |
| 2315 | + required this.instanceof, | |
| 2316 | + }); | |
| 2317 | + | |
| 2318 | + factory Instanceof.fromJson(Map<String, dynamic> json) => Instanceof( | |
| 2319 | + instanceof: json["instanceof"], | |
| 2320 | + ); | |
| 2321 | + | |
| 2322 | + Map<String, dynamic> toJson() => { | |
| 2323 | + "instanceof": instanceof, | |
| 2324 | + }; | |
| 2325 | +} | |
| 2326 | + | |
| 2327 | +class Internal { | |
| 2328 | + final int internal; | |
| 2329 | + | |
| 2330 | + Internal({ | |
| 2331 | + required this.internal, | |
| 2332 | + }); | |
| 2333 | + | |
| 2334 | + factory Internal.fromJson(Map<String, dynamic> json) => Internal( | |
| 2335 | + internal: json["internal"], | |
| 2336 | + ); | |
| 2337 | + | |
| 2338 | + Map<String, dynamic> toJson() => { | |
| 2339 | + "internal": internal, | |
| 2340 | + }; | |
| 2341 | +} | |
| 2342 | + | |
| 2343 | +class Default { | |
| 2344 | + final int defaultDefault; | |
| 2345 | + | |
| 2346 | + Default({ | |
| 2347 | + required this.defaultDefault, | |
| 2348 | + }); | |
| 2349 | + | |
| 2350 | + factory Default.fromJson(Map<String, dynamic> json) => Default( | |
| 2351 | + defaultDefault: json["default"], | |
| 2352 | + ); | |
| 2353 | + | |
| 2354 | + Map<String, dynamic> toJson() => { | |
| 2355 | + "default": defaultDefault, | |
| 2356 | + }; | |
| 2357 | +} | |
| 2358 | + | |
| 2359 | +class Do { | |
| 2360 | + final int doDo; | |
| 2361 | + | |
| 2362 | + Do({ | |
| 2363 | + required this.doDo, | |
| 2364 | + }); | |
| 2365 | + | |
| 2366 | + factory Do.fromJson(Map<String, dynamic> json) => Do( | |
| 2367 | + doDo: json["do"], | |
| 2368 | + ); | |
| 2369 | + | |
| 2370 | + Map<String, dynamic> toJson() => { | |
| 2371 | + "do": doDo, | |
| 2372 | + }; | |
| 2373 | +} | |
| 2374 | + | |
| 2375 | +class Double { | |
| 2376 | + final int doubleDouble; | |
| 2377 | + | |
| 2378 | + Double({ | |
| 2379 | + required this.doubleDouble, | |
| 2380 | + }); | |
| 2381 | + | |
| 2382 | + factory Double.fromJson(Map<String, dynamic> json) => Double( | |
| 2383 | + doubleDouble: json["double"], | |
| 2384 | + ); | |
| 2385 | + | |
| 2386 | + Map<String, dynamic> toJson() => { | |
| 2387 | + "double": doubleDouble, | |
| 2388 | + }; | |
| 2389 | +} | |
| 2390 | + | |
| 2391 | +class Dynamic { | |
| 2392 | + final int dynamicDynamic; | |
| 2393 | + | |
| 2394 | + Dynamic({ | |
| 2395 | + required this.dynamicDynamic, | |
| 2396 | + }); | |
| 2397 | + | |
| 2398 | + factory Dynamic.fromJson(Map<String, dynamic> json) => Dynamic( | |
| 2399 | + dynamicDynamic: json["dynamic"], | |
| 2400 | + ); | |
| 2401 | + | |
| 2402 | + Map<String, dynamic> toJson() => { | |
| 2403 | + "dynamic": dynamicDynamic, | |
| 2404 | + }; | |
| 2405 | +} | |
| 2406 | + | |
| 2407 | +class Else { | |
| 2408 | + final int elseElse; | |
| 2409 | + | |
| 2410 | + Else({ | |
| 2411 | + required this.elseElse, | |
| 2412 | + }); | |
| 2413 | + | |
| 2414 | + factory Else.fromJson(Map<String, dynamic> json) => Else( | |
| 2415 | + elseElse: json["else"], | |
| 2416 | + ); | |
| 2417 | + | |
| 2418 | + Map<String, dynamic> toJson() => { | |
| 2419 | + "else": elseElse, | |
| 2420 | + }; | |
| 2421 | +} | |
| 2422 | + | |
| 2423 | +class Enum { | |
| 2424 | + final int enumEnum; | |
| 2425 | + | |
| 2426 | + Enum({ | |
| 2427 | + required this.enumEnum, | |
| 2428 | + }); | |
| 2429 | + | |
| 2430 | + factory Enum.fromJson(Map<String, dynamic> json) => Enum( | |
| 2431 | + enumEnum: json["enum"], | |
| 2432 | + ); | |
| 2433 | + | |
| 2434 | + Map<String, dynamic> toJson() => { | |
| 2435 | + "enum": enumEnum, | |
| 2436 | + }; | |
| 2437 | +} | |
| 2438 | + | |
| 2439 | +class Export { | |
| 2440 | + final int exportExport; | |
| 2441 | + | |
| 2442 | + Export({ | |
| 2443 | + required this.exportExport, | |
| 2444 | + }); | |
| 2445 | + | |
| 2446 | + factory Export.fromJson(Map<String, dynamic> json) => Export( | |
| 2447 | + exportExport: json["export"], | |
| 2448 | + ); | |
| 2449 | + | |
| 2450 | + Map<String, dynamic> toJson() => { | |
| 2451 | + "export": exportExport, | |
| 2452 | + }; | |
| 2453 | +} | |
| 2454 | + | |
| 2455 | +class Extends { | |
| 2456 | + final int extendsExtends; | |
| 2457 | + | |
| 2458 | + Extends({ | |
| 2459 | + required this.extendsExtends, | |
| 2460 | + }); | |
| 2461 | + | |
| 2462 | + factory Extends.fromJson(Map<String, dynamic> json) => Extends( | |
| 2463 | + extendsExtends: json["extends"], | |
| 2464 | + ); | |
| 2465 | + | |
| 2466 | + Map<String, dynamic> toJson() => { | |
| 2467 | + "extends": extendsExtends, | |
| 2468 | + }; | |
| 2469 | +} | |
| 2470 | + | |
| 2471 | +class False { | |
| 2472 | + final int falseFalse; | |
| 2473 | + | |
| 2474 | + False({ | |
| 2475 | + required this.falseFalse, | |
| 2476 | + }); | |
| 2477 | + | |
| 2478 | + factory False.fromJson(Map<String, dynamic> json) => False( | |
| 2479 | + falseFalse: json["False"], | |
| 2480 | + ); | |
| 2481 | + | |
| 2482 | + Map<String, dynamic> toJson() => { | |
| 2483 | + "False": falseFalse, | |
| 2484 | + }; | |
| 2485 | +} | |
| 2486 | + | |
| 2487 | +class Final { | |
| 2488 | + final int finalFinal; | |
| 2489 | + | |
| 2490 | + Final({ | |
| 2491 | + required this.finalFinal, | |
| 2492 | + }); | |
| 2493 | + | |
| 2494 | + factory Final.fromJson(Map<String, dynamic> json) => Final( | |
| 2495 | + finalFinal: json["final"], | |
| 2496 | + ); | |
| 2497 | + | |
| 2498 | + Map<String, dynamic> toJson() => { | |
| 2499 | + "final": finalFinal, | |
| 2500 | + }; | |
| 2501 | +} | |
| 2502 | + | |
| 2503 | +class Finally { | |
| 2504 | + final int finallyFinally; | |
| 2505 | + | |
| 2506 | + Finally({ | |
| 2507 | + required this.finallyFinally, | |
| 2508 | + }); | |
| 2509 | + | |
| 2510 | + factory Finally.fromJson(Map<String, dynamic> json) => Finally( | |
| 2511 | + finallyFinally: json["finally"], | |
| 2512 | + ); | |
| 2513 | + | |
| 2514 | + Map<String, dynamic> toJson() => { | |
| 2515 | + "finally": finallyFinally, | |
| 2516 | + }; | |
| 2517 | +} | |
| 2518 | + | |
| 2519 | +class For { | |
| 2520 | + final int forFor; | |
| 2521 | + | |
| 2522 | + For({ | |
| 2523 | + required this.forFor, | |
| 2524 | + }); | |
| 2525 | + | |
| 2526 | + factory For.fromJson(Map<String, dynamic> json) => For( | |
| 2527 | + forFor: json["for"], | |
| 2528 | + ); | |
| 2529 | + | |
| 2530 | + Map<String, dynamic> toJson() => { | |
| 2531 | + "for": forFor, | |
| 2532 | + }; | |
| 2533 | +} | |
| 2534 | + | |
| 2535 | +class FromJson { | |
| 2536 | + final int fromJsonFromJson; | |
| 2537 | + | |
| 2538 | + FromJson({ | |
| 2539 | + required this.fromJsonFromJson, | |
| 2540 | + }); | |
| 2541 | + | |
| 2542 | + factory FromJson.fromJson(Map<String, dynamic> json) => FromJson( | |
| 2543 | + fromJsonFromJson: json["from_json"], | |
| 2544 | + ); | |
| 2545 | + | |
| 2546 | + Map<String, dynamic> toJson() => { | |
| 2547 | + "from_json": fromJsonFromJson, | |
| 2548 | + }; | |
| 2549 | +} | |
| 2550 | + | |
| 2551 | +class Get { | |
| 2552 | + final int getGet; | |
| 2553 | + | |
| 2554 | + Get({ | |
| 2555 | + required this.getGet, | |
| 2556 | + }); | |
| 2557 | + | |
| 2558 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 2559 | + getGet: json["get"], | |
| 2560 | + ); | |
| 2561 | + | |
| 2562 | + Map<String, dynamic> toJson() => { | |
| 2563 | + "get": getGet, | |
| 2564 | + }; | |
| 2565 | +} | |
| 2566 | + | |
| 2567 | +class If { | |
| 2568 | + final int ifIf; | |
| 2569 | + | |
| 2570 | + If({ | |
| 2571 | + required this.ifIf, | |
| 2572 | + }); | |
| 2573 | + | |
| 2574 | + factory If.fromJson(Map<String, dynamic> json) => If( | |
| 2575 | + ifIf: json["if"], | |
| 2576 | + ); | |
| 2577 | + | |
| 2578 | + Map<String, dynamic> toJson() => { | |
| 2579 | + "if": ifIf, | |
| 2580 | + }; | |
| 2581 | +} | |
| 2582 | + | |
| 2583 | +class Implements { | |
| 2584 | + final int implementsImplements; | |
| 2585 | + | |
| 2586 | + Implements({ | |
| 2587 | + required this.implementsImplements, | |
| 2588 | + }); | |
| 2589 | + | |
| 2590 | + factory Implements.fromJson(Map<String, dynamic> json) => Implements( | |
| 2591 | + implementsImplements: json["implements"], | |
| 2592 | + ); | |
| 2593 | + | |
| 2594 | + Map<String, dynamic> toJson() => { | |
| 2595 | + "implements": implementsImplements, | |
| 2596 | + }; | |
| 2597 | +} | |
| 2598 | + | |
| 2599 | +class Import { | |
| 2600 | + final int importImport; | |
| 2601 | + | |
| 2602 | + Import({ | |
| 2603 | + required this.importImport, | |
| 2604 | + }); | |
| 2605 | + | |
| 2606 | + factory Import.fromJson(Map<String, dynamic> json) => Import( | |
| 2607 | + importImport: json["import"], | |
| 2608 | + ); | |
| 2609 | + | |
| 2610 | + Map<String, dynamic> toJson() => { | |
| 2611 | + "import": importImport, | |
| 2612 | + }; | |
| 2613 | +} | |
| 2614 | + | |
| 2615 | +class In { | |
| 2616 | + final int inIn; | |
| 2617 | + | |
| 2618 | + In({ | |
| 2619 | + required this.inIn, | |
| 2620 | + }); | |
| 2621 | + | |
| 2622 | + factory In.fromJson(Map<String, dynamic> json) => In( | |
| 2623 | + inIn: json["in"], | |
| 2624 | + ); | |
| 2625 | + | |
| 2626 | + Map<String, dynamic> toJson() => { | |
| 2627 | + "in": inIn, | |
| 2628 | + }; | |
| 2629 | +} | |
| 2630 | + | |
| 2631 | +class Int { | |
| 2632 | + final int intInt; | |
| 2633 | + | |
| 2634 | + Int({ | |
| 2635 | + required this.intInt, | |
| 2636 | + }); | |
| 2637 | + | |
| 2638 | + factory Int.fromJson(Map<String, dynamic> json) => Int( | |
| 2639 | + intInt: json["int"], | |
| 2640 | + ); | |
| 2641 | + | |
| 2642 | + Map<String, dynamic> toJson() => { | |
| 2643 | + "int": intInt, | |
| 2644 | + }; | |
| 2645 | +} | |
| 2646 | + | |
| 2647 | +class Interface { | |
| 2648 | + final int interfaceInterface; | |
| 2649 | + | |
| 2650 | + Interface({ | |
| 2651 | + required this.interfaceInterface, | |
| 2652 | + }); | |
| 2653 | + | |
| 2654 | + factory Interface.fromJson(Map<String, dynamic> json) => Interface( | |
| 2655 | + interfaceInterface: json["interface"], | |
| 2656 | + ); | |
| 2657 | + | |
| 2658 | + Map<String, dynamic> toJson() => { | |
| 2659 | + "interface": interfaceInterface, | |
| 2660 | + }; | |
| 2661 | +} | |
| 2662 | + | |
| 2663 | +class FalseClass { | |
| 2664 | + final int falseFalse; | |
| 2665 | + | |
| 2666 | + FalseClass({ | |
| 2667 | + required this.falseFalse, | |
| 2668 | + }); | |
| 2669 | + | |
| 2670 | + factory FalseClass.fromJson(Map<String, dynamic> json) => FalseClass( | |
| 2671 | + falseFalse: json["false"], | |
| 2672 | + ); | |
| 2673 | + | |
| 2674 | + Map<String, dynamic> toJson() => { | |
| 2675 | + "false": falseFalse, | |
| 2676 | + }; | |
| 2677 | +} | |
| 2678 | + | |
| 2679 | +class Obj3 { | |
| 2680 | + final int dummy; | |
| 2681 | + final Iterable iterable; | |
| 2682 | + final Jdec jdec; | |
| 2683 | + final Jenc jenc; | |
| 2684 | + final Jpipe jpipe; | |
| 2685 | + final Json json; | |
| 2686 | + final JsonConverter jsonConverter; | |
| 2687 | + final JsonSerializer jsonSerializer; | |
| 2688 | + final JsonToken jsonToken; | |
| 2689 | + final JsonWriter jsonWriter; | |
| 2690 | + final Lambda lambda; | |
| 2691 | + final Lazy lazy; | |
| 2692 | + final Left left; | |
| 2693 | + final Let let; | |
| 2694 | + final ListClass list; | |
| 2695 | + final Lock lock; | |
| 2696 | + final Long long; | |
| 2697 | + final MapClass map; | |
| 2698 | + final MetadataPropertyHandling metadataPropertyHandling; | |
| 2699 | + final Module module; | |
| 2700 | + final Mutable mutable; | |
| 2701 | + final Mutating mutating; | |
| 2702 | + final Namespace namespace; | |
| 2703 | + final Native native; | |
| 2704 | + final Newtonsoft newtonsoft; | |
| 2705 | + final Nil nil; | |
| 2706 | + final No no; | |
| 2707 | + final Noexcept noexcept; | |
| 2708 | + final Nonatomic nonatomic; | |
| 2709 | + final None none; | |
| 2710 | + final Nonlocal nonlocal; | |
| 2711 | + final Nonmutating nonmutating; | |
| 2712 | + final Not not; | |
| 2713 | + final NotEq notEq; | |
| 2714 | + final NsString nsString; | |
| 2715 | + final Nullptr nullptr; | |
| 2716 | + final Number number; | |
| 2717 | + final Is obj3Is; | |
| 2718 | + final New obj3New; | |
| 2719 | + final NoneClass obj3None; | |
| 2720 | + final Null obj3Null; | |
| 2721 | + final Operator obj3Operator; | |
| 2722 | + final ProtocolClass obj3Protocol; | |
| 2723 | + final Object object; | |
| 2724 | + final Of of; | |
| 2725 | + final Oneway oneway; | |
| 2726 | + final Open open; | |
| 2727 | + final Optional optional; | |
| 2728 | + final Or or; | |
| 2729 | + final OrEq orEq; | |
| 2730 | + final Out out; | |
| 2731 | + final Override override; | |
| 2732 | + final Package package; | |
| 2733 | + final Params params; | |
| 2734 | + final Pass pass; | |
| 2735 | + final Port port; | |
| 2736 | + final Postfix postfix; | |
| 2737 | + final Precedence precedence; | |
| 2738 | + final Prefix prefix; | |
| 2739 | + final Print print; | |
| 2740 | + final PrintMembers printMembers; | |
| 2741 | + final Printf printf; | |
| 2742 | + final Private private; | |
| 2743 | + final Protected protected; | |
| 2744 | + final Protocol protocol; | |
| 2745 | + final NullClass purpleNull; | |
| 2746 | + | |
| 2747 | + Obj3({ | |
| 2748 | + required this.dummy, | |
| 2749 | + required this.iterable, | |
| 2750 | + required this.jdec, | |
| 2751 | + required this.jenc, | |
| 2752 | + required this.jpipe, | |
| 2753 | + required this.json, | |
| 2754 | + required this.jsonConverter, | |
| 2755 | + required this.jsonSerializer, | |
| 2756 | + required this.jsonToken, | |
| 2757 | + required this.jsonWriter, | |
| 2758 | + required this.lambda, | |
| 2759 | + required this.lazy, | |
| 2760 | + required this.left, | |
| 2761 | + required this.let, | |
| 2762 | + required this.list, | |
| 2763 | + required this.lock, | |
| 2764 | + required this.long, | |
| 2765 | + required this.map, | |
| 2766 | + required this.metadataPropertyHandling, | |
| 2767 | + required this.module, | |
| 2768 | + required this.mutable, | |
| 2769 | + required this.mutating, | |
| 2770 | + required this.namespace, | |
| 2771 | + required this.native, | |
| 2772 | + required this.newtonsoft, | |
| 2773 | + required this.nil, | |
| 2774 | + required this.no, | |
| 2775 | + required this.noexcept, | |
| 2776 | + required this.nonatomic, | |
| 2777 | + required this.none, | |
| 2778 | + required this.nonlocal, | |
| 2779 | + required this.nonmutating, | |
| 2780 | + required this.not, | |
| 2781 | + required this.notEq, | |
| 2782 | + required this.nsString, | |
| 2783 | + required this.nullptr, | |
| 2784 | + required this.number, | |
| 2785 | + required this.obj3Is, | |
| 2786 | + required this.obj3New, | |
| 2787 | + required this.obj3None, | |
| 2788 | + required this.obj3Null, | |
| 2789 | + required this.obj3Operator, | |
| 2790 | + required this.obj3Protocol, | |
| 2791 | + required this.object, | |
| 2792 | + required this.of, | |
| 2793 | + required this.oneway, | |
| 2794 | + required this.open, | |
| 2795 | + required this.optional, | |
| 2796 | + required this.or, | |
| 2797 | + required this.orEq, | |
| 2798 | + required this.out, | |
| 2799 | + required this.override, | |
| 2800 | + required this.package, | |
| 2801 | + required this.params, | |
| 2802 | + required this.pass, | |
| 2803 | + required this.port, | |
| 2804 | + required this.postfix, | |
| 2805 | + required this.precedence, | |
| 2806 | + required this.prefix, | |
| 2807 | + required this.print, | |
| 2808 | + required this.printMembers, | |
| 2809 | + required this.printf, | |
| 2810 | + required this.private, | |
| 2811 | + required this.protected, | |
| 2812 | + required this.protocol, | |
| 2813 | + required this.purpleNull, | |
| 2814 | + }); | |
| 2815 | + | |
| 2816 | + factory Obj3.fromJson(Map<String, dynamic> json) => Obj3( | |
| 2817 | + dummy: json["dummy"], | |
| 2818 | + iterable: Iterable.fromJson(json["iterable"]), | |
| 2819 | + jdec: Jdec.fromJson(json["jdec"]), | |
| 2820 | + jenc: Jenc.fromJson(json["jenc"]), | |
| 2821 | + jpipe: Jpipe.fromJson(json["jpipe"]), | |
| 2822 | + json: Json.fromJson(json["json"]), | |
| 2823 | + jsonConverter: JsonConverter.fromJson(json["json_converter"]), | |
| 2824 | + jsonSerializer: JsonSerializer.fromJson(json["json_serializer"]), | |
| 2825 | + jsonToken: JsonToken.fromJson(json["json_token"]), | |
| 2826 | + jsonWriter: JsonWriter.fromJson(json["json_writer"]), | |
| 2827 | + lambda: Lambda.fromJson(json["lambda"]), | |
| 2828 | + lazy: Lazy.fromJson(json["lazy"]), | |
| 2829 | + left: Left.fromJson(json["left"]), | |
| 2830 | + let: Let.fromJson(json["let"]), | |
| 2831 | + list: ListClass.fromJson(json["list"]), | |
| 2832 | + lock: Lock.fromJson(json["lock"]), | |
| 2833 | + long: Long.fromJson(json["long"]), | |
| 2834 | + map: MapClass.fromJson(json["map"]), | |
| 2835 | + metadataPropertyHandling: MetadataPropertyHandling.fromJson(json["metadata_property_handling"]), | |
| 2836 | + module: Module.fromJson(json["module"]), | |
| 2837 | + mutable: Mutable.fromJson(json["mutable"]), | |
| 2838 | + mutating: Mutating.fromJson(json["mutating"]), | |
| 2839 | + namespace: Namespace.fromJson(json["namespace"]), | |
| 2840 | + native: Native.fromJson(json["native"]), | |
| 2841 | + newtonsoft: Newtonsoft.fromJson(json["newtonsoft"]), | |
| 2842 | + nil: Nil.fromJson(json["nil"]), | |
| 2843 | + no: No.fromJson(json["NO"]), | |
| 2844 | + noexcept: Noexcept.fromJson(json["noexcept"]), | |
| 2845 | + nonatomic: Nonatomic.fromJson(json["nonatomic"]), | |
| 2846 | + none: None.fromJson(json["None"]), | |
| 2847 | + nonlocal: Nonlocal.fromJson(json["nonlocal"]), | |
| 2848 | + nonmutating: Nonmutating.fromJson(json["nonmutating"]), | |
| 2849 | + not: Not.fromJson(json["not"]), | |
| 2850 | + notEq: NotEq.fromJson(json["not_eq"]), | |
| 2851 | + nsString: NsString.fromJson(json["NSString"]), | |
| 2852 | + nullptr: Nullptr.fromJson(json["nullptr"]), | |
| 2853 | + number: Number.fromJson(json["number"]), | |
| 2854 | + obj3Is: Is.fromJson(json["is"]), | |
| 2855 | + obj3New: New.fromJson(json["new"]), | |
| 2856 | + obj3None: NoneClass.fromJson(json["none"]), | |
| 2857 | + obj3Null: Null.fromJson(json["NULL"]), | |
| 2858 | + obj3Operator: Operator.fromJson(json["operator"]), | |
| 2859 | + obj3Protocol: ProtocolClass.fromJson(json["protocol"]), | |
| 2860 | + object: Object.fromJson(json["object"]), | |
| 2861 | + of: Of.fromJson(json["of"]), | |
| 2862 | + oneway: Oneway.fromJson(json["oneway"]), | |
| 2863 | + open: Open.fromJson(json["open"]), | |
| 2864 | + optional: Optional.fromJson(json["optional"]), | |
| 2865 | + or: Or.fromJson(json["or"]), | |
| 2866 | + orEq: OrEq.fromJson(json["or_eq"]), | |
| 2867 | + out: Out.fromJson(json["out"]), | |
| 2868 | + override: Override.fromJson(json["override"]), | |
| 2869 | + package: Package.fromJson(json["package"]), | |
| 2870 | + params: Params.fromJson(json["params"]), | |
| 2871 | + pass: Pass.fromJson(json["pass"]), | |
| 2872 | + port: Port.fromJson(json["port"]), | |
| 2873 | + postfix: Postfix.fromJson(json["postfix"]), | |
| 2874 | + precedence: Precedence.fromJson(json["precedence"]), | |
| 2875 | + prefix: Prefix.fromJson(json["prefix"]), | |
| 2876 | + print: Print.fromJson(json["print"]), | |
| 2877 | + printMembers: PrintMembers.fromJson(json["printMembers"]), | |
| 2878 | + printf: Printf.fromJson(json["printf"]), | |
| 2879 | + private: Private.fromJson(json["private"]), | |
| 2880 | + protected: Protected.fromJson(json["protected"]), | |
| 2881 | + protocol: Protocol.fromJson(json["Protocol"]), | |
| 2882 | + purpleNull: NullClass.fromJson(json["null"]), | |
| 2883 | + ); | |
| 2884 | + | |
| 2885 | + Map<String, dynamic> toJson() => { | |
| 2886 | + "dummy": dummy, | |
| 2887 | + "iterable": iterable.toJson(), | |
| 2888 | + "jdec": jdec.toJson(), | |
| 2889 | + "jenc": jenc.toJson(), | |
| 2890 | + "jpipe": jpipe.toJson(), | |
| 2891 | + "json": json.toJson(), | |
| 2892 | + "json_converter": jsonConverter.toJson(), | |
| 2893 | + "json_serializer": jsonSerializer.toJson(), | |
| 2894 | + "json_token": jsonToken.toJson(), | |
| 2895 | + "json_writer": jsonWriter.toJson(), | |
| 2896 | + "lambda": lambda.toJson(), | |
| 2897 | + "lazy": lazy.toJson(), | |
| 2898 | + "left": left.toJson(), | |
| 2899 | + "let": let.toJson(), | |
| 2900 | + "list": list.toJson(), | |
| 2901 | + "lock": lock.toJson(), | |
| 2902 | + "long": long.toJson(), | |
| 2903 | + "map": map.toJson(), | |
| 2904 | + "metadata_property_handling": metadataPropertyHandling.toJson(), | |
| 2905 | + "module": module.toJson(), | |
| 2906 | + "mutable": mutable.toJson(), | |
| 2907 | + "mutating": mutating.toJson(), | |
| 2908 | + "namespace": namespace.toJson(), | |
| 2909 | + "native": native.toJson(), | |
| 2910 | + "newtonsoft": newtonsoft.toJson(), | |
| 2911 | + "nil": nil.toJson(), | |
| 2912 | + "NO": no.toJson(), | |
| 2913 | + "noexcept": noexcept.toJson(), | |
| 2914 | + "nonatomic": nonatomic.toJson(), | |
| 2915 | + "None": none.toJson(), | |
| 2916 | + "nonlocal": nonlocal.toJson(), | |
| 2917 | + "nonmutating": nonmutating.toJson(), | |
| 2918 | + "not": not.toJson(), | |
| 2919 | + "not_eq": notEq.toJson(), | |
| 2920 | + "NSString": nsString.toJson(), | |
| 2921 | + "nullptr": nullptr.toJson(), | |
| 2922 | + "number": number.toJson(), | |
| 2923 | + "is": obj3Is.toJson(), | |
| 2924 | + "new": obj3New.toJson(), | |
| 2925 | + "none": obj3None.toJson(), | |
| 2926 | + "NULL": obj3Null.toJson(), | |
| 2927 | + "operator": obj3Operator.toJson(), | |
| 2928 | + "protocol": obj3Protocol.toJson(), | |
| 2929 | + "object": object.toJson(), | |
| 2930 | + "of": of.toJson(), | |
| 2931 | + "oneway": oneway.toJson(), | |
| 2932 | + "open": open.toJson(), | |
| 2933 | + "optional": optional.toJson(), | |
| 2934 | + "or": or.toJson(), | |
| 2935 | + "or_eq": orEq.toJson(), | |
| 2936 | + "out": out.toJson(), | |
| 2937 | + "override": override.toJson(), | |
| 2938 | + "package": package.toJson(), | |
| 2939 | + "params": params.toJson(), | |
| 2940 | + "pass": pass.toJson(), | |
| 2941 | + "port": port.toJson(), | |
| 2942 | + "postfix": postfix.toJson(), | |
| 2943 | + "precedence": precedence.toJson(), | |
| 2944 | + "prefix": prefix.toJson(), | |
| 2945 | + "print": print.toJson(), | |
| 2946 | + "printMembers": printMembers.toJson(), | |
| 2947 | + "printf": printf.toJson(), | |
| 2948 | + "private": private.toJson(), | |
| 2949 | + "protected": protected.toJson(), | |
| 2950 | + "Protocol": protocol.toJson(), | |
| 2951 | + "null": purpleNull.toJson(), | |
| 2952 | + }; | |
| 2953 | +} | |
| 2954 | + | |
| 2955 | +class Iterable { | |
| 2956 | + final int iterable; | |
| 2957 | + | |
| 2958 | + Iterable({ | |
| 2959 | + required this.iterable, | |
| 2960 | + }); | |
| 2961 | + | |
| 2962 | + factory Iterable.fromJson(Map<String, dynamic> json) => Iterable( | |
| 2963 | + iterable: json["iterable"], | |
| 2964 | + ); | |
| 2965 | + | |
| 2966 | + Map<String, dynamic> toJson() => { | |
| 2967 | + "iterable": iterable, | |
| 2968 | + }; | |
| 2969 | +} | |
| 2970 | + | |
| 2971 | +class Jdec { | |
| 2972 | + final int jdec; | |
| 2973 | + | |
| 2974 | + Jdec({ | |
| 2975 | + required this.jdec, | |
| 2976 | + }); | |
| 2977 | + | |
| 2978 | + factory Jdec.fromJson(Map<String, dynamic> json) => Jdec( | |
| 2979 | + jdec: json["jdec"], | |
| 2980 | + ); | |
| 2981 | + | |
| 2982 | + Map<String, dynamic> toJson() => { | |
| 2983 | + "jdec": jdec, | |
| 2984 | + }; | |
| 2985 | +} | |
| 2986 | + | |
| 2987 | +class Jenc { | |
| 2988 | + final int jenc; | |
| 2989 | + | |
| 2990 | + Jenc({ | |
| 2991 | + required this.jenc, | |
| 2992 | + }); | |
| 2993 | + | |
| 2994 | + factory Jenc.fromJson(Map<String, dynamic> json) => Jenc( | |
| 2995 | + jenc: json["jenc"], | |
| 2996 | + ); | |
| 2997 | + | |
| 2998 | + Map<String, dynamic> toJson() => { | |
| 2999 | + "jenc": jenc, | |
| 3000 | + }; | |
| 3001 | +} | |
| 3002 | + | |
| 3003 | +class Jpipe { | |
| 3004 | + final int jpipe; | |
| 3005 | + | |
| 3006 | + Jpipe({ | |
| 3007 | + required this.jpipe, | |
| 3008 | + }); | |
| 3009 | + | |
| 3010 | + factory Jpipe.fromJson(Map<String, dynamic> json) => Jpipe( | |
| 3011 | + jpipe: json["jpipe"], | |
| 3012 | + ); | |
| 3013 | + | |
| 3014 | + Map<String, dynamic> toJson() => { | |
| 3015 | + "jpipe": jpipe, | |
| 3016 | + }; | |
| 3017 | +} | |
| 3018 | + | |
| 3019 | +class Json { | |
| 3020 | + final int json; | |
| 3021 | + | |
| 3022 | + Json({ | |
| 3023 | + required this.json, | |
| 3024 | + }); | |
| 3025 | + | |
| 3026 | + factory Json.fromJson(Map<String, dynamic> json) => Json( | |
| 3027 | + json: json["json"], | |
| 3028 | + ); | |
| 3029 | + | |
| 3030 | + Map<String, dynamic> toJson() => { | |
| 3031 | + "json": json, | |
| 3032 | + }; | |
| 3033 | +} | |
| 3034 | + | |
| 3035 | +class JsonConverter { | |
| 3036 | + final int jsonConverter; | |
| 3037 | + | |
| 3038 | + JsonConverter({ | |
| 3039 | + required this.jsonConverter, | |
| 3040 | + }); | |
| 3041 | + | |
| 3042 | + factory JsonConverter.fromJson(Map<String, dynamic> json) => JsonConverter( | |
| 3043 | + jsonConverter: json["json_converter"], | |
| 3044 | + ); | |
| 3045 | + | |
| 3046 | + Map<String, dynamic> toJson() => { | |
| 3047 | + "json_converter": jsonConverter, | |
| 3048 | + }; | |
| 3049 | +} | |
| 3050 | + | |
| 3051 | +class JsonSerializer { | |
| 3052 | + final int jsonSerializer; | |
| 3053 | + | |
| 3054 | + JsonSerializer({ | |
| 3055 | + required this.jsonSerializer, | |
| 3056 | + }); | |
| 3057 | + | |
| 3058 | + factory JsonSerializer.fromJson(Map<String, dynamic> json) => JsonSerializer( | |
| 3059 | + jsonSerializer: json["json_serializer"], | |
| 3060 | + ); | |
| 3061 | + | |
| 3062 | + Map<String, dynamic> toJson() => { | |
| 3063 | + "json_serializer": jsonSerializer, | |
| 3064 | + }; | |
| 3065 | +} | |
| 3066 | + | |
| 3067 | +class JsonToken { | |
| 3068 | + final int jsonToken; | |
| 3069 | + | |
| 3070 | + JsonToken({ | |
| 3071 | + required this.jsonToken, | |
| 3072 | + }); | |
| 3073 | + | |
| 3074 | + factory JsonToken.fromJson(Map<String, dynamic> json) => JsonToken( | |
| 3075 | + jsonToken: json["json_token"], | |
| 3076 | + ); | |
| 3077 | + | |
| 3078 | + Map<String, dynamic> toJson() => { | |
| 3079 | + "json_token": jsonToken, | |
| 3080 | + }; | |
| 3081 | +} | |
| 3082 | + | |
| 3083 | +class JsonWriter { | |
| 3084 | + final int jsonWriter; | |
| 3085 | + | |
| 3086 | + JsonWriter({ | |
| 3087 | + required this.jsonWriter, | |
| 3088 | + }); | |
| 3089 | + | |
| 3090 | + factory JsonWriter.fromJson(Map<String, dynamic> json) => JsonWriter( | |
| 3091 | + jsonWriter: json["json_writer"], | |
| 3092 | + ); | |
| 3093 | + | |
| 3094 | + Map<String, dynamic> toJson() => { | |
| 3095 | + "json_writer": jsonWriter, | |
| 3096 | + }; | |
| 3097 | +} | |
| 3098 | + | |
| 3099 | +class Lambda { | |
| 3100 | + final int lambda; | |
| 3101 | + | |
| 3102 | + Lambda({ | |
| 3103 | + required this.lambda, | |
| 3104 | + }); | |
| 3105 | + | |
| 3106 | + factory Lambda.fromJson(Map<String, dynamic> json) => Lambda( | |
| 3107 | + lambda: json["lambda"], | |
| 3108 | + ); | |
| 3109 | + | |
| 3110 | + Map<String, dynamic> toJson() => { | |
| 3111 | + "lambda": lambda, | |
| 3112 | + }; | |
| 3113 | +} | |
| 3114 | + | |
| 3115 | +class Lazy { | |
| 3116 | + final int lazy; | |
| 3117 | + | |
| 3118 | + Lazy({ | |
| 3119 | + required this.lazy, | |
| 3120 | + }); | |
| 3121 | + | |
| 3122 | + factory Lazy.fromJson(Map<String, dynamic> json) => Lazy( | |
| 3123 | + lazy: json["lazy"], | |
| 3124 | + ); | |
| 3125 | + | |
| 3126 | + Map<String, dynamic> toJson() => { | |
| 3127 | + "lazy": lazy, | |
| 3128 | + }; | |
| 3129 | +} | |
| 3130 | + | |
| 3131 | +class Left { | |
| 3132 | + final int left; | |
| 3133 | + | |
| 3134 | + Left({ | |
| 3135 | + required this.left, | |
| 3136 | + }); | |
| 3137 | + | |
| 3138 | + factory Left.fromJson(Map<String, dynamic> json) => Left( | |
| 3139 | + left: json["left"], | |
| 3140 | + ); | |
| 3141 | + | |
| 3142 | + Map<String, dynamic> toJson() => { | |
| 3143 | + "left": left, | |
| 3144 | + }; | |
| 3145 | +} | |
| 3146 | + | |
| 3147 | +class Let { | |
| 3148 | + final int let; | |
| 3149 | + | |
| 3150 | + Let({ | |
| 3151 | + required this.let, | |
| 3152 | + }); | |
| 3153 | + | |
| 3154 | + factory Let.fromJson(Map<String, dynamic> json) => Let( | |
| 3155 | + let: json["let"], | |
| 3156 | + ); | |
| 3157 | + | |
| 3158 | + Map<String, dynamic> toJson() => { | |
| 3159 | + "let": let, | |
| 3160 | + }; | |
| 3161 | +} | |
| 3162 | + | |
| 3163 | +class ListClass { | |
| 3164 | + final int list; | |
| 3165 | + | |
| 3166 | + ListClass({ | |
| 3167 | + required this.list, | |
| 3168 | + }); | |
| 3169 | + | |
| 3170 | + factory ListClass.fromJson(Map<String, dynamic> json) => ListClass( | |
| 3171 | + list: json["list"], | |
| 3172 | + ); | |
| 3173 | + | |
| 3174 | + Map<String, dynamic> toJson() => { | |
| 3175 | + "list": list, | |
| 3176 | + }; | |
| 3177 | +} | |
| 3178 | + | |
| 3179 | +class Lock { | |
| 3180 | + final int lock; | |
| 3181 | + | |
| 3182 | + Lock({ | |
| 3183 | + required this.lock, | |
| 3184 | + }); | |
| 3185 | + | |
| 3186 | + factory Lock.fromJson(Map<String, dynamic> json) => Lock( | |
| 3187 | + lock: json["lock"], | |
| 3188 | + ); | |
| 3189 | + | |
| 3190 | + Map<String, dynamic> toJson() => { | |
| 3191 | + "lock": lock, | |
| 3192 | + }; | |
| 3193 | +} | |
| 3194 | + | |
| 3195 | +class Long { | |
| 3196 | + final int long; | |
| 3197 | + | |
| 3198 | + Long({ | |
| 3199 | + required this.long, | |
| 3200 | + }); | |
| 3201 | + | |
| 3202 | + factory Long.fromJson(Map<String, dynamic> json) => Long( | |
| 3203 | + long: json["long"], | |
| 3204 | + ); | |
| 3205 | + | |
| 3206 | + Map<String, dynamic> toJson() => { | |
| 3207 | + "long": long, | |
| 3208 | + }; | |
| 3209 | +} | |
| 3210 | + | |
| 3211 | +class MapClass { | |
| 3212 | + final int map; | |
| 3213 | + | |
| 3214 | + MapClass({ | |
| 3215 | + required this.map, | |
| 3216 | + }); | |
| 3217 | + | |
| 3218 | + factory MapClass.fromJson(Map<String, dynamic> json) => MapClass( | |
| 3219 | + map: json["map"], | |
| 3220 | + ); | |
| 3221 | + | |
| 3222 | + Map<String, dynamic> toJson() => { | |
| 3223 | + "map": map, | |
| 3224 | + }; | |
| 3225 | +} | |
| 3226 | + | |
| 3227 | +class MetadataPropertyHandling { | |
| 3228 | + final int metadataPropertyHandling; | |
| 3229 | + | |
| 3230 | + MetadataPropertyHandling({ | |
| 3231 | + required this.metadataPropertyHandling, | |
| 3232 | + }); | |
| 3233 | + | |
| 3234 | + factory MetadataPropertyHandling.fromJson(Map<String, dynamic> json) => MetadataPropertyHandling( | |
| 3235 | + metadataPropertyHandling: json["metadata_property_handling"], | |
| 3236 | + ); | |
| 3237 | + | |
| 3238 | + Map<String, dynamic> toJson() => { | |
| 3239 | + "metadata_property_handling": metadataPropertyHandling, | |
| 3240 | + }; | |
| 3241 | +} | |
| 3242 | + | |
| 3243 | +class Module { | |
| 3244 | + final int module; | |
| 3245 | + | |
| 3246 | + Module({ | |
| 3247 | + required this.module, | |
| 3248 | + }); | |
| 3249 | + | |
| 3250 | + factory Module.fromJson(Map<String, dynamic> json) => Module( | |
| 3251 | + module: json["module"], | |
| 3252 | + ); | |
| 3253 | + | |
| 3254 | + Map<String, dynamic> toJson() => { | |
| 3255 | + "module": module, | |
| 3256 | + }; | |
| 3257 | +} | |
| 3258 | + | |
| 3259 | +class Mutable { | |
| 3260 | + final int mutable; | |
| 3261 | + | |
| 3262 | + Mutable({ | |
| 3263 | + required this.mutable, | |
| 3264 | + }); | |
| 3265 | + | |
| 3266 | + factory Mutable.fromJson(Map<String, dynamic> json) => Mutable( | |
| 3267 | + mutable: json["mutable"], | |
| 3268 | + ); | |
| 3269 | + | |
| 3270 | + Map<String, dynamic> toJson() => { | |
| 3271 | + "mutable": mutable, | |
| 3272 | + }; | |
| 3273 | +} | |
| 3274 | + | |
| 3275 | +class Mutating { | |
| 3276 | + final int mutating; | |
| 3277 | + | |
| 3278 | + Mutating({ | |
| 3279 | + required this.mutating, | |
| 3280 | + }); | |
| 3281 | + | |
| 3282 | + factory Mutating.fromJson(Map<String, dynamic> json) => Mutating( | |
| 3283 | + mutating: json["mutating"], | |
| 3284 | + ); | |
| 3285 | + | |
| 3286 | + Map<String, dynamic> toJson() => { | |
| 3287 | + "mutating": mutating, | |
| 3288 | + }; | |
| 3289 | +} | |
| 3290 | + | |
| 3291 | +class Namespace { | |
| 3292 | + final int namespace; | |
| 3293 | + | |
| 3294 | + Namespace({ | |
| 3295 | + required this.namespace, | |
| 3296 | + }); | |
| 3297 | + | |
| 3298 | + factory Namespace.fromJson(Map<String, dynamic> json) => Namespace( | |
| 3299 | + namespace: json["namespace"], | |
| 3300 | + ); | |
| 3301 | + | |
| 3302 | + Map<String, dynamic> toJson() => { | |
| 3303 | + "namespace": namespace, | |
| 3304 | + }; | |
| 3305 | +} | |
| 3306 | + | |
| 3307 | +class Native { | |
| 3308 | + final int native; | |
| 3309 | + | |
| 3310 | + Native({ | |
| 3311 | + required this.native, | |
| 3312 | + }); | |
| 3313 | + | |
| 3314 | + factory Native.fromJson(Map<String, dynamic> json) => Native( | |
| 3315 | + native: json["native"], | |
| 3316 | + ); | |
| 3317 | + | |
| 3318 | + Map<String, dynamic> toJson() => { | |
| 3319 | + "native": native, | |
| 3320 | + }; | |
| 3321 | +} | |
| 3322 | + | |
| 3323 | +class Newtonsoft { | |
| 3324 | + final int newtonsoft; | |
| 3325 | + | |
| 3326 | + Newtonsoft({ | |
| 3327 | + required this.newtonsoft, | |
| 3328 | + }); | |
| 3329 | + | |
| 3330 | + factory Newtonsoft.fromJson(Map<String, dynamic> json) => Newtonsoft( | |
| 3331 | + newtonsoft: json["newtonsoft"], | |
| 3332 | + ); | |
| 3333 | + | |
| 3334 | + Map<String, dynamic> toJson() => { | |
| 3335 | + "newtonsoft": newtonsoft, | |
| 3336 | + }; | |
| 3337 | +} | |
| 3338 | + | |
| 3339 | +class Nil { | |
| 3340 | + final int nil; | |
| 3341 | + | |
| 3342 | + Nil({ | |
| 3343 | + required this.nil, | |
| 3344 | + }); | |
| 3345 | + | |
| 3346 | + factory Nil.fromJson(Map<String, dynamic> json) => Nil( | |
| 3347 | + nil: json["nil"], | |
| 3348 | + ); | |
| 3349 | + | |
| 3350 | + Map<String, dynamic> toJson() => { | |
| 3351 | + "nil": nil, | |
| 3352 | + }; | |
| 3353 | +} | |
| 3354 | + | |
| 3355 | +class No { | |
| 3356 | + final int no; | |
| 3357 | + | |
| 3358 | + No({ | |
| 3359 | + required this.no, | |
| 3360 | + }); | |
| 3361 | + | |
| 3362 | + factory No.fromJson(Map<String, dynamic> json) => No( | |
| 3363 | + no: json["NO"], | |
| 3364 | + ); | |
| 3365 | + | |
| 3366 | + Map<String, dynamic> toJson() => { | |
| 3367 | + "NO": no, | |
| 3368 | + }; | |
| 3369 | +} | |
| 3370 | + | |
| 3371 | +class Noexcept { | |
| 3372 | + final int noexcept; | |
| 3373 | + | |
| 3374 | + Noexcept({ | |
| 3375 | + required this.noexcept, | |
| 3376 | + }); | |
| 3377 | + | |
| 3378 | + factory Noexcept.fromJson(Map<String, dynamic> json) => Noexcept( | |
| 3379 | + noexcept: json["noexcept"], | |
| 3380 | + ); | |
| 3381 | + | |
| 3382 | + Map<String, dynamic> toJson() => { | |
| 3383 | + "noexcept": noexcept, | |
| 3384 | + }; | |
| 3385 | +} | |
| 3386 | + | |
| 3387 | +class Nonatomic { | |
| 3388 | + final int nonatomic; | |
| 3389 | + | |
| 3390 | + Nonatomic({ | |
| 3391 | + required this.nonatomic, | |
| 3392 | + }); | |
| 3393 | + | |
| 3394 | + factory Nonatomic.fromJson(Map<String, dynamic> json) => Nonatomic( | |
| 3395 | + nonatomic: json["nonatomic"], | |
| 3396 | + ); | |
| 3397 | + | |
| 3398 | + Map<String, dynamic> toJson() => { | |
| 3399 | + "nonatomic": nonatomic, | |
| 3400 | + }; | |
| 3401 | +} | |
| 3402 | + | |
| 3403 | +class None { | |
| 3404 | + final int none; | |
| 3405 | + | |
| 3406 | + None({ | |
| 3407 | + required this.none, | |
| 3408 | + }); | |
| 3409 | + | |
| 3410 | + factory None.fromJson(Map<String, dynamic> json) => None( | |
| 3411 | + none: json["None"], | |
| 3412 | + ); | |
| 3413 | + | |
| 3414 | + Map<String, dynamic> toJson() => { | |
| 3415 | + "None": none, | |
| 3416 | + }; | |
| 3417 | +} | |
| 3418 | + | |
| 3419 | +class Nonlocal { | |
| 3420 | + final int nonlocal; | |
| 3421 | + | |
| 3422 | + Nonlocal({ | |
| 3423 | + required this.nonlocal, | |
| 3424 | + }); | |
| 3425 | + | |
| 3426 | + factory Nonlocal.fromJson(Map<String, dynamic> json) => Nonlocal( | |
| 3427 | + nonlocal: json["nonlocal"], | |
| 3428 | + ); | |
| 3429 | + | |
| 3430 | + Map<String, dynamic> toJson() => { | |
| 3431 | + "nonlocal": nonlocal, | |
| 3432 | + }; | |
| 3433 | +} | |
| 3434 | + | |
| 3435 | +class Nonmutating { | |
| 3436 | + final int nonmutating; | |
| 3437 | + | |
| 3438 | + Nonmutating({ | |
| 3439 | + required this.nonmutating, | |
| 3440 | + }); | |
| 3441 | + | |
| 3442 | + factory Nonmutating.fromJson(Map<String, dynamic> json) => Nonmutating( | |
| 3443 | + nonmutating: json["nonmutating"], | |
| 3444 | + ); | |
| 3445 | + | |
| 3446 | + Map<String, dynamic> toJson() => { | |
| 3447 | + "nonmutating": nonmutating, | |
| 3448 | + }; | |
| 3449 | +} | |
| 3450 | + | |
| 3451 | +class Not { | |
| 3452 | + final int not; | |
| 3453 | + | |
| 3454 | + Not({ | |
| 3455 | + required this.not, | |
| 3456 | + }); | |
| 3457 | + | |
| 3458 | + factory Not.fromJson(Map<String, dynamic> json) => Not( | |
| 3459 | + not: json["not"], | |
| 3460 | + ); | |
| 3461 | + | |
| 3462 | + Map<String, dynamic> toJson() => { | |
| 3463 | + "not": not, | |
| 3464 | + }; | |
| 3465 | +} | |
| 3466 | + | |
| 3467 | +class NotEq { | |
| 3468 | + final int notEq; | |
| 3469 | + | |
| 3470 | + NotEq({ | |
| 3471 | + required this.notEq, | |
| 3472 | + }); | |
| 3473 | + | |
| 3474 | + factory NotEq.fromJson(Map<String, dynamic> json) => NotEq( | |
| 3475 | + notEq: json["not_eq"], | |
| 3476 | + ); | |
| 3477 | + | |
| 3478 | + Map<String, dynamic> toJson() => { | |
| 3479 | + "not_eq": notEq, | |
| 3480 | + }; | |
| 3481 | +} | |
| 3482 | + | |
| 3483 | +class NsString { | |
| 3484 | + final int nsString; | |
| 3485 | + | |
| 3486 | + NsString({ | |
| 3487 | + required this.nsString, | |
| 3488 | + }); | |
| 3489 | + | |
| 3490 | + factory NsString.fromJson(Map<String, dynamic> json) => NsString( | |
| 3491 | + nsString: json["NSString"], | |
| 3492 | + ); | |
| 3493 | + | |
| 3494 | + Map<String, dynamic> toJson() => { | |
| 3495 | + "NSString": nsString, | |
| 3496 | + }; | |
| 3497 | +} | |
| 3498 | + | |
| 3499 | +class Nullptr { | |
| 3500 | + final int nullptr; | |
| 3501 | + | |
| 3502 | + Nullptr({ | |
| 3503 | + required this.nullptr, | |
| 3504 | + }); | |
| 3505 | + | |
| 3506 | + factory Nullptr.fromJson(Map<String, dynamic> json) => Nullptr( | |
| 3507 | + nullptr: json["nullptr"], | |
| 3508 | + ); | |
| 3509 | + | |
| 3510 | + Map<String, dynamic> toJson() => { | |
| 3511 | + "nullptr": nullptr, | |
| 3512 | + }; | |
| 3513 | +} | |
| 3514 | + | |
| 3515 | +class Number { | |
| 3516 | + final int number; | |
| 3517 | + | |
| 3518 | + Number({ | |
| 3519 | + required this.number, | |
| 3520 | + }); | |
| 3521 | + | |
| 3522 | + factory Number.fromJson(Map<String, dynamic> json) => Number( | |
| 3523 | + number: json["number"], | |
| 3524 | + ); | |
| 3525 | + | |
| 3526 | + Map<String, dynamic> toJson() => { | |
| 3527 | + "number": number, | |
| 3528 | + }; | |
| 3529 | +} | |
| 3530 | + | |
| 3531 | +class Is { | |
| 3532 | + final int isIs; | |
| 3533 | + | |
| 3534 | + Is({ | |
| 3535 | + required this.isIs, | |
| 3536 | + }); | |
| 3537 | + | |
| 3538 | + factory Is.fromJson(Map<String, dynamic> json) => Is( | |
| 3539 | + isIs: json["is"], | |
| 3540 | + ); | |
| 3541 | + | |
| 3542 | + Map<String, dynamic> toJson() => { | |
| 3543 | + "is": isIs, | |
| 3544 | + }; | |
| 3545 | +} | |
| 3546 | + | |
| 3547 | +class New { | |
| 3548 | + final int newNew; | |
| 3549 | + | |
| 3550 | + New({ | |
| 3551 | + required this.newNew, | |
| 3552 | + }); | |
| 3553 | + | |
| 3554 | + factory New.fromJson(Map<String, dynamic> json) => New( | |
| 3555 | + newNew: json["new"], | |
| 3556 | + ); | |
| 3557 | + | |
| 3558 | + Map<String, dynamic> toJson() => { | |
| 3559 | + "new": newNew, | |
| 3560 | + }; | |
| 3561 | +} | |
| 3562 | + | |
| 3563 | +class NoneClass { | |
| 3564 | + final int none; | |
| 3565 | + | |
| 3566 | + NoneClass({ | |
| 3567 | + required this.none, | |
| 3568 | + }); | |
| 3569 | + | |
| 3570 | + factory NoneClass.fromJson(Map<String, dynamic> json) => NoneClass( | |
| 3571 | + none: json["none"], | |
| 3572 | + ); | |
| 3573 | + | |
| 3574 | + Map<String, dynamic> toJson() => { | |
| 3575 | + "none": none, | |
| 3576 | + }; | |
| 3577 | +} | |
| 3578 | + | |
| 3579 | +class Null { | |
| 3580 | + final int nullNull; | |
| 3581 | + | |
| 3582 | + Null({ | |
| 3583 | + required this.nullNull, | |
| 3584 | + }); | |
| 3585 | + | |
| 3586 | + factory Null.fromJson(Map<String, dynamic> json) => Null( | |
| 3587 | + nullNull: json["NULL"], | |
| 3588 | + ); | |
| 3589 | + | |
| 3590 | + Map<String, dynamic> toJson() => { | |
| 3591 | + "NULL": nullNull, | |
| 3592 | + }; | |
| 3593 | +} | |
| 3594 | + | |
| 3595 | +class Operator { | |
| 3596 | + final int operatorOperator; | |
| 3597 | + | |
| 3598 | + Operator({ | |
| 3599 | + required this.operatorOperator, | |
| 3600 | + }); | |
| 3601 | + | |
| 3602 | + factory Operator.fromJson(Map<String, dynamic> json) => Operator( | |
| 3603 | + operatorOperator: json["operator"], | |
| 3604 | + ); | |
| 3605 | + | |
| 3606 | + Map<String, dynamic> toJson() => { | |
| 3607 | + "operator": operatorOperator, | |
| 3608 | + }; | |
| 3609 | +} | |
| 3610 | + | |
| 3611 | +class ProtocolClass { | |
| 3612 | + final int protocol; | |
| 3613 | + | |
| 3614 | + ProtocolClass({ | |
| 3615 | + required this.protocol, | |
| 3616 | + }); | |
| 3617 | + | |
| 3618 | + factory ProtocolClass.fromJson(Map<String, dynamic> json) => ProtocolClass( | |
| 3619 | + protocol: json["protocol"], | |
| 3620 | + ); | |
| 3621 | + | |
| 3622 | + Map<String, dynamic> toJson() => { | |
| 3623 | + "protocol": protocol, | |
| 3624 | + }; | |
| 3625 | +} | |
| 3626 | + | |
| 3627 | +class Object { | |
| 3628 | + final int object; | |
| 3629 | + | |
| 3630 | + Object({ | |
| 3631 | + required this.object, | |
| 3632 | + }); | |
| 3633 | + | |
| 3634 | + factory Object.fromJson(Map<String, dynamic> json) => Object( | |
| 3635 | + object: json["object"], | |
| 3636 | + ); | |
| 3637 | + | |
| 3638 | + Map<String, dynamic> toJson() => { | |
| 3639 | + "object": object, | |
| 3640 | + }; | |
| 3641 | +} | |
| 3642 | + | |
| 3643 | +class Of { | |
| 3644 | + final int of; | |
| 3645 | + | |
| 3646 | + Of({ | |
| 3647 | + required this.of, | |
| 3648 | + }); | |
| 3649 | + | |
| 3650 | + factory Of.fromJson(Map<String, dynamic> json) => Of( | |
| 3651 | + of: json["of"], | |
| 3652 | + ); | |
| 3653 | + | |
| 3654 | + Map<String, dynamic> toJson() => { | |
| 3655 | + "of": of, | |
| 3656 | + }; | |
| 3657 | +} | |
| 3658 | + | |
| 3659 | +class Oneway { | |
| 3660 | + final int oneway; | |
| 3661 | + | |
| 3662 | + Oneway({ | |
| 3663 | + required this.oneway, | |
| 3664 | + }); | |
| 3665 | + | |
| 3666 | + factory Oneway.fromJson(Map<String, dynamic> json) => Oneway( | |
| 3667 | + oneway: json["oneway"], | |
| 3668 | + ); | |
| 3669 | + | |
| 3670 | + Map<String, dynamic> toJson() => { | |
| 3671 | + "oneway": oneway, | |
| 3672 | + }; | |
| 3673 | +} | |
| 3674 | + | |
| 3675 | +class Open { | |
| 3676 | + final int open; | |
| 3677 | + | |
| 3678 | + Open({ | |
| 3679 | + required this.open, | |
| 3680 | + }); | |
| 3681 | + | |
| 3682 | + factory Open.fromJson(Map<String, dynamic> json) => Open( | |
| 3683 | + open: json["open"], | |
| 3684 | + ); | |
| 3685 | + | |
| 3686 | + Map<String, dynamic> toJson() => { | |
| 3687 | + "open": open, | |
| 3688 | + }; | |
| 3689 | +} | |
| 3690 | + | |
| 3691 | +class Optional { | |
| 3692 | + final int optional; | |
| 3693 | + | |
| 3694 | + Optional({ | |
| 3695 | + required this.optional, | |
| 3696 | + }); | |
| 3697 | + | |
| 3698 | + factory Optional.fromJson(Map<String, dynamic> json) => Optional( | |
| 3699 | + optional: json["optional"], | |
| 3700 | + ); | |
| 3701 | + | |
| 3702 | + Map<String, dynamic> toJson() => { | |
| 3703 | + "optional": optional, | |
| 3704 | + }; | |
| 3705 | +} | |
| 3706 | + | |
| 3707 | +class Or { | |
| 3708 | + final int or; | |
| 3709 | + | |
| 3710 | + Or({ | |
| 3711 | + required this.or, | |
| 3712 | + }); | |
| 3713 | + | |
| 3714 | + factory Or.fromJson(Map<String, dynamic> json) => Or( | |
| 3715 | + or: json["or"], | |
| 3716 | + ); | |
| 3717 | + | |
| 3718 | + Map<String, dynamic> toJson() => { | |
| 3719 | + "or": or, | |
| 3720 | + }; | |
| 3721 | +} | |
| 3722 | + | |
| 3723 | +class OrEq { | |
| 3724 | + final int orEq; | |
| 3725 | + | |
| 3726 | + OrEq({ | |
| 3727 | + required this.orEq, | |
| 3728 | + }); | |
| 3729 | + | |
| 3730 | + factory OrEq.fromJson(Map<String, dynamic> json) => OrEq( | |
| 3731 | + orEq: json["or_eq"], | |
| 3732 | + ); | |
| 3733 | + | |
| 3734 | + Map<String, dynamic> toJson() => { | |
| 3735 | + "or_eq": orEq, | |
| 3736 | + }; | |
| 3737 | +} | |
| 3738 | + | |
| 3739 | +class Out { | |
| 3740 | + final int out; | |
| 3741 | + | |
| 3742 | + Out({ | |
| 3743 | + required this.out, | |
| 3744 | + }); | |
| 3745 | + | |
| 3746 | + factory Out.fromJson(Map<String, dynamic> json) => Out( | |
| 3747 | + out: json["out"], | |
| 3748 | + ); | |
| 3749 | + | |
| 3750 | + Map<String, dynamic> toJson() => { | |
| 3751 | + "out": out, | |
| 3752 | + }; | |
| 3753 | +} | |
| 3754 | + | |
| 3755 | +class Override { | |
| 3756 | + final int override; | |
| 3757 | + | |
| 3758 | + Override({ | |
| 3759 | + required this.override, | |
| 3760 | + }); | |
| 3761 | + | |
| 3762 | + factory Override.fromJson(Map<String, dynamic> json) => Override( | |
| 3763 | + override: json["override"], | |
| 3764 | + ); | |
| 3765 | + | |
| 3766 | + Map<String, dynamic> toJson() => { | |
| 3767 | + "override": override, | |
| 3768 | + }; | |
| 3769 | +} | |
| 3770 | + | |
| 3771 | +class Package { | |
| 3772 | + final int package; | |
| 3773 | + | |
| 3774 | + Package({ | |
| 3775 | + required this.package, | |
| 3776 | + }); | |
| 3777 | + | |
| 3778 | + factory Package.fromJson(Map<String, dynamic> json) => Package( | |
| 3779 | + package: json["package"], | |
| 3780 | + ); | |
| 3781 | + | |
| 3782 | + Map<String, dynamic> toJson() => { | |
| 3783 | + "package": package, | |
| 3784 | + }; | |
| 3785 | +} | |
| 3786 | + | |
| 3787 | +class Params { | |
| 3788 | + final int params; | |
| 3789 | + | |
| 3790 | + Params({ | |
| 3791 | + required this.params, | |
| 3792 | + }); | |
| 3793 | + | |
| 3794 | + factory Params.fromJson(Map<String, dynamic> json) => Params( | |
| 3795 | + params: json["params"], | |
| 3796 | + ); | |
| 3797 | + | |
| 3798 | + Map<String, dynamic> toJson() => { | |
| 3799 | + "params": params, | |
| 3800 | + }; | |
| 3801 | +} | |
| 3802 | + | |
| 3803 | +class Pass { | |
| 3804 | + final int pass; | |
| 3805 | + | |
| 3806 | + Pass({ | |
| 3807 | + required this.pass, | |
| 3808 | + }); | |
| 3809 | + | |
| 3810 | + factory Pass.fromJson(Map<String, dynamic> json) => Pass( | |
| 3811 | + pass: json["pass"], | |
| 3812 | + ); | |
| 3813 | + | |
| 3814 | + Map<String, dynamic> toJson() => { | |
| 3815 | + "pass": pass, | |
| 3816 | + }; | |
| 3817 | +} | |
| 3818 | + | |
| 3819 | +class Port { | |
| 3820 | + final int port; | |
| 3821 | + | |
| 3822 | + Port({ | |
| 3823 | + required this.port, | |
| 3824 | + }); | |
| 3825 | + | |
| 3826 | + factory Port.fromJson(Map<String, dynamic> json) => Port( | |
| 3827 | + port: json["port"], | |
| 3828 | + ); | |
| 3829 | + | |
| 3830 | + Map<String, dynamic> toJson() => { | |
| 3831 | + "port": port, | |
| 3832 | + }; | |
| 3833 | +} | |
| 3834 | + | |
| 3835 | +class Postfix { | |
| 3836 | + final int postfix; | |
| 3837 | + | |
| 3838 | + Postfix({ | |
| 3839 | + required this.postfix, | |
| 3840 | + }); | |
| 3841 | + | |
| 3842 | + factory Postfix.fromJson(Map<String, dynamic> json) => Postfix( | |
| 3843 | + postfix: json["postfix"], | |
| 3844 | + ); | |
| 3845 | + | |
| 3846 | + Map<String, dynamic> toJson() => { | |
| 3847 | + "postfix": postfix, | |
| 3848 | + }; | |
| 3849 | +} | |
| 3850 | + | |
| 3851 | +class Precedence { | |
| 3852 | + final int precedence; | |
| 3853 | + | |
| 3854 | + Precedence({ | |
| 3855 | + required this.precedence, | |
| 3856 | + }); | |
| 3857 | + | |
| 3858 | + factory Precedence.fromJson(Map<String, dynamic> json) => Precedence( | |
| 3859 | + precedence: json["precedence"], | |
| 3860 | + ); | |
| 3861 | + | |
| 3862 | + Map<String, dynamic> toJson() => { | |
| 3863 | + "precedence": precedence, | |
| 3864 | + }; | |
| 3865 | +} | |
| 3866 | + | |
| 3867 | +class Prefix { | |
| 3868 | + final int prefix; | |
| 3869 | + | |
| 3870 | + Prefix({ | |
| 3871 | + required this.prefix, | |
| 3872 | + }); | |
| 3873 | + | |
| 3874 | + factory Prefix.fromJson(Map<String, dynamic> json) => Prefix( | |
| 3875 | + prefix: json["prefix"], | |
| 3876 | + ); | |
| 3877 | + | |
| 3878 | + Map<String, dynamic> toJson() => { | |
| 3879 | + "prefix": prefix, | |
| 3880 | + }; | |
| 3881 | +} | |
| 3882 | + | |
| 3883 | +class Print { | |
| 3884 | + final int print; | |
| 3885 | + | |
| 3886 | + Print({ | |
| 3887 | + required this.print, | |
| 3888 | + }); | |
| 3889 | + | |
| 3890 | + factory Print.fromJson(Map<String, dynamic> json) => Print( | |
| 3891 | + print: json["print"], | |
| 3892 | + ); | |
| 3893 | + | |
| 3894 | + Map<String, dynamic> toJson() => { | |
| 3895 | + "print": print, | |
| 3896 | + }; | |
| 3897 | +} | |
| 3898 | + | |
| 3899 | +class PrintMembers { | |
| 3900 | + final int printMembers; | |
| 3901 | + | |
| 3902 | + PrintMembers({ | |
| 3903 | + required this.printMembers, | |
| 3904 | + }); | |
| 3905 | + | |
| 3906 | + factory PrintMembers.fromJson(Map<String, dynamic> json) => PrintMembers( | |
| 3907 | + printMembers: json["printMembers"], | |
| 3908 | + ); | |
| 3909 | + | |
| 3910 | + Map<String, dynamic> toJson() => { | |
| 3911 | + "printMembers": printMembers, | |
| 3912 | + }; | |
| 3913 | +} | |
| 3914 | + | |
| 3915 | +class Printf { | |
| 3916 | + final int printf; | |
| 3917 | + | |
| 3918 | + Printf({ | |
| 3919 | + required this.printf, | |
| 3920 | + }); | |
| 3921 | + | |
| 3922 | + factory Printf.fromJson(Map<String, dynamic> json) => Printf( | |
| 3923 | + printf: json["printf"], | |
| 3924 | + ); | |
| 3925 | + | |
| 3926 | + Map<String, dynamic> toJson() => { | |
| 3927 | + "printf": printf, | |
| 3928 | + }; | |
| 3929 | +} | |
| 3930 | + | |
| 3931 | +class Private { | |
| 3932 | + final int private; | |
| 3933 | + | |
| 3934 | + Private({ | |
| 3935 | + required this.private, | |
| 3936 | + }); | |
| 3937 | + | |
| 3938 | + factory Private.fromJson(Map<String, dynamic> json) => Private( | |
| 3939 | + private: json["private"], | |
| 3940 | + ); | |
| 3941 | + | |
| 3942 | + Map<String, dynamic> toJson() => { | |
| 3943 | + "private": private, | |
| 3944 | + }; | |
| 3945 | +} | |
| 3946 | + | |
| 3947 | +class Protected { | |
| 3948 | + final int protected; | |
| 3949 | + | |
| 3950 | + Protected({ | |
| 3951 | + required this.protected, | |
| 3952 | + }); | |
| 3953 | + | |
| 3954 | + factory Protected.fromJson(Map<String, dynamic> json) => Protected( | |
| 3955 | + protected: json["protected"], | |
| 3956 | + ); | |
| 3957 | + | |
| 3958 | + Map<String, dynamic> toJson() => { | |
| 3959 | + "protected": protected, | |
| 3960 | + }; | |
| 3961 | +} | |
| 3962 | + | |
| 3963 | +class Protocol { | |
| 3964 | + final int protocol; | |
| 3965 | + | |
| 3966 | + Protocol({ | |
| 3967 | + required this.protocol, | |
| 3968 | + }); | |
| 3969 | + | |
| 3970 | + factory Protocol.fromJson(Map<String, dynamic> json) => Protocol( | |
| 3971 | + protocol: json["Protocol"], | |
| 3972 | + ); | |
| 3973 | + | |
| 3974 | + Map<String, dynamic> toJson() => { | |
| 3975 | + "Protocol": protocol, | |
| 3976 | + }; | |
| 3977 | +} | |
| 3978 | + | |
| 3979 | +class NullClass { | |
| 3980 | + final int nullNull; | |
| 3981 | + | |
| 3982 | + NullClass({ | |
| 3983 | + required this.nullNull, | |
| 3984 | + }); | |
| 3985 | + | |
| 3986 | + factory NullClass.fromJson(Map<String, dynamic> json) => NullClass( | |
| 3987 | + nullNull: json["null"], | |
| 3988 | + ); | |
| 3989 | + | |
| 3990 | + Map<String, dynamic> toJson() => { | |
| 3991 | + "null": nullNull, | |
| 3992 | + }; | |
| 3993 | +} | |
| 3994 | + | |
| 3995 | +class Obj4 { | |
| 3996 | + final int dummy; | |
| 3997 | + final Return obj4Return; | |
| 3998 | + final SelfClass obj4Self; | |
| 3999 | + final Set obj4Set; | |
| 4000 | + final Static obj4Static; | |
| 4001 | + final Super obj4Super; | |
| 4002 | + final Switch obj4Switch; | |
| 4003 | + final This obj4This; | |
| 4004 | + final Throw obj4Throw; | |
| 4005 | + final ToJson obj4ToJson; | |
| 4006 | + final True obj4True; | |
| 4007 | + final Try obj4Try; | |
| 4008 | + final TypeClass obj4Type; | |
| 4009 | + final Typedef obj4Typedef; | |
| 4010 | + final Public public; | |
| 4011 | + final TrueClass purpleTrue; | |
| 4012 | + final Quicktype quicktype; | |
| 4013 | + final Raise raise; | |
| 4014 | + final Range range; | |
| 4015 | + final Readonly readonly; | |
| 4016 | + final Ref ref; | |
| 4017 | + final Register register; | |
| 4018 | + final ReinterpretCast reinterpretCast; | |
| 4019 | + final Repeat repeat; | |
| 4020 | + final Require require; | |
| 4021 | + final Required required; | |
| 4022 | + final Requires requires; | |
| 4023 | + final Restrict restrict; | |
| 4024 | + final Retain retain; | |
| 4025 | + final Rethrows rethrows; | |
| 4026 | + final Right right; | |
| 4027 | + final Sbyte sbyte; | |
| 4028 | + final Sealed sealed; | |
| 4029 | + final Sel sel; | |
| 4030 | + final Select select; | |
| 4031 | + final Self self; | |
| 4032 | + final Serialize serialize; | |
| 4033 | + final Short short; | |
| 4034 | + final Signed signed; | |
| 4035 | + final Sizeof sizeof; | |
| 4036 | + final Stackalloc stackalloc; | |
| 4037 | + final StaticAssert staticAssert; | |
| 4038 | + final StaticCast staticCast; | |
| 4039 | + final Strictfp strictfp; | |
| 4040 | + final StringClass string; | |
| 4041 | + final Struct struct; | |
| 4042 | + final Subscript subscript; | |
| 4043 | + final Symbol symbol; | |
| 4044 | + final Synchronized synchronized; | |
| 4045 | + final System system; | |
| 4046 | + final Template template; | |
| 4047 | + final Then then; | |
| 4048 | + final ThreadLocal threadLocal; | |
| 4049 | + final Throws throws; | |
| 4050 | + final TopLevelClass topLevel; | |
| 4051 | + final Transient transient; | |
| 4052 | + final Type type; | |
| 4053 | + final Typealias typealias; | |
| 4054 | + final Typeid typeid; | |
| 4055 | + final Typename typename; | |
| 4056 | + final Typeof typeof; | |
| 4057 | + final Uint uint; | |
| 4058 | + final Ulong ulong; | |
| 4059 | + final Unchecked unchecked; | |
| 4060 | + final Undefined undefined; | |
| 4061 | + | |
| 4062 | + Obj4({ | |
| 4063 | + required this.dummy, | |
| 4064 | + required this.obj4Return, | |
| 4065 | + required this.obj4Self, | |
| 4066 | + required this.obj4Set, | |
| 4067 | + required this.obj4Static, | |
| 4068 | + required this.obj4Super, | |
| 4069 | + required this.obj4Switch, | |
| 4070 | + required this.obj4This, | |
| 4071 | + required this.obj4Throw, | |
| 4072 | + required this.obj4ToJson, | |
| 4073 | + required this.obj4True, | |
| 4074 | + required this.obj4Try, | |
| 4075 | + required this.obj4Type, | |
| 4076 | + required this.obj4Typedef, | |
| 4077 | + required this.public, | |
| 4078 | + required this.purpleTrue, | |
| 4079 | + required this.quicktype, | |
| 4080 | + required this.raise, | |
| 4081 | + required this.range, | |
| 4082 | + required this.readonly, | |
| 4083 | + required this.ref, | |
| 4084 | + required this.register, | |
| 4085 | + required this.reinterpretCast, | |
| 4086 | + required this.repeat, | |
| 4087 | + required this.require, | |
| 4088 | + required this.required, | |
| 4089 | + required this.requires, | |
| 4090 | + required this.restrict, | |
| 4091 | + required this.retain, | |
| 4092 | + required this.rethrows, | |
| 4093 | + required this.right, | |
| 4094 | + required this.sbyte, | |
| 4095 | + required this.sealed, | |
| 4096 | + required this.sel, | |
| 4097 | + required this.select, | |
| 4098 | + required this.self, | |
| 4099 | + required this.serialize, | |
| 4100 | + required this.short, | |
| 4101 | + required this.signed, | |
| 4102 | + required this.sizeof, | |
| 4103 | + required this.stackalloc, | |
| 4104 | + required this.staticAssert, | |
| 4105 | + required this.staticCast, | |
| 4106 | + required this.strictfp, | |
| 4107 | + required this.string, | |
| 4108 | + required this.struct, | |
| 4109 | + required this.subscript, | |
| 4110 | + required this.symbol, | |
| 4111 | + required this.synchronized, | |
| 4112 | + required this.system, | |
| 4113 | + required this.template, | |
| 4114 | + required this.then, | |
| 4115 | + required this.threadLocal, | |
| 4116 | + required this.throws, | |
| 4117 | + required this.topLevel, | |
| 4118 | + required this.transient, | |
| 4119 | + required this.type, | |
| 4120 | + required this.typealias, | |
| 4121 | + required this.typeid, | |
| 4122 | + required this.typename, | |
| 4123 | + required this.typeof, | |
| 4124 | + required this.uint, | |
| 4125 | + required this.ulong, | |
| 4126 | + required this.unchecked, | |
| 4127 | + required this.undefined, | |
| 4128 | + }); | |
| 4129 | + | |
| 4130 | + factory Obj4.fromJson(Map<String, dynamic> json) => Obj4( | |
| 4131 | + dummy: json["dummy"], | |
| 4132 | + obj4Return: Return.fromJson(json["return"]), | |
| 4133 | + obj4Self: SelfClass.fromJson(json["self"]), | |
| 4134 | + obj4Set: Set.fromJson(json["set"]), | |
| 4135 | + obj4Static: Static.fromJson(json["static"]), | |
| 4136 | + obj4Super: Super.fromJson(json["super"]), | |
| 4137 | + obj4Switch: Switch.fromJson(json["switch"]), | |
| 4138 | + obj4This: This.fromJson(json["this"]), | |
| 4139 | + obj4Throw: Throw.fromJson(json["throw"]), | |
| 4140 | + obj4ToJson: ToJson.fromJson(json["to_json"]), | |
| 4141 | + obj4True: True.fromJson(json["True"]), | |
| 4142 | + obj4Try: Try.fromJson(json["try"]), | |
| 4143 | + obj4Type: TypeClass.fromJson(json["type"]), | |
| 4144 | + obj4Typedef: Typedef.fromJson(json["typedef"]), | |
| 4145 | + public: Public.fromJson(json["public"]), | |
| 4146 | + purpleTrue: TrueClass.fromJson(json["true"]), | |
| 4147 | + quicktype: Quicktype.fromJson(json["quicktype"]), | |
| 4148 | + raise: Raise.fromJson(json["raise"]), | |
| 4149 | + range: Range.fromJson(json["range"]), | |
| 4150 | + readonly: Readonly.fromJson(json["readonly"]), | |
| 4151 | + ref: Ref.fromJson(json["ref"]), | |
| 4152 | + register: Register.fromJson(json["register"]), | |
| 4153 | + reinterpretCast: ReinterpretCast.fromJson(json["reinterpret_cast"]), | |
| 4154 | + repeat: Repeat.fromJson(json["repeat"]), | |
| 4155 | + require: Require.fromJson(json["require"]), | |
| 4156 | + required: Required.fromJson(json["required"]), | |
| 4157 | + requires: Requires.fromJson(json["requires"]), | |
| 4158 | + restrict: Restrict.fromJson(json["restrict"]), | |
| 4159 | + retain: Retain.fromJson(json["retain"]), | |
| 4160 | + rethrows: Rethrows.fromJson(json["rethrows"]), | |
| 4161 | + right: Right.fromJson(json["right"]), | |
| 4162 | + sbyte: Sbyte.fromJson(json["sbyte"]), | |
| 4163 | + sealed: Sealed.fromJson(json["sealed"]), | |
| 4164 | + sel: Sel.fromJson(json["SEL"]), | |
| 4165 | + select: Select.fromJson(json["select"]), | |
| 4166 | + self: Self.fromJson(json["Self"]), | |
| 4167 | + serialize: Serialize.fromJson(json["serialize"]), | |
| 4168 | + short: Short.fromJson(json["short"]), | |
| 4169 | + signed: Signed.fromJson(json["signed"]), | |
| 4170 | + sizeof: Sizeof.fromJson(json["sizeof"]), | |
| 4171 | + stackalloc: Stackalloc.fromJson(json["stackalloc"]), | |
| 4172 | + staticAssert: StaticAssert.fromJson(json["static_assert"]), | |
| 4173 | + staticCast: StaticCast.fromJson(json["static_cast"]), | |
| 4174 | + strictfp: Strictfp.fromJson(json["strictfp"]), | |
| 4175 | + string: StringClass.fromJson(json["string"]), | |
| 4176 | + struct: Struct.fromJson(json["struct"]), | |
| 4177 | + subscript: Subscript.fromJson(json["subscript"]), | |
| 4178 | + symbol: Symbol.fromJson(json["symbol"]), | |
| 4179 | + synchronized: Synchronized.fromJson(json["synchronized"]), | |
| 4180 | + system: System.fromJson(json["system"]), | |
| 4181 | + template: Template.fromJson(json["template"]), | |
| 4182 | + then: Then.fromJson(json["then"]), | |
| 4183 | + threadLocal: ThreadLocal.fromJson(json["thread_local"]), | |
| 4184 | + throws: Throws.fromJson(json["throws"]), | |
| 4185 | + topLevel: TopLevelClass.fromJson(json["top_level"]), | |
| 4186 | + transient: Transient.fromJson(json["transient"]), | |
| 4187 | + type: Type.fromJson(json["Type"]), | |
| 4188 | + typealias: Typealias.fromJson(json["typealias"]), | |
| 4189 | + typeid: Typeid.fromJson(json["typeid"]), | |
| 4190 | + typename: Typename.fromJson(json["typename"]), | |
| 4191 | + typeof: Typeof.fromJson(json["typeof"]), | |
| 4192 | + uint: Uint.fromJson(json["uint"]), | |
| 4193 | + ulong: Ulong.fromJson(json["ulong"]), | |
| 4194 | + unchecked: Unchecked.fromJson(json["unchecked"]), | |
| 4195 | + undefined: Undefined.fromJson(json["undefined"]), | |
| 4196 | + ); | |
| 4197 | + | |
| 4198 | + Map<String, dynamic> toJson() => { | |
| 4199 | + "dummy": dummy, | |
| 4200 | + "return": obj4Return.toJson(), | |
| 4201 | + "self": obj4Self.toJson(), | |
| 4202 | + "set": obj4Set.toJson(), | |
| 4203 | + "static": obj4Static.toJson(), | |
| 4204 | + "super": obj4Super.toJson(), | |
| 4205 | + "switch": obj4Switch.toJson(), | |
| 4206 | + "this": obj4This.toJson(), | |
| 4207 | + "throw": obj4Throw.toJson(), | |
| 4208 | + "to_json": obj4ToJson.toJson(), | |
| 4209 | + "True": obj4True.toJson(), | |
| 4210 | + "try": obj4Try.toJson(), | |
| 4211 | + "type": obj4Type.toJson(), | |
| 4212 | + "typedef": obj4Typedef.toJson(), | |
| 4213 | + "public": public.toJson(), | |
| 4214 | + "true": purpleTrue.toJson(), | |
| 4215 | + "quicktype": quicktype.toJson(), | |
| 4216 | + "raise": raise.toJson(), | |
| 4217 | + "range": range.toJson(), | |
| 4218 | + "readonly": readonly.toJson(), | |
| 4219 | + "ref": ref.toJson(), | |
| 4220 | + "register": register.toJson(), | |
| 4221 | + "reinterpret_cast": reinterpretCast.toJson(), | |
| 4222 | + "repeat": repeat.toJson(), | |
| 4223 | + "require": require.toJson(), | |
| 4224 | + "required": required.toJson(), | |
| 4225 | + "requires": requires.toJson(), | |
| 4226 | + "restrict": restrict.toJson(), | |
| 4227 | + "retain": retain.toJson(), | |
| 4228 | + "rethrows": rethrows.toJson(), | |
| 4229 | + "right": right.toJson(), | |
| 4230 | + "sbyte": sbyte.toJson(), | |
| 4231 | + "sealed": sealed.toJson(), | |
| 4232 | + "SEL": sel.toJson(), | |
| 4233 | + "select": select.toJson(), | |
| 4234 | + "Self": self.toJson(), | |
| 4235 | + "serialize": serialize.toJson(), | |
| 4236 | + "short": short.toJson(), | |
| 4237 | + "signed": signed.toJson(), | |
| 4238 | + "sizeof": sizeof.toJson(), | |
| 4239 | + "stackalloc": stackalloc.toJson(), | |
| 4240 | + "static_assert": staticAssert.toJson(), | |
| 4241 | + "static_cast": staticCast.toJson(), | |
| 4242 | + "strictfp": strictfp.toJson(), | |
| 4243 | + "string": string.toJson(), | |
| 4244 | + "struct": struct.toJson(), | |
| 4245 | + "subscript": subscript.toJson(), | |
| 4246 | + "symbol": symbol.toJson(), | |
| 4247 | + "synchronized": synchronized.toJson(), | |
| 4248 | + "system": system.toJson(), | |
| 4249 | + "template": template.toJson(), | |
| 4250 | + "then": then.toJson(), | |
| 4251 | + "thread_local": threadLocal.toJson(), | |
| 4252 | + "throws": throws.toJson(), | |
| 4253 | + "top_level": topLevel.toJson(), | |
| 4254 | + "transient": transient.toJson(), | |
| 4255 | + "Type": type.toJson(), | |
| 4256 | + "typealias": typealias.toJson(), | |
| 4257 | + "typeid": typeid.toJson(), | |
| 4258 | + "typename": typename.toJson(), | |
| 4259 | + "typeof": typeof.toJson(), | |
| 4260 | + "uint": uint.toJson(), | |
| 4261 | + "ulong": ulong.toJson(), | |
| 4262 | + "unchecked": unchecked.toJson(), | |
| 4263 | + "undefined": undefined.toJson(), | |
| 4264 | + }; | |
| 4265 | +} | |
| 4266 | + | |
| 4267 | +class Return { | |
| 4268 | + final int returnReturn; | |
| 4269 | + | |
| 4270 | + Return({ | |
| 4271 | + required this.returnReturn, | |
| 4272 | + }); | |
| 4273 | + | |
| 4274 | + factory Return.fromJson(Map<String, dynamic> json) => Return( | |
| 4275 | + returnReturn: json["return"], | |
| 4276 | + ); | |
| 4277 | + | |
| 4278 | + Map<String, dynamic> toJson() => { | |
| 4279 | + "return": returnReturn, | |
| 4280 | + }; | |
| 4281 | +} | |
| 4282 | + | |
| 4283 | +class SelfClass { | |
| 4284 | + final int self; | |
| 4285 | + | |
| 4286 | + SelfClass({ | |
| 4287 | + required this.self, | |
| 4288 | + }); | |
| 4289 | + | |
| 4290 | + factory SelfClass.fromJson(Map<String, dynamic> json) => SelfClass( | |
| 4291 | + self: json["self"], | |
| 4292 | + ); | |
| 4293 | + | |
| 4294 | + Map<String, dynamic> toJson() => { | |
| 4295 | + "self": self, | |
| 4296 | + }; | |
| 4297 | +} | |
| 4298 | + | |
| 4299 | +class Set { | |
| 4300 | + final int setSet; | |
| 4301 | + | |
| 4302 | + Set({ | |
| 4303 | + required this.setSet, | |
| 4304 | + }); | |
| 4305 | + | |
| 4306 | + factory Set.fromJson(Map<String, dynamic> json) => Set( | |
| 4307 | + setSet: json["set"], | |
| 4308 | + ); | |
| 4309 | + | |
| 4310 | + Map<String, dynamic> toJson() => { | |
| 4311 | + "set": setSet, | |
| 4312 | + }; | |
| 4313 | +} | |
| 4314 | + | |
| 4315 | +class Static { | |
| 4316 | + final int staticStatic; | |
| 4317 | + | |
| 4318 | + Static({ | |
| 4319 | + required this.staticStatic, | |
| 4320 | + }); | |
| 4321 | + | |
| 4322 | + factory Static.fromJson(Map<String, dynamic> json) => Static( | |
| 4323 | + staticStatic: json["static"], | |
| 4324 | + ); | |
| 4325 | + | |
| 4326 | + Map<String, dynamic> toJson() => { | |
| 4327 | + "static": staticStatic, | |
| 4328 | + }; | |
| 4329 | +} | |
| 4330 | + | |
| 4331 | +class Super { | |
| 4332 | + final int superSuper; | |
| 4333 | + | |
| 4334 | + Super({ | |
| 4335 | + required this.superSuper, | |
| 4336 | + }); | |
| 4337 | + | |
| 4338 | + factory Super.fromJson(Map<String, dynamic> json) => Super( | |
| 4339 | + superSuper: json["super"], | |
| 4340 | + ); | |
| 4341 | + | |
| 4342 | + Map<String, dynamic> toJson() => { | |
| 4343 | + "super": superSuper, | |
| 4344 | + }; | |
| 4345 | +} | |
| 4346 | + | |
| 4347 | +class Switch { | |
| 4348 | + final int switchSwitch; | |
| 4349 | + | |
| 4350 | + Switch({ | |
| 4351 | + required this.switchSwitch, | |
| 4352 | + }); | |
| 4353 | + | |
| 4354 | + factory Switch.fromJson(Map<String, dynamic> json) => Switch( | |
| 4355 | + switchSwitch: json["switch"], | |
| 4356 | + ); | |
| 4357 | + | |
| 4358 | + Map<String, dynamic> toJson() => { | |
| 4359 | + "switch": switchSwitch, | |
| 4360 | + }; | |
| 4361 | +} | |
| 4362 | + | |
| 4363 | +class This { | |
| 4364 | + final int thisThis; | |
| 4365 | + | |
| 4366 | + This({ | |
| 4367 | + required this.thisThis, | |
| 4368 | + }); | |
| 4369 | + | |
| 4370 | + factory This.fromJson(Map<String, dynamic> json) => This( | |
| 4371 | + thisThis: json["this"], | |
| 4372 | + ); | |
| 4373 | + | |
| 4374 | + Map<String, dynamic> toJson() => { | |
| 4375 | + "this": thisThis, | |
| 4376 | + }; | |
| 4377 | +} | |
| 4378 | + | |
| 4379 | +class Throw { | |
| 4380 | + final int throwThrow; | |
| 4381 | + | |
| 4382 | + Throw({ | |
| 4383 | + required this.throwThrow, | |
| 4384 | + }); | |
| 4385 | + | |
| 4386 | + factory Throw.fromJson(Map<String, dynamic> json) => Throw( | |
| 4387 | + throwThrow: json["throw"], | |
| 4388 | + ); | |
| 4389 | + | |
| 4390 | + Map<String, dynamic> toJson() => { | |
| 4391 | + "throw": throwThrow, | |
| 4392 | + }; | |
| 4393 | +} | |
| 4394 | + | |
| 4395 | +class ToJson { | |
| 4396 | + final int toJsonToJson; | |
| 4397 | + | |
| 4398 | + ToJson({ | |
| 4399 | + required this.toJsonToJson, | |
| 4400 | + }); | |
| 4401 | + | |
| 4402 | + factory ToJson.fromJson(Map<String, dynamic> json) => ToJson( | |
| 4403 | + toJsonToJson: json["to_json"], | |
| 4404 | + ); | |
| 4405 | + | |
| 4406 | + Map<String, dynamic> toJson() => { | |
| 4407 | + "to_json": toJsonToJson, | |
| 4408 | + }; | |
| 4409 | +} | |
| 4410 | + | |
| 4411 | +class True { | |
| 4412 | + final int trueTrue; | |
| 4413 | + | |
| 4414 | + True({ | |
| 4415 | + required this.trueTrue, | |
| 4416 | + }); | |
| 4417 | + | |
| 4418 | + factory True.fromJson(Map<String, dynamic> json) => True( | |
| 4419 | + trueTrue: json["True"], | |
| 4420 | + ); | |
| 4421 | + | |
| 4422 | + Map<String, dynamic> toJson() => { | |
| 4423 | + "True": trueTrue, | |
| 4424 | + }; | |
| 4425 | +} | |
| 4426 | + | |
| 4427 | +class Try { | |
| 4428 | + final int tryTry; | |
| 4429 | + | |
| 4430 | + Try({ | |
| 4431 | + required this.tryTry, | |
| 4432 | + }); | |
| 4433 | + | |
| 4434 | + factory Try.fromJson(Map<String, dynamic> json) => Try( | |
| 4435 | + tryTry: json["try"], | |
| 4436 | + ); | |
| 4437 | + | |
| 4438 | + Map<String, dynamic> toJson() => { | |
| 4439 | + "try": tryTry, | |
| 4440 | + }; | |
| 4441 | +} | |
| 4442 | + | |
| 4443 | +class TypeClass { | |
| 4444 | + final int type; | |
| 4445 | + | |
| 4446 | + TypeClass({ | |
| 4447 | + required this.type, | |
| 4448 | + }); | |
| 4449 | + | |
| 4450 | + factory TypeClass.fromJson(Map<String, dynamic> json) => TypeClass( | |
| 4451 | + type: json["type"], | |
| 4452 | + ); | |
| 4453 | + | |
| 4454 | + Map<String, dynamic> toJson() => { | |
| 4455 | + "type": type, | |
| 4456 | + }; | |
| 4457 | +} | |
| 4458 | + | |
| 4459 | +class Typedef { | |
| 4460 | + final int typedefTypedef; | |
| 4461 | + | |
| 4462 | + Typedef({ | |
| 4463 | + required this.typedefTypedef, | |
| 4464 | + }); | |
| 4465 | + | |
| 4466 | + factory Typedef.fromJson(Map<String, dynamic> json) => Typedef( | |
| 4467 | + typedefTypedef: json["typedef"], | |
| 4468 | + ); | |
| 4469 | + | |
| 4470 | + Map<String, dynamic> toJson() => { | |
| 4471 | + "typedef": typedefTypedef, | |
| 4472 | + }; | |
| 4473 | +} | |
| 4474 | + | |
| 4475 | +class Public { | |
| 4476 | + final int public; | |
| 4477 | + | |
| 4478 | + Public({ | |
| 4479 | + required this.public, | |
| 4480 | + }); | |
| 4481 | + | |
| 4482 | + factory Public.fromJson(Map<String, dynamic> json) => Public( | |
| 4483 | + public: json["public"], | |
| 4484 | + ); | |
| 4485 | + | |
| 4486 | + Map<String, dynamic> toJson() => { | |
| 4487 | + "public": public, | |
| 4488 | + }; | |
| 4489 | +} | |
| 4490 | + | |
| 4491 | +class TrueClass { | |
| 4492 | + final int trueTrue; | |
| 4493 | + | |
| 4494 | + TrueClass({ | |
| 4495 | + required this.trueTrue, | |
| 4496 | + }); | |
| 4497 | + | |
| 4498 | + factory TrueClass.fromJson(Map<String, dynamic> json) => TrueClass( | |
| 4499 | + trueTrue: json["true"], | |
| 4500 | + ); | |
| 4501 | + | |
| 4502 | + Map<String, dynamic> toJson() => { | |
| 4503 | + "true": trueTrue, | |
| 4504 | + }; | |
| 4505 | +} | |
| 4506 | + | |
| 4507 | +class Quicktype { | |
| 4508 | + final int quicktype; | |
| 4509 | + | |
| 4510 | + Quicktype({ | |
| 4511 | + required this.quicktype, | |
| 4512 | + }); | |
| 4513 | + | |
| 4514 | + factory Quicktype.fromJson(Map<String, dynamic> json) => Quicktype( | |
| 4515 | + quicktype: json["quicktype"], | |
| 4516 | + ); | |
| 4517 | + | |
| 4518 | + Map<String, dynamic> toJson() => { | |
| 4519 | + "quicktype": quicktype, | |
| 4520 | + }; | |
| 4521 | +} | |
| 4522 | + | |
| 4523 | +class Raise { | |
| 4524 | + final int raise; | |
| 4525 | + | |
| 4526 | + Raise({ | |
| 4527 | + required this.raise, | |
| 4528 | + }); | |
| 4529 | + | |
| 4530 | + factory Raise.fromJson(Map<String, dynamic> json) => Raise( | |
| 4531 | + raise: json["raise"], | |
| 4532 | + ); | |
| 4533 | + | |
| 4534 | + Map<String, dynamic> toJson() => { | |
| 4535 | + "raise": raise, | |
| 4536 | + }; | |
| 4537 | +} | |
| 4538 | + | |
| 4539 | +class Range { | |
| 4540 | + final int range; | |
| 4541 | + | |
| 4542 | + Range({ | |
| 4543 | + required this.range, | |
| 4544 | + }); | |
| 4545 | + | |
| 4546 | + factory Range.fromJson(Map<String, dynamic> json) => Range( | |
| 4547 | + range: json["range"], | |
| 4548 | + ); | |
| 4549 | + | |
| 4550 | + Map<String, dynamic> toJson() => { | |
| 4551 | + "range": range, | |
| 4552 | + }; | |
| 4553 | +} | |
| 4554 | + | |
| 4555 | +class Readonly { | |
| 4556 | + final int readonly; | |
| 4557 | + | |
| 4558 | + Readonly({ | |
| 4559 | + required this.readonly, | |
| 4560 | + }); | |
| 4561 | + | |
| 4562 | + factory Readonly.fromJson(Map<String, dynamic> json) => Readonly( | |
| 4563 | + readonly: json["readonly"], | |
| 4564 | + ); | |
| 4565 | + | |
| 4566 | + Map<String, dynamic> toJson() => { | |
| 4567 | + "readonly": readonly, | |
| 4568 | + }; | |
| 4569 | +} | |
| 4570 | + | |
| 4571 | +class Ref { | |
| 4572 | + final int ref; | |
| 4573 | + | |
| 4574 | + Ref({ | |
| 4575 | + required this.ref, | |
| 4576 | + }); | |
| 4577 | + | |
| 4578 | + factory Ref.fromJson(Map<String, dynamic> json) => Ref( | |
| 4579 | + ref: json["ref"], | |
| 4580 | + ); | |
| 4581 | + | |
| 4582 | + Map<String, dynamic> toJson() => { | |
| 4583 | + "ref": ref, | |
| 4584 | + }; | |
| 4585 | +} | |
| 4586 | + | |
| 4587 | +class Register { | |
| 4588 | + final int register; | |
| 4589 | + | |
| 4590 | + Register({ | |
| 4591 | + required this.register, | |
| 4592 | + }); | |
| 4593 | + | |
| 4594 | + factory Register.fromJson(Map<String, dynamic> json) => Register( | |
| 4595 | + register: json["register"], | |
| 4596 | + ); | |
| 4597 | + | |
| 4598 | + Map<String, dynamic> toJson() => { | |
| 4599 | + "register": register, | |
| 4600 | + }; | |
| 4601 | +} | |
| 4602 | + | |
| 4603 | +class ReinterpretCast { | |
| 4604 | + final int reinterpretCast; | |
| 4605 | + | |
| 4606 | + ReinterpretCast({ | |
| 4607 | + required this.reinterpretCast, | |
| 4608 | + }); | |
| 4609 | + | |
| 4610 | + factory ReinterpretCast.fromJson(Map<String, dynamic> json) => ReinterpretCast( | |
| 4611 | + reinterpretCast: json["reinterpret_cast"], | |
| 4612 | + ); | |
| 4613 | + | |
| 4614 | + Map<String, dynamic> toJson() => { | |
| 4615 | + "reinterpret_cast": reinterpretCast, | |
| 4616 | + }; | |
| 4617 | +} | |
| 4618 | + | |
| 4619 | +class Repeat { | |
| 4620 | + final int repeat; | |
| 4621 | + | |
| 4622 | + Repeat({ | |
| 4623 | + required this.repeat, | |
| 4624 | + }); | |
| 4625 | + | |
| 4626 | + factory Repeat.fromJson(Map<String, dynamic> json) => Repeat( | |
| 4627 | + repeat: json["repeat"], | |
| 4628 | + ); | |
| 4629 | + | |
| 4630 | + Map<String, dynamic> toJson() => { | |
| 4631 | + "repeat": repeat, | |
| 4632 | + }; | |
| 4633 | +} | |
| 4634 | + | |
| 4635 | +class Require { | |
| 4636 | + final int require; | |
| 4637 | + | |
| 4638 | + Require({ | |
| 4639 | + required this.require, | |
| 4640 | + }); | |
| 4641 | + | |
| 4642 | + factory Require.fromJson(Map<String, dynamic> json) => Require( | |
| 4643 | + require: json["require"], | |
| 4644 | + ); | |
| 4645 | + | |
| 4646 | + Map<String, dynamic> toJson() => { | |
| 4647 | + "require": require, | |
| 4648 | + }; | |
| 4649 | +} | |
| 4650 | + | |
| 4651 | +class Required { | |
| 4652 | + final int required; | |
| 4653 | + | |
| 4654 | + Required({ | |
| 4655 | + required this.required, | |
| 4656 | + }); | |
| 4657 | + | |
| 4658 | + factory Required.fromJson(Map<String, dynamic> json) => Required( | |
| 4659 | + required: json["required"], | |
| 4660 | + ); | |
| 4661 | + | |
| 4662 | + Map<String, dynamic> toJson() => { | |
| 4663 | + "required": required, | |
| 4664 | + }; | |
| 4665 | +} | |
| 4666 | + | |
| 4667 | +class Requires { | |
| 4668 | + final int requires; | |
| 4669 | + | |
| 4670 | + Requires({ | |
| 4671 | + required this.requires, | |
| 4672 | + }); | |
| 4673 | + | |
| 4674 | + factory Requires.fromJson(Map<String, dynamic> json) => Requires( | |
| 4675 | + requires: json["requires"], | |
| 4676 | + ); | |
| 4677 | + | |
| 4678 | + Map<String, dynamic> toJson() => { | |
| 4679 | + "requires": requires, | |
| 4680 | + }; | |
| 4681 | +} | |
| 4682 | + | |
| 4683 | +class Restrict { | |
| 4684 | + final int restrict; | |
| 4685 | + | |
| 4686 | + Restrict({ | |
| 4687 | + required this.restrict, | |
| 4688 | + }); | |
| 4689 | + | |
| 4690 | + factory Restrict.fromJson(Map<String, dynamic> json) => Restrict( | |
| 4691 | + restrict: json["restrict"], | |
| 4692 | + ); | |
| 4693 | + | |
| 4694 | + Map<String, dynamic> toJson() => { | |
| 4695 | + "restrict": restrict, | |
| 4696 | + }; | |
| 4697 | +} | |
| 4698 | + | |
| 4699 | +class Retain { | |
| 4700 | + final int retain; | |
| 4701 | + | |
| 4702 | + Retain({ | |
| 4703 | + required this.retain, | |
| 4704 | + }); | |
| 4705 | + | |
| 4706 | + factory Retain.fromJson(Map<String, dynamic> json) => Retain( | |
| 4707 | + retain: json["retain"], | |
| 4708 | + ); | |
| 4709 | + | |
| 4710 | + Map<String, dynamic> toJson() => { | |
| 4711 | + "retain": retain, | |
| 4712 | + }; | |
| 4713 | +} | |
| 4714 | + | |
| 4715 | +class Rethrows { | |
| 4716 | + final int rethrows; | |
| 4717 | + | |
| 4718 | + Rethrows({ | |
| 4719 | + required this.rethrows, | |
| 4720 | + }); | |
| 4721 | + | |
| 4722 | + factory Rethrows.fromJson(Map<String, dynamic> json) => Rethrows( | |
| 4723 | + rethrows: json["rethrows"], | |
| 4724 | + ); | |
| 4725 | + | |
| 4726 | + Map<String, dynamic> toJson() => { | |
| 4727 | + "rethrows": rethrows, | |
| 4728 | + }; | |
| 4729 | +} | |
| 4730 | + | |
| 4731 | +class Right { | |
| 4732 | + final int right; | |
| 4733 | + | |
| 4734 | + Right({ | |
| 4735 | + required this.right, | |
| 4736 | + }); | |
| 4737 | + | |
| 4738 | + factory Right.fromJson(Map<String, dynamic> json) => Right( | |
| 4739 | + right: json["right"], | |
| 4740 | + ); | |
| 4741 | + | |
| 4742 | + Map<String, dynamic> toJson() => { | |
| 4743 | + "right": right, | |
| 4744 | + }; | |
| 4745 | +} | |
| 4746 | + | |
| 4747 | +class Sbyte { | |
| 4748 | + final int sbyte; | |
| 4749 | + | |
| 4750 | + Sbyte({ | |
| 4751 | + required this.sbyte, | |
| 4752 | + }); | |
| 4753 | + | |
| 4754 | + factory Sbyte.fromJson(Map<String, dynamic> json) => Sbyte( | |
| 4755 | + sbyte: json["sbyte"], | |
| 4756 | + ); | |
| 4757 | + | |
| 4758 | + Map<String, dynamic> toJson() => { | |
| 4759 | + "sbyte": sbyte, | |
| 4760 | + }; | |
| 4761 | +} | |
| 4762 | + | |
| 4763 | +class Sealed { | |
| 4764 | + final int sealed; | |
| 4765 | + | |
| 4766 | + Sealed({ | |
| 4767 | + required this.sealed, | |
| 4768 | + }); | |
| 4769 | + | |
| 4770 | + factory Sealed.fromJson(Map<String, dynamic> json) => Sealed( | |
| 4771 | + sealed: json["sealed"], | |
| 4772 | + ); | |
| 4773 | + | |
| 4774 | + Map<String, dynamic> toJson() => { | |
| 4775 | + "sealed": sealed, | |
| 4776 | + }; | |
| 4777 | +} | |
| 4778 | + | |
| 4779 | +class Sel { | |
| 4780 | + final int sel; | |
| 4781 | + | |
| 4782 | + Sel({ | |
| 4783 | + required this.sel, | |
| 4784 | + }); | |
| 4785 | + | |
| 4786 | + factory Sel.fromJson(Map<String, dynamic> json) => Sel( | |
| 4787 | + sel: json["SEL"], | |
| 4788 | + ); | |
| 4789 | + | |
| 4790 | + Map<String, dynamic> toJson() => { | |
| 4791 | + "SEL": sel, | |
| 4792 | + }; | |
| 4793 | +} | |
| 4794 | + | |
| 4795 | +class Select { | |
| 4796 | + final int select; | |
| 4797 | + | |
| 4798 | + Select({ | |
| 4799 | + required this.select, | |
| 4800 | + }); | |
| 4801 | + | |
| 4802 | + factory Select.fromJson(Map<String, dynamic> json) => Select( | |
| 4803 | + select: json["select"], | |
| 4804 | + ); | |
| 4805 | + | |
| 4806 | + Map<String, dynamic> toJson() => { | |
| 4807 | + "select": select, | |
| 4808 | + }; | |
| 4809 | +} | |
| 4810 | + | |
| 4811 | +class Self { | |
| 4812 | + final int self; | |
| 4813 | + | |
| 4814 | + Self({ | |
| 4815 | + required this.self, | |
| 4816 | + }); | |
| 4817 | + | |
| 4818 | + factory Self.fromJson(Map<String, dynamic> json) => Self( | |
| 4819 | + self: json["Self"], | |
| 4820 | + ); | |
| 4821 | + | |
| 4822 | + Map<String, dynamic> toJson() => { | |
| 4823 | + "Self": self, | |
| 4824 | + }; | |
| 4825 | +} | |
| 4826 | + | |
| 4827 | +class Serialize { | |
| 4828 | + final int serialize; | |
| 4829 | + | |
| 4830 | + Serialize({ | |
| 4831 | + required this.serialize, | |
| 4832 | + }); | |
| 4833 | + | |
| 4834 | + factory Serialize.fromJson(Map<String, dynamic> json) => Serialize( | |
| 4835 | + serialize: json["serialize"], | |
| 4836 | + ); | |
| 4837 | + | |
| 4838 | + Map<String, dynamic> toJson() => { | |
| 4839 | + "serialize": serialize, | |
| 4840 | + }; | |
| 4841 | +} | |
| 4842 | + | |
| 4843 | +class Short { | |
| 4844 | + final int short; | |
| 4845 | + | |
| 4846 | + Short({ | |
| 4847 | + required this.short, | |
| 4848 | + }); | |
| 4849 | + | |
| 4850 | + factory Short.fromJson(Map<String, dynamic> json) => Short( | |
| 4851 | + short: json["short"], | |
| 4852 | + ); | |
| 4853 | + | |
| 4854 | + Map<String, dynamic> toJson() => { | |
| 4855 | + "short": short, | |
| 4856 | + }; | |
| 4857 | +} | |
| 4858 | + | |
| 4859 | +class Signed { | |
| 4860 | + final int signed; | |
| 4861 | + | |
| 4862 | + Signed({ | |
| 4863 | + required this.signed, | |
| 4864 | + }); | |
| 4865 | + | |
| 4866 | + factory Signed.fromJson(Map<String, dynamic> json) => Signed( | |
| 4867 | + signed: json["signed"], | |
| 4868 | + ); | |
| 4869 | + | |
| 4870 | + Map<String, dynamic> toJson() => { | |
| 4871 | + "signed": signed, | |
| 4872 | + }; | |
| 4873 | +} | |
| 4874 | + | |
| 4875 | +class Sizeof { | |
| 4876 | + final int sizeof; | |
| 4877 | + | |
| 4878 | + Sizeof({ | |
| 4879 | + required this.sizeof, | |
| 4880 | + }); | |
| 4881 | + | |
| 4882 | + factory Sizeof.fromJson(Map<String, dynamic> json) => Sizeof( | |
| 4883 | + sizeof: json["sizeof"], | |
| 4884 | + ); | |
| 4885 | + | |
| 4886 | + Map<String, dynamic> toJson() => { | |
| 4887 | + "sizeof": sizeof, | |
| 4888 | + }; | |
| 4889 | +} | |
| 4890 | + | |
| 4891 | +class Stackalloc { | |
| 4892 | + final int stackalloc; | |
| 4893 | + | |
| 4894 | + Stackalloc({ | |
| 4895 | + required this.stackalloc, | |
| 4896 | + }); | |
| 4897 | + | |
| 4898 | + factory Stackalloc.fromJson(Map<String, dynamic> json) => Stackalloc( | |
| 4899 | + stackalloc: json["stackalloc"], | |
| 4900 | + ); | |
| 4901 | + | |
| 4902 | + Map<String, dynamic> toJson() => { | |
| 4903 | + "stackalloc": stackalloc, | |
| 4904 | + }; | |
| 4905 | +} | |
| 4906 | + | |
| 4907 | +class StaticAssert { | |
| 4908 | + final int staticAssert; | |
| 4909 | + | |
| 4910 | + StaticAssert({ | |
| 4911 | + required this.staticAssert, | |
| 4912 | + }); | |
| 4913 | + | |
| 4914 | + factory StaticAssert.fromJson(Map<String, dynamic> json) => StaticAssert( | |
| 4915 | + staticAssert: json["static_assert"], | |
| 4916 | + ); | |
| 4917 | + | |
| 4918 | + Map<String, dynamic> toJson() => { | |
| 4919 | + "static_assert": staticAssert, | |
| 4920 | + }; | |
| 4921 | +} | |
| 4922 | + | |
| 4923 | +class StaticCast { | |
| 4924 | + final int staticCast; | |
| 4925 | + | |
| 4926 | + StaticCast({ | |
| 4927 | + required this.staticCast, | |
| 4928 | + }); | |
| 4929 | + | |
| 4930 | + factory StaticCast.fromJson(Map<String, dynamic> json) => StaticCast( | |
| 4931 | + staticCast: json["static_cast"], | |
| 4932 | + ); | |
| 4933 | + | |
| 4934 | + Map<String, dynamic> toJson() => { | |
| 4935 | + "static_cast": staticCast, | |
| 4936 | + }; | |
| 4937 | +} | |
| 4938 | + | |
| 4939 | +class Strictfp { | |
| 4940 | + final int strictfp; | |
| 4941 | + | |
| 4942 | + Strictfp({ | |
| 4943 | + required this.strictfp, | |
| 4944 | + }); | |
| 4945 | + | |
| 4946 | + factory Strictfp.fromJson(Map<String, dynamic> json) => Strictfp( | |
| 4947 | + strictfp: json["strictfp"], | |
| 4948 | + ); | |
| 4949 | + | |
| 4950 | + Map<String, dynamic> toJson() => { | |
| 4951 | + "strictfp": strictfp, | |
| 4952 | + }; | |
| 4953 | +} | |
| 4954 | + | |
| 4955 | +class StringClass { | |
| 4956 | + final int string; | |
| 4957 | + | |
| 4958 | + StringClass({ | |
| 4959 | + required this.string, | |
| 4960 | + }); | |
| 4961 | + | |
| 4962 | + factory StringClass.fromJson(Map<String, dynamic> json) => StringClass( | |
| 4963 | + string: json["string"], | |
| 4964 | + ); | |
| 4965 | + | |
| 4966 | + Map<String, dynamic> toJson() => { | |
| 4967 | + "string": string, | |
| 4968 | + }; | |
| 4969 | +} | |
| 4970 | + | |
| 4971 | +class Struct { | |
| 4972 | + final int struct; | |
| 4973 | + | |
| 4974 | + Struct({ | |
| 4975 | + required this.struct, | |
| 4976 | + }); | |
| 4977 | + | |
| 4978 | + factory Struct.fromJson(Map<String, dynamic> json) => Struct( | |
| 4979 | + struct: json["struct"], | |
| 4980 | + ); | |
| 4981 | + | |
| 4982 | + Map<String, dynamic> toJson() => { | |
| 4983 | + "struct": struct, | |
| 4984 | + }; | |
| 4985 | +} | |
| 4986 | + | |
| 4987 | +class Subscript { | |
| 4988 | + final int subscript; | |
| 4989 | + | |
| 4990 | + Subscript({ | |
| 4991 | + required this.subscript, | |
| 4992 | + }); | |
| 4993 | + | |
| 4994 | + factory Subscript.fromJson(Map<String, dynamic> json) => Subscript( | |
| 4995 | + subscript: json["subscript"], | |
| 4996 | + ); | |
| 4997 | + | |
| 4998 | + Map<String, dynamic> toJson() => { | |
| 4999 | + "subscript": subscript, | |
| 5000 | + }; | |
| 5001 | +} | |
| 5002 | + | |
| 5003 | +class Symbol { | |
| 5004 | + final int symbol; | |
| 5005 | + | |
| 5006 | + Symbol({ | |
| 5007 | + required this.symbol, | |
| 5008 | + }); | |
| 5009 | + | |
| 5010 | + factory Symbol.fromJson(Map<String, dynamic> json) => Symbol( | |
| 5011 | + symbol: json["symbol"], | |
| 5012 | + ); | |
| 5013 | + | |
| 5014 | + Map<String, dynamic> toJson() => { | |
| 5015 | + "symbol": symbol, | |
| 5016 | + }; | |
| 5017 | +} | |
| 5018 | + | |
| 5019 | +class Synchronized { | |
| 5020 | + final int synchronized; | |
| 5021 | + | |
| 5022 | + Synchronized({ | |
| 5023 | + required this.synchronized, | |
| 5024 | + }); | |
| 5025 | + | |
| 5026 | + factory Synchronized.fromJson(Map<String, dynamic> json) => Synchronized( | |
| 5027 | + synchronized: json["synchronized"], | |
| 5028 | + ); | |
| 5029 | + | |
| 5030 | + Map<String, dynamic> toJson() => { | |
| 5031 | + "synchronized": synchronized, | |
| 5032 | + }; | |
| 5033 | +} | |
| 5034 | + | |
| 5035 | +class System { | |
| 5036 | + final int system; | |
| 5037 | + | |
| 5038 | + System({ | |
| 5039 | + required this.system, | |
| 5040 | + }); | |
| 5041 | + | |
| 5042 | + factory System.fromJson(Map<String, dynamic> json) => System( | |
| 5043 | + system: json["system"], | |
| 5044 | + ); | |
| 5045 | + | |
| 5046 | + Map<String, dynamic> toJson() => { | |
| 5047 | + "system": system, | |
| 5048 | + }; | |
| 5049 | +} | |
| 5050 | + | |
| 5051 | +class Template { | |
| 5052 | + final int template; | |
| 5053 | + | |
| 5054 | + Template({ | |
| 5055 | + required this.template, | |
| 5056 | + }); | |
| 5057 | + | |
| 5058 | + factory Template.fromJson(Map<String, dynamic> json) => Template( | |
| 5059 | + template: json["template"], | |
| 5060 | + ); | |
| 5061 | + | |
| 5062 | + Map<String, dynamic> toJson() => { | |
| 5063 | + "template": template, | |
| 5064 | + }; | |
| 5065 | +} | |
| 5066 | + | |
| 5067 | +class Then { | |
| 5068 | + final int then; | |
| 5069 | + | |
| 5070 | + Then({ | |
| 5071 | + required this.then, | |
| 5072 | + }); | |
| 5073 | + | |
| 5074 | + factory Then.fromJson(Map<String, dynamic> json) => Then( | |
| 5075 | + then: json["then"], | |
| 5076 | + ); | |
| 5077 | + | |
| 5078 | + Map<String, dynamic> toJson() => { | |
| 5079 | + "then": then, | |
| 5080 | + }; | |
| 5081 | +} | |
| 5082 | + | |
| 5083 | +class ThreadLocal { | |
| 5084 | + final int threadLocal; | |
| 5085 | + | |
| 5086 | + ThreadLocal({ | |
| 5087 | + required this.threadLocal, | |
| 5088 | + }); | |
| 5089 | + | |
| 5090 | + factory ThreadLocal.fromJson(Map<String, dynamic> json) => ThreadLocal( | |
| 5091 | + threadLocal: json["thread_local"], | |
| 5092 | + ); | |
| 5093 | + | |
| 5094 | + Map<String, dynamic> toJson() => { | |
| 5095 | + "thread_local": threadLocal, | |
| 5096 | + }; | |
| 5097 | +} | |
| 5098 | + | |
| 5099 | +class Throws { | |
| 5100 | + final int throws; | |
| 5101 | + | |
| 5102 | + Throws({ | |
| 5103 | + required this.throws, | |
| 5104 | + }); | |
| 5105 | + | |
| 5106 | + factory Throws.fromJson(Map<String, dynamic> json) => Throws( | |
| 5107 | + throws: json["throws"], | |
| 5108 | + ); | |
| 5109 | + | |
| 5110 | + Map<String, dynamic> toJson() => { | |
| 5111 | + "throws": throws, | |
| 5112 | + }; | |
| 5113 | +} | |
| 5114 | + | |
| 5115 | +class TopLevelClass { | |
| 5116 | + final int topLevel; | |
| 5117 | + | |
| 5118 | + TopLevelClass({ | |
| 5119 | + required this.topLevel, | |
| 5120 | + }); | |
| 5121 | + | |
| 5122 | + factory TopLevelClass.fromJson(Map<String, dynamic> json) => TopLevelClass( | |
| 5123 | + topLevel: json["top_level"], | |
| 5124 | + ); | |
| 5125 | + | |
| 5126 | + Map<String, dynamic> toJson() => { | |
| 5127 | + "top_level": topLevel, | |
| 5128 | + }; | |
| 5129 | +} | |
| 5130 | + | |
| 5131 | +class Transient { | |
| 5132 | + final int transient; | |
| 5133 | + | |
| 5134 | + Transient({ | |
| 5135 | + required this.transient, | |
| 5136 | + }); | |
| 5137 | + | |
| 5138 | + factory Transient.fromJson(Map<String, dynamic> json) => Transient( | |
| 5139 | + transient: json["transient"], | |
| 5140 | + ); | |
| 5141 | + | |
| 5142 | + Map<String, dynamic> toJson() => { | |
| 5143 | + "transient": transient, | |
| 5144 | + }; | |
| 5145 | +} | |
| 5146 | + | |
| 5147 | +class Type { | |
| 5148 | + final int type; | |
| 5149 | + | |
| 5150 | + Type({ | |
| 5151 | + required this.type, | |
| 5152 | + }); | |
| 5153 | + | |
| 5154 | + factory Type.fromJson(Map<String, dynamic> json) => Type( | |
| 5155 | + type: json["Type"], | |
| 5156 | + ); | |
| 5157 | + | |
| 5158 | + Map<String, dynamic> toJson() => { | |
| 5159 | + "Type": type, | |
| 5160 | + }; | |
| 5161 | +} | |
| 5162 | + | |
| 5163 | +class Typealias { | |
| 5164 | + final int typealias; | |
| 5165 | + | |
| 5166 | + Typealias({ | |
| 5167 | + required this.typealias, | |
| 5168 | + }); | |
| 5169 | + | |
| 5170 | + factory Typealias.fromJson(Map<String, dynamic> json) => Typealias( | |
| 5171 | + typealias: json["typealias"], | |
| 5172 | + ); | |
| 5173 | + | |
| 5174 | + Map<String, dynamic> toJson() => { | |
| 5175 | + "typealias": typealias, | |
| 5176 | + }; | |
| 5177 | +} | |
| 5178 | + | |
| 5179 | +class Typeid { | |
| 5180 | + final int typeid; | |
| 5181 | + | |
| 5182 | + Typeid({ | |
| 5183 | + required this.typeid, | |
| 5184 | + }); | |
| 5185 | + | |
| 5186 | + factory Typeid.fromJson(Map<String, dynamic> json) => Typeid( | |
| 5187 | + typeid: json["typeid"], | |
| 5188 | + ); | |
| 5189 | + | |
| 5190 | + Map<String, dynamic> toJson() => { | |
| 5191 | + "typeid": typeid, | |
| 5192 | + }; | |
| 5193 | +} | |
| 5194 | + | |
| 5195 | +class Typename { | |
| 5196 | + final int typename; | |
| 5197 | + | |
| 5198 | + Typename({ | |
| 5199 | + required this.typename, | |
| 5200 | + }); | |
| 5201 | + | |
| 5202 | + factory Typename.fromJson(Map<String, dynamic> json) => Typename( | |
| 5203 | + typename: json["typename"], | |
| 5204 | + ); | |
| 5205 | + | |
| 5206 | + Map<String, dynamic> toJson() => { | |
| 5207 | + "typename": typename, | |
| 5208 | + }; | |
| 5209 | +} | |
| 5210 | + | |
| 5211 | +class Typeof { | |
| 5212 | + final int typeof; | |
| 5213 | + | |
| 5214 | + Typeof({ | |
| 5215 | + required this.typeof, | |
| 5216 | + }); | |
| 5217 | + | |
| 5218 | + factory Typeof.fromJson(Map<String, dynamic> json) => Typeof( | |
| 5219 | + typeof: json["typeof"], | |
| 5220 | + ); | |
| 5221 | + | |
| 5222 | + Map<String, dynamic> toJson() => { | |
| 5223 | + "typeof": typeof, | |
| 5224 | + }; | |
| 5225 | +} | |
| 5226 | + | |
| 5227 | +class Uint { | |
| 5228 | + final int uint; | |
| 5229 | + | |
| 5230 | + Uint({ | |
| 5231 | + required this.uint, | |
| 5232 | + }); | |
| 5233 | + | |
| 5234 | + factory Uint.fromJson(Map<String, dynamic> json) => Uint( | |
| 5235 | + uint: json["uint"], | |
| 5236 | + ); | |
| 5237 | + | |
| 5238 | + Map<String, dynamic> toJson() => { | |
| 5239 | + "uint": uint, | |
| 5240 | + }; | |
| 5241 | +} | |
| 5242 | + | |
| 5243 | +class Ulong { | |
| 5244 | + final int ulong; | |
| 5245 | + | |
| 5246 | + Ulong({ | |
| 5247 | + required this.ulong, | |
| 5248 | + }); | |
| 5249 | + | |
| 5250 | + factory Ulong.fromJson(Map<String, dynamic> json) => Ulong( | |
| 5251 | + ulong: json["ulong"], | |
| 5252 | + ); | |
| 5253 | + | |
| 5254 | + Map<String, dynamic> toJson() => { | |
| 5255 | + "ulong": ulong, | |
| 5256 | + }; | |
| 5257 | +} | |
| 5258 | + | |
| 5259 | +class Unchecked { | |
| 5260 | + final int unchecked; | |
| 5261 | + | |
| 5262 | + Unchecked({ | |
| 5263 | + required this.unchecked, | |
| 5264 | + }); | |
| 5265 | + | |
| 5266 | + factory Unchecked.fromJson(Map<String, dynamic> json) => Unchecked( | |
| 5267 | + unchecked: json["unchecked"], | |
| 5268 | + ); | |
| 5269 | + | |
| 5270 | + Map<String, dynamic> toJson() => { | |
| 5271 | + "unchecked": unchecked, | |
| 5272 | + }; | |
| 5273 | +} | |
| 5274 | + | |
| 5275 | +class Undefined { | |
| 5276 | + final int undefined; | |
| 5277 | + | |
| 5278 | + Undefined({ | |
| 5279 | + required this.undefined, | |
| 5280 | + }); | |
| 5281 | + | |
| 5282 | + factory Undefined.fromJson(Map<String, dynamic> json) => Undefined( | |
| 5283 | + undefined: json["undefined"], | |
| 5284 | + ); | |
| 5285 | + | |
| 5286 | + Map<String, dynamic> toJson() => { | |
| 5287 | + "undefined": undefined, | |
| 5288 | + }; | |
| 5289 | +} | |
| 5290 | + | |
| 5291 | +class Obj5 { | |
| 5292 | + final int dummy; | |
| 5293 | + final Var obj5Var; | |
| 5294 | + final Void obj5Void; | |
| 5295 | + final While obj5While; | |
| 5296 | + final With obj5With; | |
| 5297 | + final Yield obj5Yield; | |
| 5298 | + final Union union; | |
| 5299 | + final Unowned unowned; | |
| 5300 | + final Unsafe unsafe; | |
| 5301 | + final Unsigned unsigned; | |
| 5302 | + final Ushort ushort; | |
| 5303 | + final Using using; | |
| 5304 | + final Virtual virtual; | |
| 5305 | + final Volatile volatile; | |
| 5306 | + final WcharT wcharT; | |
| 5307 | + final Weak weak; | |
| 5308 | + final Where where; | |
| 5309 | + final WillSet willSet; | |
| 5310 | + final Xor xor; | |
| 5311 | + final XorEq xorEq; | |
| 5312 | + final Yes yes; | |
| 5313 | + | |
| 5314 | + Obj5({ | |
| 5315 | + required this.dummy, | |
| 5316 | + required this.obj5Var, | |
| 5317 | + required this.obj5Void, | |
| 5318 | + required this.obj5While, | |
| 5319 | + required this.obj5With, | |
| 5320 | + required this.obj5Yield, | |
| 5321 | + required this.union, | |
| 5322 | + required this.unowned, | |
| 5323 | + required this.unsafe, | |
| 5324 | + required this.unsigned, | |
| 5325 | + required this.ushort, | |
| 5326 | + required this.using, | |
| 5327 | + required this.virtual, | |
| 5328 | + required this.volatile, | |
| 5329 | + required this.wcharT, | |
| 5330 | + required this.weak, | |
| 5331 | + required this.where, | |
| 5332 | + required this.willSet, | |
| 5333 | + required this.xor, | |
| 5334 | + required this.xorEq, | |
| 5335 | + required this.yes, | |
| 5336 | + }); | |
| 5337 | + | |
| 5338 | + factory Obj5.fromJson(Map<String, dynamic> json) => Obj5( | |
| 5339 | + dummy: json["dummy"], | |
| 5340 | + obj5Var: Var.fromJson(json["var"]), | |
| 5341 | + obj5Void: Void.fromJson(json["void"]), | |
| 5342 | + obj5While: While.fromJson(json["while"]), | |
| 5343 | + obj5With: With.fromJson(json["with"]), | |
| 5344 | + obj5Yield: Yield.fromJson(json["yield"]), | |
| 5345 | + union: Union.fromJson(json["union"]), | |
| 5346 | + unowned: Unowned.fromJson(json["unowned"]), | |
| 5347 | + unsafe: Unsafe.fromJson(json["unsafe"]), | |
| 5348 | + unsigned: Unsigned.fromJson(json["unsigned"]), | |
| 5349 | + ushort: Ushort.fromJson(json["ushort"]), | |
| 5350 | + using: Using.fromJson(json["using"]), | |
| 5351 | + virtual: Virtual.fromJson(json["virtual"]), | |
| 5352 | + volatile: Volatile.fromJson(json["volatile"]), | |
| 5353 | + wcharT: WcharT.fromJson(json["wchar_t"]), | |
| 5354 | + weak: Weak.fromJson(json["weak"]), | |
| 5355 | + where: Where.fromJson(json["where"]), | |
| 5356 | + willSet: WillSet.fromJson(json["willSet"]), | |
| 5357 | + xor: Xor.fromJson(json["xor"]), | |
| 5358 | + xorEq: XorEq.fromJson(json["xor_eq"]), | |
| 5359 | + yes: Yes.fromJson(json["YES"]), | |
| 5360 | + ); | |
| 5361 | + | |
| 5362 | + Map<String, dynamic> toJson() => { | |
| 5363 | + "dummy": dummy, | |
| 5364 | + "var": obj5Var.toJson(), | |
| 5365 | + "void": obj5Void.toJson(), | |
| 5366 | + "while": obj5While.toJson(), | |
| 5367 | + "with": obj5With.toJson(), | |
| 5368 | + "yield": obj5Yield.toJson(), | |
| 5369 | + "union": union.toJson(), | |
| 5370 | + "unowned": unowned.toJson(), | |
| 5371 | + "unsafe": unsafe.toJson(), | |
| 5372 | + "unsigned": unsigned.toJson(), | |
| 5373 | + "ushort": ushort.toJson(), | |
| 5374 | + "using": using.toJson(), | |
| 5375 | + "virtual": virtual.toJson(), | |
| 5376 | + "volatile": volatile.toJson(), | |
| 5377 | + "wchar_t": wcharT.toJson(), | |
| 5378 | + "weak": weak.toJson(), | |
| 5379 | + "where": where.toJson(), | |
| 5380 | + "willSet": willSet.toJson(), | |
| 5381 | + "xor": xor.toJson(), | |
| 5382 | + "xor_eq": xorEq.toJson(), | |
| 5383 | + "YES": yes.toJson(), | |
| 5384 | + }; | |
| 5385 | +} | |
| 5386 | + | |
| 5387 | +class Var { | |
| 5388 | + final int varVar; | |
| 5389 | + | |
| 5390 | + Var({ | |
| 5391 | + required this.varVar, | |
| 5392 | + }); | |
| 5393 | + | |
| 5394 | + factory Var.fromJson(Map<String, dynamic> json) => Var( | |
| 5395 | + varVar: json["var"], | |
| 5396 | + ); | |
| 5397 | + | |
| 5398 | + Map<String, dynamic> toJson() => { | |
| 5399 | + "var": varVar, | |
| 5400 | + }; | |
| 5401 | +} | |
| 5402 | + | |
| 5403 | +class Void { | |
| 5404 | + final int voidVoid; | |
| 5405 | + | |
| 5406 | + Void({ | |
| 5407 | + required this.voidVoid, | |
| 5408 | + }); | |
| 5409 | + | |
| 5410 | + factory Void.fromJson(Map<String, dynamic> json) => Void( | |
| 5411 | + voidVoid: json["void"], | |
| 5412 | + ); | |
| 5413 | + | |
| 5414 | + Map<String, dynamic> toJson() => { | |
| 5415 | + "void": voidVoid, | |
| 5416 | + }; | |
| 5417 | +} | |
| 5418 | + | |
| 5419 | +class While { | |
| 5420 | + final int whileWhile; | |
| 5421 | + | |
| 5422 | + While({ | |
| 5423 | + required this.whileWhile, | |
| 5424 | + }); | |
| 5425 | + | |
| 5426 | + factory While.fromJson(Map<String, dynamic> json) => While( | |
| 5427 | + whileWhile: json["while"], | |
| 5428 | + ); | |
| 5429 | + | |
| 5430 | + Map<String, dynamic> toJson() => { | |
| 5431 | + "while": whileWhile, | |
| 5432 | + }; | |
| 5433 | +} | |
| 5434 | + | |
| 5435 | +class With { | |
| 5436 | + final int withWith; | |
| 5437 | + | |
| 5438 | + With({ | |
| 5439 | + required this.withWith, | |
| 5440 | + }); | |
| 5441 | + | |
| 5442 | + factory With.fromJson(Map<String, dynamic> json) => With( | |
| 5443 | + withWith: json["with"], | |
| 5444 | + ); | |
| 5445 | + | |
| 5446 | + Map<String, dynamic> toJson() => { | |
| 5447 | + "with": withWith, | |
| 5448 | + }; | |
| 5449 | +} | |
| 5450 | + | |
| 5451 | +class Yield { | |
| 5452 | + final int yieldYield; | |
| 5453 | + | |
| 5454 | + Yield({ | |
| 5455 | + required this.yieldYield, | |
| 5456 | + }); | |
| 5457 | + | |
| 5458 | + factory Yield.fromJson(Map<String, dynamic> json) => Yield( | |
| 5459 | + yieldYield: json["yield"], | |
| 5460 | + ); | |
| 5461 | + | |
| 5462 | + Map<String, dynamic> toJson() => { | |
| 5463 | + "yield": yieldYield, | |
| 5464 | + }; | |
| 5465 | +} | |
| 5466 | + | |
| 5467 | +class Union { | |
| 5468 | + final int union; | |
| 5469 | + | |
| 5470 | + Union({ | |
| 5471 | + required this.union, | |
| 5472 | + }); | |
| 5473 | + | |
| 5474 | + factory Union.fromJson(Map<String, dynamic> json) => Union( | |
| 5475 | + union: json["union"], | |
| 5476 | + ); | |
| 5477 | + | |
| 5478 | + Map<String, dynamic> toJson() => { | |
| 5479 | + "union": union, | |
| 5480 | + }; | |
| 5481 | +} | |
| 5482 | + | |
| 5483 | +class Unowned { | |
| 5484 | + final int unowned; | |
| 5485 | + | |
| 5486 | + Unowned({ | |
| 5487 | + required this.unowned, | |
| 5488 | + }); | |
| 5489 | + | |
| 5490 | + factory Unowned.fromJson(Map<String, dynamic> json) => Unowned( | |
| 5491 | + unowned: json["unowned"], | |
| 5492 | + ); | |
| 5493 | + | |
| 5494 | + Map<String, dynamic> toJson() => { | |
| 5495 | + "unowned": unowned, | |
| 5496 | + }; | |
| 5497 | +} | |
| 5498 | + | |
| 5499 | +class Unsafe { | |
| 5500 | + final int unsafe; | |
| 5501 | + | |
| 5502 | + Unsafe({ | |
| 5503 | + required this.unsafe, | |
| 5504 | + }); | |
| 5505 | + | |
| 5506 | + factory Unsafe.fromJson(Map<String, dynamic> json) => Unsafe( | |
| 5507 | + unsafe: json["unsafe"], | |
| 5508 | + ); | |
| 5509 | + | |
| 5510 | + Map<String, dynamic> toJson() => { | |
| 5511 | + "unsafe": unsafe, | |
| 5512 | + }; | |
| 5513 | +} | |
| 5514 | + | |
| 5515 | +class Unsigned { | |
| 5516 | + final int unsigned; | |
| 5517 | + | |
| 5518 | + Unsigned({ | |
| 5519 | + required this.unsigned, | |
| 5520 | + }); | |
| 5521 | + | |
| 5522 | + factory Unsigned.fromJson(Map<String, dynamic> json) => Unsigned( | |
| 5523 | + unsigned: json["unsigned"], | |
| 5524 | + ); | |
| 5525 | + | |
| 5526 | + Map<String, dynamic> toJson() => { | |
| 5527 | + "unsigned": unsigned, | |
| 5528 | + }; | |
| 5529 | +} | |
| 5530 | + | |
| 5531 | +class Ushort { | |
| 5532 | + final int ushort; | |
| 5533 | + | |
| 5534 | + Ushort({ | |
| 5535 | + required this.ushort, | |
| 5536 | + }); | |
| 5537 | + | |
| 5538 | + factory Ushort.fromJson(Map<String, dynamic> json) => Ushort( | |
| 5539 | + ushort: json["ushort"], | |
| 5540 | + ); | |
| 5541 | + | |
| 5542 | + Map<String, dynamic> toJson() => { | |
| 5543 | + "ushort": ushort, | |
| 5544 | + }; | |
| 5545 | +} | |
| 5546 | + | |
| 5547 | +class Using { | |
| 5548 | + final int using; | |
| 5549 | + | |
| 5550 | + Using({ | |
| 5551 | + required this.using, | |
| 5552 | + }); | |
| 5553 | + | |
| 5554 | + factory Using.fromJson(Map<String, dynamic> json) => Using( | |
| 5555 | + using: json["using"], | |
| 5556 | + ); | |
| 5557 | + | |
| 5558 | + Map<String, dynamic> toJson() => { | |
| 5559 | + "using": using, | |
| 5560 | + }; | |
| 5561 | +} | |
| 5562 | + | |
| 5563 | +class Virtual { | |
| 5564 | + final int virtual; | |
| 5565 | + | |
| 5566 | + Virtual({ | |
| 5567 | + required this.virtual, | |
| 5568 | + }); | |
| 5569 | + | |
| 5570 | + factory Virtual.fromJson(Map<String, dynamic> json) => Virtual( | |
| 5571 | + virtual: json["virtual"], | |
| 5572 | + ); | |
| 5573 | + | |
| 5574 | + Map<String, dynamic> toJson() => { | |
| 5575 | + "virtual": virtual, | |
| 5576 | + }; | |
| 5577 | +} | |
| 5578 | + | |
| 5579 | +class Volatile { | |
| 5580 | + final int volatile; | |
| 5581 | + | |
| 5582 | + Volatile({ | |
| 5583 | + required this.volatile, | |
| 5584 | + }); | |
| 5585 | + | |
| 5586 | + factory Volatile.fromJson(Map<String, dynamic> json) => Volatile( | |
| 5587 | + volatile: json["volatile"], | |
| 5588 | + ); | |
| 5589 | + | |
| 5590 | + Map<String, dynamic> toJson() => { | |
| 5591 | + "volatile": volatile, | |
| 5592 | + }; | |
| 5593 | +} | |
| 5594 | + | |
| 5595 | +class WcharT { | |
| 5596 | + final int wcharT; | |
| 5597 | + | |
| 5598 | + WcharT({ | |
| 5599 | + required this.wcharT, | |
| 5600 | + }); | |
| 5601 | + | |
| 5602 | + factory WcharT.fromJson(Map<String, dynamic> json) => WcharT( | |
| 5603 | + wcharT: json["wchar_t"], | |
| 5604 | + ); | |
| 5605 | + | |
| 5606 | + Map<String, dynamic> toJson() => { | |
| 5607 | + "wchar_t": wcharT, | |
| 5608 | + }; | |
| 5609 | +} | |
| 5610 | + | |
| 5611 | +class Weak { | |
| 5612 | + final int weak; | |
| 5613 | + | |
| 5614 | + Weak({ | |
| 5615 | + required this.weak, | |
| 5616 | + }); | |
| 5617 | + | |
| 5618 | + factory Weak.fromJson(Map<String, dynamic> json) => Weak( | |
| 5619 | + weak: json["weak"], | |
| 5620 | + ); | |
| 5621 | + | |
| 5622 | + Map<String, dynamic> toJson() => { | |
| 5623 | + "weak": weak, | |
| 5624 | + }; | |
| 5625 | +} | |
| 5626 | + | |
| 5627 | +class Where { | |
| 5628 | + final int where; | |
| 5629 | + | |
| 5630 | + Where({ | |
| 5631 | + required this.where, | |
| 5632 | + }); | |
| 5633 | + | |
| 5634 | + factory Where.fromJson(Map<String, dynamic> json) => Where( | |
| 5635 | + where: json["where"], | |
| 5636 | + ); | |
| 5637 | + | |
| 5638 | + Map<String, dynamic> toJson() => { | |
| 5639 | + "where": where, | |
| 5640 | + }; | |
| 5641 | +} | |
| 5642 | + | |
| 5643 | +class WillSet { | |
| 5644 | + final int willSet; | |
| 5645 | + | |
| 5646 | + WillSet({ | |
| 5647 | + required this.willSet, | |
| 5648 | + }); | |
| 5649 | + | |
| 5650 | + factory WillSet.fromJson(Map<String, dynamic> json) => WillSet( | |
| 5651 | + willSet: json["willSet"], | |
| 5652 | + ); | |
| 5653 | + | |
| 5654 | + Map<String, dynamic> toJson() => { | |
| 5655 | + "willSet": willSet, | |
| 5656 | + }; | |
| 5657 | +} | |
| 5658 | + | |
| 5659 | +class Xor { | |
| 5660 | + final int xor; | |
| 5661 | + | |
| 5662 | + Xor({ | |
| 5663 | + required this.xor, | |
| 5664 | + }); | |
| 5665 | + | |
| 5666 | + factory Xor.fromJson(Map<String, dynamic> json) => Xor( | |
| 5667 | + xor: json["xor"], | |
| 5668 | + ); | |
| 5669 | + | |
| 5670 | + Map<String, dynamic> toJson() => { | |
| 5671 | + "xor": xor, | |
| 5672 | + }; | |
| 5673 | +} | |
| 5674 | + | |
| 5675 | +class XorEq { | |
| 5676 | + final int xorEq; | |
| 5677 | + | |
| 5678 | + XorEq({ | |
| 5679 | + required this.xorEq, | |
| 5680 | + }); | |
| 5681 | + | |
| 5682 | + factory XorEq.fromJson(Map<String, dynamic> json) => XorEq( | |
| 5683 | + xorEq: json["xor_eq"], | |
| 5684 | + ); | |
| 5685 | + | |
| 5686 | + Map<String, dynamic> toJson() => { | |
| 5687 | + "xor_eq": xorEq, | |
| 5688 | + }; | |
| 5689 | +} | |
| 5690 | + | |
| 5691 | +class Yes { | |
| 5692 | + final int yes; | |
| 5693 | + | |
| 5694 | + Yes({ | |
| 5695 | + required this.yes, | |
| 5696 | + }); | |
| 5697 | + | |
| 5698 | + factory Yes.fromJson(Map<String, dynamic> json) => Yes( | |
| 5699 | + yes: json["YES"], | |
| 5700 | + ); | |
| 5701 | + | |
| 5702 | + Map<String, dynamic> toJson() => { | |
| 5703 | + "YES": yes, | |
| 5704 | + }; | |
| 5705 | +} |
Test case
1 generated file · +2 −2test/inputs/schema/class-map-union.schema
Mschema-dartdefault / TopLevel.dart+2 −2
| @@ -16,11 +16,11 @@ class TopLevel { | ||
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 19 | - union: Map.from(json["union"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 19 | + union: json["union"] == null ? null : Map.from(json["union"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | 22 | Map<String, dynamic> toJson() => { |
| 23 | - "union": Map.from(union!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 23 | + "union": union == null ? null : Map.from(union!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 24 | 24 | }; |
| 25 | 25 | } |
Test case
1 generated file · +2 −2test/inputs/schema/class-with-additional.schema
Mschema-dartdefault / TopLevel.dart+2 −2
| @@ -16,10 +16,10 @@ class TopLevel { | ||
| 16 | 16 | }); |
| 17 | 17 | |
| 18 | 18 | factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( |
| 19 | - map: Map.from(json["map"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 19 | + map: json["map"] == null ? null : Map.from(json["map"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | 22 | Map<String, dynamic> toJson() => { |
| 23 | - "map": Map.from(map!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 23 | + "map": map == null ? null : Map.from(map!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 24 | 24 | }; |
| 25 | 25 | } |
Test case
1 generated file · +3,889 −0test/inputs/schema/keyword-unions.schema
Aschema-dartdefault / TopLevel.dart+3,889 −0
| @@ -0,0 +1,3889 @@ | ||
| 1 | +// To parse this JSON data, do | |
| 2 | +// | |
| 3 | +// final topLevel = topLevelFromJson(jsonString); | |
| 4 | + | |
| 5 | +import 'dart:convert'; | |
| 6 | + | |
| 7 | +TopLevel topLevelFromJson(String str) => TopLevel.fromJson(json.decode(str)); | |
| 8 | + | |
| 9 | +String topLevelToJson(TopLevel data) => json.encode(data.toJson()); | |
| 10 | + | |
| 11 | +class TopLevel { | |
| 12 | + final dynamic empty; | |
| 13 | + final dynamic purpleBool; | |
| 14 | + final dynamic complex; | |
| 15 | + final dynamic imaginery; | |
| 16 | + final dynamic topLevelAbstract; | |
| 17 | + final dynamic alignas; | |
| 18 | + final dynamic alignof; | |
| 19 | + final dynamic and; | |
| 20 | + final dynamic andEq; | |
| 21 | + final dynamic topLevelAny; | |
| 22 | + final dynamic any; | |
| 23 | + final dynamic array; | |
| 24 | + final dynamic topLevelAs; | |
| 25 | + final dynamic asm; | |
| 26 | + final dynamic topLevelAssert; | |
| 27 | + final dynamic associatedtype; | |
| 28 | + final dynamic associativity; | |
| 29 | + final dynamic topLevelAsync; | |
| 30 | + final dynamic atomic; | |
| 31 | + final dynamic atomicCancel; | |
| 32 | + final dynamic atomicCommit; | |
| 33 | + final dynamic atomicNoexcept; | |
| 34 | + final dynamic auto; | |
| 35 | + final dynamic topLevelAwait; | |
| 36 | + final dynamic base; | |
| 37 | + final dynamic bitand; | |
| 38 | + final dynamic bitor; | |
| 39 | + final dynamic topLevelBool; | |
| 40 | + final dynamic fluffyBool; | |
| 41 | + final dynamic boolean; | |
| 42 | + final dynamic topLevelBreak; | |
| 43 | + final dynamic bycopy; | |
| 44 | + final dynamic byref; | |
| 45 | + final dynamic byte; | |
| 46 | + final dynamic topLevelCase; | |
| 47 | + final dynamic topLevelCatch; | |
| 48 | + final dynamic chan; | |
| 49 | + final dynamic char; | |
| 50 | + final dynamic char16T; | |
| 51 | + final dynamic char32T; | |
| 52 | + final dynamic checked; | |
| 53 | + final dynamic purpleClass; | |
| 54 | + final dynamic topLevelClass; | |
| 55 | + final dynamic coAwait; | |
| 56 | + final dynamic coReturn; | |
| 57 | + final dynamic coYield; | |
| 58 | + final dynamic compl; | |
| 59 | + final dynamic concept; | |
| 60 | + final dynamic console; | |
| 61 | + final dynamic topLevelConst; | |
| 62 | + final dynamic constCast; | |
| 63 | + final dynamic constexpr; | |
| 64 | + final dynamic constructor; | |
| 65 | + final dynamic topLevelContinue; | |
| 66 | + final dynamic convenience; | |
| 67 | + final dynamic convert; | |
| 68 | + final dynamic converter; | |
| 69 | + final dynamic date; | |
| 70 | + final dynamic dateParseHandling; | |
| 71 | + final dynamic debugger; | |
| 72 | + final dynamic decimal; | |
| 73 | + final dynamic declare; | |
| 74 | + final dynamic decltype; | |
| 75 | + final dynamic decodeString; | |
| 76 | + final dynamic def; | |
| 77 | + final dynamic topLevelDefault; | |
| 78 | + final dynamic defer; | |
| 79 | + final dynamic deinit; | |
| 80 | + final dynamic del; | |
| 81 | + final dynamic delegate; | |
| 82 | + final dynamic delete; | |
| 83 | + final dynamic dict; | |
| 84 | + final dynamic dictionary; | |
| 85 | + final dynamic didSet; | |
| 86 | + final dynamic topLevelDo; | |
| 87 | + final dynamic topLevelDouble; | |
| 88 | + final double? dummy; | |
| 89 | + final dynamic topLevelDynamic; | |
| 90 | + final dynamic dynamicCast; | |
| 91 | + final dynamic elif; | |
| 92 | + final dynamic topLevelElse; | |
| 93 | + final dynamic encodeQuickType; | |
| 94 | + final dynamic topLevelEnum; | |
| 95 | + final dynamic event; | |
| 96 | + final dynamic except; | |
| 97 | + final dynamic exception; | |
| 98 | + final dynamic explicit; | |
| 99 | + final dynamic topLevelExport; | |
| 100 | + final dynamic exposing; | |
| 101 | + final dynamic topLevelExtends; | |
| 102 | + final dynamic extension; | |
| 103 | + final dynamic extern; | |
| 104 | + final dynamic fallthrough; | |
| 105 | + final dynamic purpleFalse; | |
| 106 | + final dynamic topLevelFalse; | |
| 107 | + final dynamic fileprivate; | |
| 108 | + final dynamic topLevelFinal; | |
| 109 | + final dynamic topLevelFinally; | |
| 110 | + final dynamic fixed; | |
| 111 | + final dynamic float; | |
| 112 | + final dynamic topLevelFor; | |
| 113 | + final dynamic foreach; | |
| 114 | + final dynamic friend; | |
| 115 | + final dynamic from; | |
| 116 | + final dynamic topLevelFromJson; | |
| 117 | + final dynamic func; | |
| 118 | + final dynamic function; | |
| 119 | + final dynamic topLevelGet; | |
| 120 | + final dynamic global; | |
| 121 | + final dynamic go; | |
| 122 | + final dynamic goto; | |
| 123 | + final dynamic guard; | |
| 124 | + final dynamic hasOwnProperty; | |
| 125 | + final dynamic id; | |
| 126 | + final dynamic topLevelIf; | |
| 127 | + final dynamic imp; | |
| 128 | + final dynamic topLevelImplements; | |
| 129 | + final dynamic implicit; | |
| 130 | + final dynamic topLevelImport; | |
| 131 | + final dynamic topLevelIn; | |
| 132 | + final dynamic indirect; | |
| 133 | + final dynamic infix; | |
| 134 | + final dynamic init; | |
| 135 | + final dynamic inline; | |
| 136 | + final dynamic inout; | |
| 137 | + final dynamic instanceof; | |
| 138 | + final dynamic topLevelInt; | |
| 139 | + final dynamic topLevelInterface; | |
| 140 | + final dynamic internal; | |
| 141 | + final dynamic topLevelIs; | |
| 142 | + final dynamic iterable; | |
| 143 | + final dynamic jdec; | |
| 144 | + final dynamic jenc; | |
| 145 | + final dynamic jpipe; | |
| 146 | + final dynamic json; | |
| 147 | + final dynamic jsonConverter; | |
| 148 | + final dynamic jsonSerializer; | |
| 149 | + final dynamic jsonToken; | |
| 150 | + final dynamic jsonWriter; | |
| 151 | + final dynamic lambda; | |
| 152 | + final dynamic lazy; | |
| 153 | + final dynamic left; | |
| 154 | + final dynamic let; | |
| 155 | + final dynamic list; | |
| 156 | + final dynamic lock; | |
| 157 | + final dynamic long; | |
| 158 | + final dynamic map; | |
| 159 | + final dynamic metadataPropertyHandling; | |
| 160 | + final dynamic module; | |
| 161 | + final dynamic mutable; | |
| 162 | + final dynamic mutating; | |
| 163 | + final dynamic namespace; | |
| 164 | + final dynamic native; | |
| 165 | + final dynamic topLevelNew; | |
| 166 | + final dynamic newtonsoft; | |
| 167 | + final dynamic nil; | |
| 168 | + final dynamic no; | |
| 169 | + final dynamic noexcept; | |
| 170 | + final dynamic nonatomic; | |
| 171 | + final dynamic topLevelNone; | |
| 172 | + final dynamic none; | |
| 173 | + final dynamic nonlocal; | |
| 174 | + final dynamic nonmutating; | |
| 175 | + final dynamic not; | |
| 176 | + final dynamic notEq; | |
| 177 | + final dynamic nsString; | |
| 178 | + final dynamic topLevelNull; | |
| 179 | + final dynamic purpleNull; | |
| 180 | + final dynamic nullptr; | |
| 181 | + final dynamic number; | |
| 182 | + final dynamic object; | |
| 183 | + final dynamic of; | |
| 184 | + final dynamic oneway; | |
| 185 | + final dynamic open; | |
| 186 | + final dynamic topLevelOperator; | |
| 187 | + final dynamic optional; | |
| 188 | + final dynamic or; | |
| 189 | + final dynamic orEq; | |
| 190 | + final dynamic out; | |
| 191 | + final dynamic override; | |
| 192 | + final dynamic package; | |
| 193 | + final dynamic params; | |
| 194 | + final dynamic pass; | |
| 195 | + final dynamic port; | |
| 196 | + final dynamic postfix; | |
| 197 | + final dynamic precedence; | |
| 198 | + final dynamic prefix; | |
| 199 | + final dynamic print; | |
| 200 | + final dynamic printf; | |
| 201 | + final dynamic private; | |
| 202 | + final dynamic protected; | |
| 203 | + final dynamic protocol; | |
| 204 | + final dynamic topLevelProtocol; | |
| 205 | + final dynamic public; | |
| 206 | + final dynamic quicktype; | |
| 207 | + final dynamic raise; | |
| 208 | + final dynamic range; | |
| 209 | + final dynamic readonly; | |
| 210 | + final dynamic ref; | |
| 211 | + final dynamic register; | |
| 212 | + final dynamic reinterpretCast; | |
| 213 | + final dynamic repeat; | |
| 214 | + final dynamic require; | |
| 215 | + final dynamic required; | |
| 216 | + final dynamic requires; | |
| 217 | + final dynamic restrict; | |
| 218 | + final dynamic retain; | |
| 219 | + final dynamic rethrows; | |
| 220 | + final dynamic topLevelReturn; | |
| 221 | + final dynamic right; | |
| 222 | + final dynamic sbyte; | |
| 223 | + final dynamic sealed; | |
| 224 | + final dynamic sel; | |
| 225 | + final dynamic select; | |
| 226 | + final dynamic self; | |
| 227 | + final dynamic topLevelSelf; | |
| 228 | + final dynamic serialize; | |
| 229 | + final dynamic topLevelSet; | |
| 230 | + final dynamic short; | |
| 231 | + final dynamic signed; | |
| 232 | + final dynamic sizeof; | |
| 233 | + final dynamic stackalloc; | |
| 234 | + final dynamic topLevelStatic; | |
| 235 | + final dynamic staticAssert; | |
| 236 | + final dynamic staticCast; | |
| 237 | + final dynamic strictfp; | |
| 238 | + final dynamic string; | |
| 239 | + final dynamic struct; | |
| 240 | + final dynamic subscript; | |
| 241 | + final dynamic topLevelSuper; | |
| 242 | + final dynamic topLevelSwitch; | |
| 243 | + final dynamic symbol; | |
| 244 | + final dynamic synchronized; | |
| 245 | + final dynamic system; | |
| 246 | + final dynamic template; | |
| 247 | + final dynamic then; | |
| 248 | + final dynamic topLevelThis; | |
| 249 | + final dynamic threadLocal; | |
| 250 | + final dynamic topLevelThrow; | |
| 251 | + final dynamic throws; | |
| 252 | + final dynamic topLevelToJson; | |
| 253 | + final dynamic topLevel; | |
| 254 | + final dynamic transient; | |
| 255 | + final dynamic topLevelTrue; | |
| 256 | + final dynamic purpleTrue; | |
| 257 | + final dynamic topLevelTry; | |
| 258 | + final dynamic type; | |
| 259 | + final dynamic topLevelType; | |
| 260 | + final dynamic typealias; | |
| 261 | + final dynamic topLevelTypedef; | |
| 262 | + final dynamic typeid; | |
| 263 | + final dynamic typename; | |
| 264 | + final dynamic typeof; | |
| 265 | + final dynamic uint; | |
| 266 | + final dynamic ulong; | |
| 267 | + final dynamic unchecked; | |
| 268 | + final dynamic undefined; | |
| 269 | + final dynamic union; | |
| 270 | + final dynamic unowned; | |
| 271 | + final dynamic unsafe; | |
| 272 | + final dynamic unsigned; | |
| 273 | + final dynamic ushort; | |
| 274 | + final dynamic using; | |
| 275 | + final dynamic topLevelVar; | |
| 276 | + final dynamic virtual; | |
| 277 | + final dynamic topLevelVoid; | |
| 278 | + final dynamic volatile; | |
| 279 | + final dynamic wcharT; | |
| 280 | + final dynamic weak; | |
| 281 | + final dynamic where; | |
| 282 | + final dynamic topLevelWhile; | |
| 283 | + final dynamic willSet; | |
| 284 | + final dynamic topLevelWith; | |
| 285 | + final dynamic xor; | |
| 286 | + final dynamic xorEq; | |
| 287 | + final dynamic yes; | |
| 288 | + final dynamic topLevelYield; | |
| 289 | + | |
| 290 | + TopLevel({ | |
| 291 | + this.empty, | |
| 292 | + this.purpleBool, | |
| 293 | + this.complex, | |
| 294 | + this.imaginery, | |
| 295 | + this.topLevelAbstract, | |
| 296 | + this.alignas, | |
| 297 | + this.alignof, | |
| 298 | + this.and, | |
| 299 | + this.andEq, | |
| 300 | + this.topLevelAny, | |
| 301 | + this.any, | |
| 302 | + this.array, | |
| 303 | + this.topLevelAs, | |
| 304 | + this.asm, | |
| 305 | + this.topLevelAssert, | |
| 306 | + this.associatedtype, | |
| 307 | + this.associativity, | |
| 308 | + this.topLevelAsync, | |
| 309 | + this.atomic, | |
| 310 | + this.atomicCancel, | |
| 311 | + this.atomicCommit, | |
| 312 | + this.atomicNoexcept, | |
| 313 | + this.auto, | |
| 314 | + this.topLevelAwait, | |
| 315 | + this.base, | |
| 316 | + this.bitand, | |
| 317 | + this.bitor, | |
| 318 | + this.topLevelBool, | |
| 319 | + this.fluffyBool, | |
| 320 | + this.boolean, | |
| 321 | + this.topLevelBreak, | |
| 322 | + this.bycopy, | |
| 323 | + this.byref, | |
| 324 | + this.byte, | |
| 325 | + this.topLevelCase, | |
| 326 | + this.topLevelCatch, | |
| 327 | + this.chan, | |
| 328 | + this.char, | |
| 329 | + this.char16T, | |
| 330 | + this.char32T, | |
| 331 | + this.checked, | |
| 332 | + this.purpleClass, | |
| 333 | + this.topLevelClass, | |
| 334 | + this.coAwait, | |
| 335 | + this.coReturn, | |
| 336 | + this.coYield, | |
| 337 | + this.compl, | |
| 338 | + this.concept, | |
| 339 | + this.console, | |
| 340 | + this.topLevelConst, | |
| 341 | + this.constCast, | |
| 342 | + this.constexpr, | |
| 343 | + this.constructor, | |
| 344 | + this.topLevelContinue, | |
| 345 | + this.convenience, | |
| 346 | + this.convert, | |
| 347 | + this.converter, | |
| 348 | + this.date, | |
| 349 | + this.dateParseHandling, | |
| 350 | + this.debugger, | |
| 351 | + this.decimal, | |
| 352 | + this.declare, | |
| 353 | + this.decltype, | |
| 354 | + this.decodeString, | |
| 355 | + this.def, | |
| 356 | + this.topLevelDefault, | |
| 357 | + this.defer, | |
| 358 | + this.deinit, | |
| 359 | + this.del, | |
| 360 | + this.delegate, | |
| 361 | + this.delete, | |
| 362 | + this.dict, | |
| 363 | + this.dictionary, | |
| 364 | + this.didSet, | |
| 365 | + this.topLevelDo, | |
| 366 | + this.topLevelDouble, | |
| 367 | + this.dummy, | |
| 368 | + this.topLevelDynamic, | |
| 369 | + this.dynamicCast, | |
| 370 | + this.elif, | |
| 371 | + this.topLevelElse, | |
| 372 | + this.encodeQuickType, | |
| 373 | + this.topLevelEnum, | |
| 374 | + this.event, | |
| 375 | + this.except, | |
| 376 | + this.exception, | |
| 377 | + this.explicit, | |
| 378 | + this.topLevelExport, | |
| 379 | + this.exposing, | |
| 380 | + this.topLevelExtends, | |
| 381 | + this.extension, | |
| 382 | + this.extern, | |
| 383 | + this.fallthrough, | |
| 384 | + this.purpleFalse, | |
| 385 | + this.topLevelFalse, | |
| 386 | + this.fileprivate, | |
| 387 | + this.topLevelFinal, | |
| 388 | + this.topLevelFinally, | |
| 389 | + this.fixed, | |
| 390 | + this.float, | |
| 391 | + this.topLevelFor, | |
| 392 | + this.foreach, | |
| 393 | + this.friend, | |
| 394 | + this.from, | |
| 395 | + this.topLevelFromJson, | |
| 396 | + this.func, | |
| 397 | + this.function, | |
| 398 | + this.topLevelGet, | |
| 399 | + this.global, | |
| 400 | + this.go, | |
| 401 | + this.goto, | |
| 402 | + this.guard, | |
| 403 | + this.hasOwnProperty, | |
| 404 | + this.id, | |
| 405 | + this.topLevelIf, | |
| 406 | + this.imp, | |
| 407 | + this.topLevelImplements, | |
| 408 | + this.implicit, | |
| 409 | + this.topLevelImport, | |
| 410 | + this.topLevelIn, | |
| 411 | + this.indirect, | |
| 412 | + this.infix, | |
| 413 | + this.init, | |
| 414 | + this.inline, | |
| 415 | + this.inout, | |
| 416 | + this.instanceof, | |
| 417 | + this.topLevelInt, | |
| 418 | + this.topLevelInterface, | |
| 419 | + this.internal, | |
| 420 | + this.topLevelIs, | |
| 421 | + this.iterable, | |
| 422 | + this.jdec, | |
| 423 | + this.jenc, | |
| 424 | + this.jpipe, | |
| 425 | + this.json, | |
| 426 | + this.jsonConverter, | |
| 427 | + this.jsonSerializer, | |
| 428 | + this.jsonToken, | |
| 429 | + this.jsonWriter, | |
| 430 | + this.lambda, | |
| 431 | + this.lazy, | |
| 432 | + this.left, | |
| 433 | + this.let, | |
| 434 | + this.list, | |
| 435 | + this.lock, | |
| 436 | + this.long, | |
| 437 | + this.map, | |
| 438 | + this.metadataPropertyHandling, | |
| 439 | + this.module, | |
| 440 | + this.mutable, | |
| 441 | + this.mutating, | |
| 442 | + this.namespace, | |
| 443 | + this.native, | |
| 444 | + this.topLevelNew, | |
| 445 | + this.newtonsoft, | |
| 446 | + this.nil, | |
| 447 | + this.no, | |
| 448 | + this.noexcept, | |
| 449 | + this.nonatomic, | |
| 450 | + this.topLevelNone, | |
| 451 | + this.none, | |
| 452 | + this.nonlocal, | |
| 453 | + this.nonmutating, | |
| 454 | + this.not, | |
| 455 | + this.notEq, | |
| 456 | + this.nsString, | |
| 457 | + this.topLevelNull, | |
| 458 | + this.purpleNull, | |
| 459 | + this.nullptr, | |
| 460 | + this.number, | |
| 461 | + this.object, | |
| 462 | + this.of, | |
| 463 | + this.oneway, | |
| 464 | + this.open, | |
| 465 | + this.topLevelOperator, | |
| 466 | + this.optional, | |
| 467 | + this.or, | |
| 468 | + this.orEq, | |
| 469 | + this.out, | |
| 470 | + this.override, | |
| 471 | + this.package, | |
| 472 | + this.params, | |
| 473 | + this.pass, | |
| 474 | + this.port, | |
| 475 | + this.postfix, | |
| 476 | + this.precedence, | |
| 477 | + this.prefix, | |
| 478 | + this.print, | |
| 479 | + this.printf, | |
| 480 | + this.private, | |
| 481 | + this.protected, | |
| 482 | + this.protocol, | |
| 483 | + this.topLevelProtocol, | |
| 484 | + this.public, | |
| 485 | + this.quicktype, | |
| 486 | + this.raise, | |
| 487 | + this.range, | |
| 488 | + this.readonly, | |
| 489 | + this.ref, | |
| 490 | + this.register, | |
| 491 | + this.reinterpretCast, | |
| 492 | + this.repeat, | |
| 493 | + this.require, | |
| 494 | + this.required, | |
| 495 | + this.requires, | |
| 496 | + this.restrict, | |
| 497 | + this.retain, | |
| 498 | + this.rethrows, | |
| 499 | + this.topLevelReturn, | |
| 500 | + this.right, | |
| 501 | + this.sbyte, | |
| 502 | + this.sealed, | |
| 503 | + this.sel, | |
| 504 | + this.select, | |
| 505 | + this.self, | |
| 506 | + this.topLevelSelf, | |
| 507 | + this.serialize, | |
| 508 | + this.topLevelSet, | |
| 509 | + this.short, | |
| 510 | + this.signed, | |
| 511 | + this.sizeof, | |
| 512 | + this.stackalloc, | |
| 513 | + this.topLevelStatic, | |
| 514 | + this.staticAssert, | |
| 515 | + this.staticCast, | |
| 516 | + this.strictfp, | |
| 517 | + this.string, | |
| 518 | + this.struct, | |
| 519 | + this.subscript, | |
| 520 | + this.topLevelSuper, | |
| 521 | + this.topLevelSwitch, | |
| 522 | + this.symbol, | |
| 523 | + this.synchronized, | |
| 524 | + this.system, | |
| 525 | + this.template, | |
| 526 | + this.then, | |
| 527 | + this.topLevelThis, | |
| 528 | + this.threadLocal, | |
| 529 | + this.topLevelThrow, | |
| 530 | + this.throws, | |
| 531 | + this.topLevelToJson, | |
| 532 | + this.topLevel, | |
| 533 | + this.transient, | |
| 534 | + this.topLevelTrue, | |
| 535 | + this.purpleTrue, | |
| 536 | + this.topLevelTry, | |
| 537 | + this.type, | |
| 538 | + this.topLevelType, | |
| 539 | + this.typealias, | |
| 540 | + this.topLevelTypedef, | |
| 541 | + this.typeid, | |
| 542 | + this.typename, | |
| 543 | + this.typeof, | |
| 544 | + this.uint, | |
| 545 | + this.ulong, | |
| 546 | + this.unchecked, | |
| 547 | + this.undefined, | |
| 548 | + this.union, | |
| 549 | + this.unowned, | |
| 550 | + this.unsafe, | |
| 551 | + this.unsigned, | |
| 552 | + this.ushort, | |
| 553 | + this.using, | |
| 554 | + this.topLevelVar, | |
| 555 | + this.virtual, | |
| 556 | + this.topLevelVoid, | |
| 557 | + this.volatile, | |
| 558 | + this.wcharT, | |
| 559 | + this.weak, | |
| 560 | + this.where, | |
| 561 | + this.topLevelWhile, | |
| 562 | + this.willSet, | |
| 563 | + this.topLevelWith, | |
| 564 | + this.xor, | |
| 565 | + this.xorEq, | |
| 566 | + this.yes, | |
| 567 | + this.topLevelYield, | |
| 568 | + }); | |
| 569 | + | |
| 570 | + factory TopLevel.fromJson(Map<String, dynamic> json) => TopLevel( | |
| 571 | + empty: json["_"], | |
| 572 | + purpleBool: json["_Bool"], | |
| 573 | + complex: json["_Complex"], | |
| 574 | + imaginery: json["_Imaginery"], | |
| 575 | + topLevelAbstract: json["abstract"], | |
| 576 | + alignas: json["alignas"], | |
| 577 | + alignof: json["alignof"], | |
| 578 | + and: json["and"], | |
| 579 | + andEq: json["and_eq"], | |
| 580 | + topLevelAny: json["any"], | |
| 581 | + any: json["Any"], | |
| 582 | + array: json["array"], | |
| 583 | + topLevelAs: json["as"], | |
| 584 | + asm: json["asm"], | |
| 585 | + topLevelAssert: json["assert"], | |
| 586 | + associatedtype: json["associatedtype"], | |
| 587 | + associativity: json["associativity"], | |
| 588 | + topLevelAsync: json["async"], | |
| 589 | + atomic: json["atomic"], | |
| 590 | + atomicCancel: json["atomic_cancel"], | |
| 591 | + atomicCommit: json["atomic_commit"], | |
| 592 | + atomicNoexcept: json["atomic_noexcept"], | |
| 593 | + auto: json["auto"], | |
| 594 | + topLevelAwait: json["await"], | |
| 595 | + base: json["base"], | |
| 596 | + bitand: json["bitand"], | |
| 597 | + bitor: json["bitor"], | |
| 598 | + topLevelBool: json["BOOL"], | |
| 599 | + fluffyBool: json["bool"], | |
| 600 | + boolean: json["boolean"], | |
| 601 | + topLevelBreak: json["break"], | |
| 602 | + bycopy: json["bycopy"], | |
| 603 | + byref: json["byref"], | |
| 604 | + byte: json["byte"], | |
| 605 | + topLevelCase: json["case"], | |
| 606 | + topLevelCatch: json["catch"], | |
| 607 | + chan: json["chan"], | |
| 608 | + char: json["char"], | |
| 609 | + char16T: json["char16_t"], | |
| 610 | + char32T: json["char32_t"], | |
| 611 | + checked: json["checked"], | |
| 612 | + purpleClass: json["class"], | |
| 613 | + topLevelClass: json["Class"], | |
| 614 | + coAwait: json["co_await"], | |
| 615 | + coReturn: json["co_return"], | |
| 616 | + coYield: json["co_yield"], | |
| 617 | + compl: json["compl"], | |
| 618 | + concept: json["concept"], | |
| 619 | + console: json["console"], | |
| 620 | + topLevelConst: json["const"], | |
| 621 | + constCast: json["const_cast"], | |
| 622 | + constexpr: json["constexpr"], | |
| 623 | + constructor: json["constructor"], | |
| 624 | + topLevelContinue: json["continue"], | |
| 625 | + convenience: json["convenience"], | |
| 626 | + convert: json["convert"], | |
| 627 | + converter: json["converter"], | |
| 628 | + date: json["date"], | |
| 629 | + dateParseHandling: json["date_parse_handling"], | |
| 630 | + debugger: json["debugger"], | |
| 631 | + decimal: json["decimal"], | |
| 632 | + declare: json["declare"], | |
| 633 | + decltype: json["decltype"], | |
| 634 | + decodeString: json["decode_string"], | |
| 635 | + def: json["def"], | |
| 636 | + topLevelDefault: json["default"], | |
| 637 | + defer: json["defer"], | |
| 638 | + deinit: json["deinit"], | |
| 639 | + del: json["del"], | |
| 640 | + delegate: json["delegate"], | |
| 641 | + delete: json["delete"], | |
| 642 | + dict: json["dict"], | |
| 643 | + dictionary: json["dictionary"], | |
| 644 | + didSet: json["didSet"], | |
| 645 | + topLevelDo: json["do"], | |
| 646 | + topLevelDouble: json["double"], | |
| 647 | + dummy: json["dummy"]?.toDouble(), | |
| 648 | + topLevelDynamic: json["dynamic"], | |
| 649 | + dynamicCast: json["dynamic_cast"], | |
| 650 | + elif: json["elif"], | |
| 651 | + topLevelElse: json["else"], | |
| 652 | + encodeQuickType: json["encode_quick_type"], | |
| 653 | + topLevelEnum: json["enum"], | |
| 654 | + event: json["event"], | |
| 655 | + except: json["except"], | |
| 656 | + exception: json["exception"], | |
| 657 | + explicit: json["explicit"], | |
| 658 | + topLevelExport: json["export"], | |
| 659 | + exposing: json["exposing"], | |
| 660 | + topLevelExtends: json["extends"], | |
| 661 | + extension: json["extension"], | |
| 662 | + extern: json["extern"], | |
| 663 | + fallthrough: json["fallthrough"], | |
| 664 | + purpleFalse: json["false"], | |
| 665 | + topLevelFalse: json["False"], | |
| 666 | + fileprivate: json["fileprivate"], | |
| 667 | + topLevelFinal: json["final"], | |
| 668 | + topLevelFinally: json["finally"], | |
| 669 | + fixed: json["fixed"], | |
| 670 | + float: json["float"], | |
| 671 | + topLevelFor: json["for"], | |
| 672 | + foreach: json["foreach"], | |
| 673 | + friend: json["friend"], | |
| 674 | + from: json["from"], | |
| 675 | + topLevelFromJson: json["from_json"], | |
| 676 | + func: json["func"], | |
| 677 | + function: json["function"], | |
| 678 | + topLevelGet: json["get"], | |
| 679 | + global: json["global"], | |
| 680 | + go: json["go"], | |
| 681 | + goto: json["goto"], | |
| 682 | + guard: json["guard"], | |
| 683 | + hasOwnProperty: json["hasOwnProperty"], | |
| 684 | + id: json["id"], | |
| 685 | + topLevelIf: json["if"], | |
| 686 | + imp: json["IMP"], | |
| 687 | + topLevelImplements: json["implements"], | |
| 688 | + implicit: json["implicit"], | |
| 689 | + topLevelImport: json["import"], | |
| 690 | + topLevelIn: json["in"], | |
| 691 | + indirect: json["indirect"], | |
| 692 | + infix: json["infix"], | |
| 693 | + init: json["init"], | |
| 694 | + inline: json["inline"], | |
| 695 | + inout: json["inout"], | |
| 696 | + instanceof: json["instanceof"], | |
| 697 | + topLevelInt: json["int"], | |
| 698 | + topLevelInterface: json["interface"], | |
| 699 | + internal: json["internal"], | |
| 700 | + topLevelIs: json["is"], | |
| 701 | + iterable: json["iterable"], | |
| 702 | + jdec: json["jdec"], | |
| 703 | + jenc: json["jenc"], | |
| 704 | + jpipe: json["jpipe"], | |
| 705 | + json: json["json"], | |
| 706 | + jsonConverter: json["json_converter"], | |
| 707 | + jsonSerializer: json["json_serializer"], | |
| 708 | + jsonToken: json["json_token"], | |
| 709 | + jsonWriter: json["json_writer"], | |
| 710 | + lambda: json["lambda"], | |
| 711 | + lazy: json["lazy"], | |
| 712 | + left: json["left"], | |
| 713 | + let: json["let"], | |
| 714 | + list: json["list"], | |
| 715 | + lock: json["lock"], | |
| 716 | + long: json["long"], | |
| 717 | + map: json["map"], | |
| 718 | + metadataPropertyHandling: json["metadata_property_handling"], | |
| 719 | + module: json["module"], | |
| 720 | + mutable: json["mutable"], | |
| 721 | + mutating: json["mutating"], | |
| 722 | + namespace: json["namespace"], | |
| 723 | + native: json["native"], | |
| 724 | + topLevelNew: json["new"], | |
| 725 | + newtonsoft: json["newtonsoft"], | |
| 726 | + nil: json["nil"], | |
| 727 | + no: json["NO"], | |
| 728 | + noexcept: json["noexcept"], | |
| 729 | + nonatomic: json["nonatomic"], | |
| 730 | + topLevelNone: json["none"], | |
| 731 | + none: json["None"], | |
| 732 | + nonlocal: json["nonlocal"], | |
| 733 | + nonmutating: json["nonmutating"], | |
| 734 | + not: json["not"], | |
| 735 | + notEq: json["not_eq"], | |
| 736 | + nsString: json["NSString"], | |
| 737 | + topLevelNull: json["NULL"], | |
| 738 | + purpleNull: json["null"], | |
| 739 | + nullptr: json["nullptr"], | |
| 740 | + number: json["number"], | |
| 741 | + object: json["object"], | |
| 742 | + of: json["of"], | |
| 743 | + oneway: json["oneway"], | |
| 744 | + open: json["open"], | |
| 745 | + topLevelOperator: json["operator"], | |
| 746 | + optional: json["optional"], | |
| 747 | + or: json["or"], | |
| 748 | + orEq: json["or_eq"], | |
| 749 | + out: json["out"], | |
| 750 | + override: json["override"], | |
| 751 | + package: json["package"], | |
| 752 | + params: json["params"], | |
| 753 | + pass: json["pass"], | |
| 754 | + port: json["port"], | |
| 755 | + postfix: json["postfix"], | |
| 756 | + precedence: json["precedence"], | |
| 757 | + prefix: json["prefix"], | |
| 758 | + print: json["print"], | |
| 759 | + printf: json["printf"], | |
| 760 | + private: json["private"], | |
| 761 | + protected: json["protected"], | |
| 762 | + protocol: json["Protocol"], | |
| 763 | + topLevelProtocol: json["protocol"], | |
| 764 | + public: json["public"], | |
| 765 | + quicktype: json["quicktype"], | |
| 766 | + raise: json["raise"], | |
| 767 | + range: json["range"], | |
| 768 | + readonly: json["readonly"], | |
| 769 | + ref: json["ref"], | |
| 770 | + register: json["register"], | |
| 771 | + reinterpretCast: json["reinterpret_cast"], | |
| 772 | + repeat: json["repeat"], | |
| 773 | + require: json["require"], | |
| 774 | + required: json["required"], | |
| 775 | + requires: json["requires"], | |
| 776 | + restrict: json["restrict"], | |
| 777 | + retain: json["retain"], | |
| 778 | + rethrows: json["rethrows"], | |
| 779 | + topLevelReturn: json["return"], | |
| 780 | + right: json["right"], | |
| 781 | + sbyte: json["sbyte"], | |
| 782 | + sealed: json["sealed"], | |
| 783 | + sel: json["SEL"], | |
| 784 | + select: json["select"], | |
| 785 | + self: json["Self"], | |
| 786 | + topLevelSelf: json["self"], | |
| 787 | + serialize: json["serialize"], | |
| 788 | + topLevelSet: json["set"], | |
| 789 | + short: json["short"], | |
| 790 | + signed: json["signed"], | |
| 791 | + sizeof: json["sizeof"], | |
| 792 | + stackalloc: json["stackalloc"], | |
| 793 | + topLevelStatic: json["static"], | |
| 794 | + staticAssert: json["static_assert"], | |
| 795 | + staticCast: json["static_cast"], | |
| 796 | + strictfp: json["strictfp"], | |
| 797 | + string: json["string"], | |
| 798 | + struct: json["struct"], | |
| 799 | + subscript: json["subscript"], | |
| 800 | + topLevelSuper: json["super"], | |
| 801 | + topLevelSwitch: json["switch"], | |
| 802 | + symbol: json["symbol"], | |
| 803 | + synchronized: json["synchronized"], | |
| 804 | + system: json["system"], | |
| 805 | + template: json["template"], | |
| 806 | + then: json["then"], | |
| 807 | + topLevelThis: json["this"], | |
| 808 | + threadLocal: json["thread_local"], | |
| 809 | + topLevelThrow: json["throw"], | |
| 810 | + throws: json["throws"], | |
| 811 | + topLevelToJson: json["to_json"], | |
| 812 | + topLevel: json["top_level"], | |
| 813 | + transient: json["transient"], | |
| 814 | + topLevelTrue: json["True"], | |
| 815 | + purpleTrue: json["true"], | |
| 816 | + topLevelTry: json["try"], | |
| 817 | + type: json["Type"], | |
| 818 | + topLevelType: json["type"], | |
| 819 | + typealias: json["typealias"], | |
| 820 | + topLevelTypedef: json["typedef"], | |
| 821 | + typeid: json["typeid"], | |
| 822 | + typename: json["typename"], | |
| 823 | + typeof: json["typeof"], | |
| 824 | + uint: json["uint"], | |
| 825 | + ulong: json["ulong"], | |
| 826 | + unchecked: json["unchecked"], | |
| 827 | + undefined: json["undefined"], | |
| 828 | + union: json["union"], | |
| 829 | + unowned: json["unowned"], | |
| 830 | + unsafe: json["unsafe"], | |
| 831 | + unsigned: json["unsigned"], | |
| 832 | + ushort: json["ushort"], | |
| 833 | + using: json["using"], | |
| 834 | + topLevelVar: json["var"], | |
| 835 | + virtual: json["virtual"], | |
| 836 | + topLevelVoid: json["void"], | |
| 837 | + volatile: json["volatile"], | |
| 838 | + wcharT: json["wchar_t"], | |
| 839 | + weak: json["weak"], | |
| 840 | + where: json["where"], | |
| 841 | + topLevelWhile: json["while"], | |
| 842 | + willSet: json["willSet"], | |
| 843 | + topLevelWith: json["with"], | |
| 844 | + xor: json["xor"], | |
| 845 | + xorEq: json["xor_eq"], | |
| 846 | + yes: json["YES"], | |
| 847 | + topLevelYield: json["yield"], | |
| 848 | + ); | |
| 849 | + | |
| 850 | + Map<String, dynamic> toJson() => { | |
| 851 | + "_": empty, | |
| 852 | + "_Bool": purpleBool, | |
| 853 | + "_Complex": complex, | |
| 854 | + "_Imaginery": imaginery, | |
| 855 | + "abstract": topLevelAbstract, | |
| 856 | + "alignas": alignas, | |
| 857 | + "alignof": alignof, | |
| 858 | + "and": and, | |
| 859 | + "and_eq": andEq, | |
| 860 | + "any": topLevelAny, | |
| 861 | + "Any": any, | |
| 862 | + "array": array, | |
| 863 | + "as": topLevelAs, | |
| 864 | + "asm": asm, | |
| 865 | + "assert": topLevelAssert, | |
| 866 | + "associatedtype": associatedtype, | |
| 867 | + "associativity": associativity, | |
| 868 | + "async": topLevelAsync, | |
| 869 | + "atomic": atomic, | |
| 870 | + "atomic_cancel": atomicCancel, | |
| 871 | + "atomic_commit": atomicCommit, | |
| 872 | + "atomic_noexcept": atomicNoexcept, | |
| 873 | + "auto": auto, | |
| 874 | + "await": topLevelAwait, | |
| 875 | + "base": base, | |
| 876 | + "bitand": bitand, | |
| 877 | + "bitor": bitor, | |
| 878 | + "BOOL": topLevelBool, | |
| 879 | + "bool": fluffyBool, | |
| 880 | + "boolean": boolean, | |
| 881 | + "break": topLevelBreak, | |
| 882 | + "bycopy": bycopy, | |
| 883 | + "byref": byref, | |
| 884 | + "byte": byte, | |
| 885 | + "case": topLevelCase, | |
| 886 | + "catch": topLevelCatch, | |
| 887 | + "chan": chan, | |
| 888 | + "char": char, | |
| 889 | + "char16_t": char16T, | |
| 890 | + "char32_t": char32T, | |
| 891 | + "checked": checked, | |
| 892 | + "class": purpleClass, | |
| 893 | + "Class": topLevelClass, | |
| 894 | + "co_await": coAwait, | |
| 895 | + "co_return": coReturn, | |
| 896 | + "co_yield": coYield, | |
| 897 | + "compl": compl, | |
| 898 | + "concept": concept, | |
| 899 | + "console": console, | |
| 900 | + "const": topLevelConst, | |
| 901 | + "const_cast": constCast, | |
| 902 | + "constexpr": constexpr, | |
| 903 | + "constructor": constructor, | |
| 904 | + "continue": topLevelContinue, | |
| 905 | + "convenience": convenience, | |
| 906 | + "convert": convert, | |
| 907 | + "converter": converter, | |
| 908 | + "date": date, | |
| 909 | + "date_parse_handling": dateParseHandling, | |
| 910 | + "debugger": debugger, | |
| 911 | + "decimal": decimal, | |
| 912 | + "declare": declare, | |
| 913 | + "decltype": decltype, | |
| 914 | + "decode_string": decodeString, | |
| 915 | + "def": def, | |
| 916 | + "default": topLevelDefault, | |
| 917 | + "defer": defer, | |
| 918 | + "deinit": deinit, | |
| 919 | + "del": del, | |
| 920 | + "delegate": delegate, | |
| 921 | + "delete": delete, | |
| 922 | + "dict": dict, | |
| 923 | + "dictionary": dictionary, | |
| 924 | + "didSet": didSet, | |
| 925 | + "do": topLevelDo, | |
| 926 | + "double": topLevelDouble, | |
| 927 | + "dummy": dummy, | |
| 928 | + "dynamic": topLevelDynamic, | |
| 929 | + "dynamic_cast": dynamicCast, | |
| 930 | + "elif": elif, | |
| 931 | + "else": topLevelElse, | |
| 932 | + "encode_quick_type": encodeQuickType, | |
| 933 | + "enum": topLevelEnum, | |
| 934 | + "event": event, | |
| 935 | + "except": except, | |
| 936 | + "exception": exception, | |
| 937 | + "explicit": explicit, | |
| 938 | + "export": topLevelExport, | |
| 939 | + "exposing": exposing, | |
| 940 | + "extends": topLevelExtends, | |
| 941 | + "extension": extension, | |
| 942 | + "extern": extern, | |
| 943 | + "fallthrough": fallthrough, | |
| 944 | + "false": purpleFalse, | |
| 945 | + "False": topLevelFalse, | |
| 946 | + "fileprivate": fileprivate, | |
| 947 | + "final": topLevelFinal, | |
| 948 | + "finally": topLevelFinally, | |
| 949 | + "fixed": fixed, | |
| 950 | + "float": float, | |
| 951 | + "for": topLevelFor, | |
| 952 | + "foreach": foreach, | |
| 953 | + "friend": friend, | |
| 954 | + "from": from, | |
| 955 | + "from_json": topLevelFromJson, | |
| 956 | + "func": func, | |
| 957 | + "function": function, | |
| 958 | + "get": topLevelGet, | |
| 959 | + "global": global, | |
| 960 | + "go": go, | |
| 961 | + "goto": goto, | |
| 962 | + "guard": guard, | |
| 963 | + "hasOwnProperty": hasOwnProperty, | |
| 964 | + "id": id, | |
| 965 | + "if": topLevelIf, | |
| 966 | + "IMP": imp, | |
| 967 | + "implements": topLevelImplements, | |
| 968 | + "implicit": implicit, | |
| 969 | + "import": topLevelImport, | |
| 970 | + "in": topLevelIn, | |
| 971 | + "indirect": indirect, | |
| 972 | + "infix": infix, | |
| 973 | + "init": init, | |
| 974 | + "inline": inline, | |
| 975 | + "inout": inout, | |
| 976 | + "instanceof": instanceof, | |
| 977 | + "int": topLevelInt, | |
| 978 | + "interface": topLevelInterface, | |
| 979 | + "internal": internal, | |
| 980 | + "is": topLevelIs, | |
| 981 | + "iterable": iterable, | |
| 982 | + "jdec": jdec, | |
| 983 | + "jenc": jenc, | |
| 984 | + "jpipe": jpipe, | |
| 985 | + "json": json, | |
| 986 | + "json_converter": jsonConverter, | |
| 987 | + "json_serializer": jsonSerializer, | |
| 988 | + "json_token": jsonToken, | |
| 989 | + "json_writer": jsonWriter, | |
| 990 | + "lambda": lambda, | |
| 991 | + "lazy": lazy, | |
| 992 | + "left": left, | |
| 993 | + "let": let, | |
| 994 | + "list": list, | |
| 995 | + "lock": lock, | |
| 996 | + "long": long, | |
| 997 | + "map": map, | |
| 998 | + "metadata_property_handling": metadataPropertyHandling, | |
| 999 | + "module": module, | |
| 1000 | + "mutable": mutable, | |
| 1001 | + "mutating": mutating, | |
| 1002 | + "namespace": namespace, | |
| 1003 | + "native": native, | |
| 1004 | + "new": topLevelNew, | |
| 1005 | + "newtonsoft": newtonsoft, | |
| 1006 | + "nil": nil, | |
| 1007 | + "NO": no, | |
| 1008 | + "noexcept": noexcept, | |
| 1009 | + "nonatomic": nonatomic, | |
| 1010 | + "none": topLevelNone, | |
| 1011 | + "None": none, | |
| 1012 | + "nonlocal": nonlocal, | |
| 1013 | + "nonmutating": nonmutating, | |
| 1014 | + "not": not, | |
| 1015 | + "not_eq": notEq, | |
| 1016 | + "NSString": nsString, | |
| 1017 | + "NULL": topLevelNull, | |
| 1018 | + "null": purpleNull, | |
| 1019 | + "nullptr": nullptr, | |
| 1020 | + "number": number, | |
| 1021 | + "object": object, | |
| 1022 | + "of": of, | |
| 1023 | + "oneway": oneway, | |
| 1024 | + "open": open, | |
| 1025 | + "operator": topLevelOperator, | |
| 1026 | + "optional": optional, | |
| 1027 | + "or": or, | |
| 1028 | + "or_eq": orEq, | |
| 1029 | + "out": out, | |
| 1030 | + "override": override, | |
| 1031 | + "package": package, | |
| 1032 | + "params": params, | |
| 1033 | + "pass": pass, | |
| 1034 | + "port": port, | |
| 1035 | + "postfix": postfix, | |
| 1036 | + "precedence": precedence, | |
| 1037 | + "prefix": prefix, | |
| 1038 | + "print": print, | |
| 1039 | + "printf": printf, | |
| 1040 | + "private": private, | |
| 1041 | + "protected": protected, | |
| 1042 | + "Protocol": protocol, | |
| 1043 | + "protocol": topLevelProtocol, | |
| 1044 | + "public": public, | |
| 1045 | + "quicktype": quicktype, | |
| 1046 | + "raise": raise, | |
| 1047 | + "range": range, | |
| 1048 | + "readonly": readonly, | |
| 1049 | + "ref": ref, | |
| 1050 | + "register": register, | |
| 1051 | + "reinterpret_cast": reinterpretCast, | |
| 1052 | + "repeat": repeat, | |
| 1053 | + "require": require, | |
| 1054 | + "required": required, | |
| 1055 | + "requires": requires, | |
| 1056 | + "restrict": restrict, | |
| 1057 | + "retain": retain, | |
| 1058 | + "rethrows": rethrows, | |
| 1059 | + "return": topLevelReturn, | |
| 1060 | + "right": right, | |
| 1061 | + "sbyte": sbyte, | |
| 1062 | + "sealed": sealed, | |
| 1063 | + "SEL": sel, | |
| 1064 | + "select": select, | |
| 1065 | + "Self": self, | |
| 1066 | + "self": topLevelSelf, | |
| 1067 | + "serialize": serialize, | |
| 1068 | + "set": topLevelSet, | |
| 1069 | + "short": short, | |
| 1070 | + "signed": signed, | |
| 1071 | + "sizeof": sizeof, | |
| 1072 | + "stackalloc": stackalloc, | |
| 1073 | + "static": topLevelStatic, | |
| 1074 | + "static_assert": staticAssert, | |
| 1075 | + "static_cast": staticCast, | |
| 1076 | + "strictfp": strictfp, | |
| 1077 | + "string": string, | |
| 1078 | + "struct": struct, | |
| 1079 | + "subscript": subscript, | |
| 1080 | + "super": topLevelSuper, | |
| 1081 | + "switch": topLevelSwitch, | |
| 1082 | + "symbol": symbol, | |
| 1083 | + "synchronized": synchronized, | |
| 1084 | + "system": system, | |
| 1085 | + "template": template, | |
| 1086 | + "then": then, | |
| 1087 | + "this": topLevelThis, | |
| 1088 | + "thread_local": threadLocal, | |
| 1089 | + "throw": topLevelThrow, | |
| 1090 | + "throws": throws, | |
| 1091 | + "to_json": topLevelToJson, | |
| 1092 | + "top_level": topLevel, | |
| 1093 | + "transient": transient, | |
| 1094 | + "True": topLevelTrue, | |
| 1095 | + "true": purpleTrue, | |
| 1096 | + "try": topLevelTry, | |
| 1097 | + "Type": type, | |
| 1098 | + "type": topLevelType, | |
| 1099 | + "typealias": typealias, | |
| 1100 | + "typedef": topLevelTypedef, | |
| 1101 | + "typeid": typeid, | |
| 1102 | + "typename": typename, | |
| 1103 | + "typeof": typeof, | |
| 1104 | + "uint": uint, | |
| 1105 | + "ulong": ulong, | |
| 1106 | + "unchecked": unchecked, | |
| 1107 | + "undefined": undefined, | |
| 1108 | + "union": union, | |
| 1109 | + "unowned": unowned, | |
| 1110 | + "unsafe": unsafe, | |
| 1111 | + "unsigned": unsigned, | |
| 1112 | + "ushort": ushort, | |
| 1113 | + "using": using, | |
| 1114 | + "var": topLevelVar, | |
| 1115 | + "virtual": virtual, | |
| 1116 | + "void": topLevelVoid, | |
| 1117 | + "volatile": volatile, | |
| 1118 | + "wchar_t": wcharT, | |
| 1119 | + "weak": weak, | |
| 1120 | + "where": where, | |
| 1121 | + "while": topLevelWhile, | |
| 1122 | + "willSet": willSet, | |
| 1123 | + "with": topLevelWith, | |
| 1124 | + "xor": xor, | |
| 1125 | + "xor_eq": xorEq, | |
| 1126 | + "YES": yes, | |
| 1127 | + "yield": topLevelYield, | |
| 1128 | + }; | |
| 1129 | +} | |
| 1130 | + | |
| 1131 | +class Alignas { | |
| 1132 | + Alignas(); | |
| 1133 | + | |
| 1134 | + factory Alignas.fromJson(Map<String, dynamic> json) => Alignas( | |
| 1135 | + ); | |
| 1136 | + | |
| 1137 | + Map<String, dynamic> toJson() => { | |
| 1138 | + }; | |
| 1139 | +} | |
| 1140 | + | |
| 1141 | +class Alignof { | |
| 1142 | + Alignof(); | |
| 1143 | + | |
| 1144 | + factory Alignof.fromJson(Map<String, dynamic> json) => Alignof( | |
| 1145 | + ); | |
| 1146 | + | |
| 1147 | + Map<String, dynamic> toJson() => { | |
| 1148 | + }; | |
| 1149 | +} | |
| 1150 | + | |
| 1151 | +class And { | |
| 1152 | + And(); | |
| 1153 | + | |
| 1154 | + factory And.fromJson(Map<String, dynamic> json) => And( | |
| 1155 | + ); | |
| 1156 | + | |
| 1157 | + Map<String, dynamic> toJson() => { | |
| 1158 | + }; | |
| 1159 | +} | |
| 1160 | + | |
| 1161 | +class AndEq { | |
| 1162 | + AndEq(); | |
| 1163 | + | |
| 1164 | + factory AndEq.fromJson(Map<String, dynamic> json) => AndEq( | |
| 1165 | + ); | |
| 1166 | + | |
| 1167 | + Map<String, dynamic> toJson() => { | |
| 1168 | + }; | |
| 1169 | +} | |
| 1170 | + | |
| 1171 | +class Any { | |
| 1172 | + Any(); | |
| 1173 | + | |
| 1174 | + factory Any.fromJson(Map<String, dynamic> json) => Any( | |
| 1175 | + ); | |
| 1176 | + | |
| 1177 | + Map<String, dynamic> toJson() => { | |
| 1178 | + }; | |
| 1179 | +} | |
| 1180 | + | |
| 1181 | +class Array { | |
| 1182 | + Array(); | |
| 1183 | + | |
| 1184 | + factory Array.fromJson(Map<String, dynamic> json) => Array( | |
| 1185 | + ); | |
| 1186 | + | |
| 1187 | + Map<String, dynamic> toJson() => { | |
| 1188 | + }; | |
| 1189 | +} | |
| 1190 | + | |
| 1191 | +class Asm { | |
| 1192 | + Asm(); | |
| 1193 | + | |
| 1194 | + factory Asm.fromJson(Map<String, dynamic> json) => Asm( | |
| 1195 | + ); | |
| 1196 | + | |
| 1197 | + Map<String, dynamic> toJson() => { | |
| 1198 | + }; | |
| 1199 | +} | |
| 1200 | + | |
| 1201 | +class Associatedtype { | |
| 1202 | + Associatedtype(); | |
| 1203 | + | |
| 1204 | + factory Associatedtype.fromJson(Map<String, dynamic> json) => Associatedtype( | |
| 1205 | + ); | |
| 1206 | + | |
| 1207 | + Map<String, dynamic> toJson() => { | |
| 1208 | + }; | |
| 1209 | +} | |
| 1210 | + | |
| 1211 | +class Associativity { | |
| 1212 | + Associativity(); | |
| 1213 | + | |
| 1214 | + factory Associativity.fromJson(Map<String, dynamic> json) => Associativity( | |
| 1215 | + ); | |
| 1216 | + | |
| 1217 | + Map<String, dynamic> toJson() => { | |
| 1218 | + }; | |
| 1219 | +} | |
| 1220 | + | |
| 1221 | +class Atomic { | |
| 1222 | + Atomic(); | |
| 1223 | + | |
| 1224 | + factory Atomic.fromJson(Map<String, dynamic> json) => Atomic( | |
| 1225 | + ); | |
| 1226 | + | |
| 1227 | + Map<String, dynamic> toJson() => { | |
| 1228 | + }; | |
| 1229 | +} | |
| 1230 | + | |
| 1231 | +class AtomicCancel { | |
| 1232 | + AtomicCancel(); | |
| 1233 | + | |
| 1234 | + factory AtomicCancel.fromJson(Map<String, dynamic> json) => AtomicCancel( | |
| 1235 | + ); | |
| 1236 | + | |
| 1237 | + Map<String, dynamic> toJson() => { | |
| 1238 | + }; | |
| 1239 | +} | |
| 1240 | + | |
| 1241 | +class AtomicCommit { | |
| 1242 | + AtomicCommit(); | |
| 1243 | + | |
| 1244 | + factory AtomicCommit.fromJson(Map<String, dynamic> json) => AtomicCommit( | |
| 1245 | + ); | |
| 1246 | + | |
| 1247 | + Map<String, dynamic> toJson() => { | |
| 1248 | + }; | |
| 1249 | +} | |
| 1250 | + | |
| 1251 | +class AtomicNoexcept { | |
| 1252 | + AtomicNoexcept(); | |
| 1253 | + | |
| 1254 | + factory AtomicNoexcept.fromJson(Map<String, dynamic> json) => AtomicNoexcept( | |
| 1255 | + ); | |
| 1256 | + | |
| 1257 | + Map<String, dynamic> toJson() => { | |
| 1258 | + }; | |
| 1259 | +} | |
| 1260 | + | |
| 1261 | +class Auto { | |
| 1262 | + Auto(); | |
| 1263 | + | |
| 1264 | + factory Auto.fromJson(Map<String, dynamic> json) => Auto( | |
| 1265 | + ); | |
| 1266 | + | |
| 1267 | + Map<String, dynamic> toJson() => { | |
| 1268 | + }; | |
| 1269 | +} | |
| 1270 | + | |
| 1271 | +class Base { | |
| 1272 | + Base(); | |
| 1273 | + | |
| 1274 | + factory Base.fromJson(Map<String, dynamic> json) => Base( | |
| 1275 | + ); | |
| 1276 | + | |
| 1277 | + Map<String, dynamic> toJson() => { | |
| 1278 | + }; | |
| 1279 | +} | |
| 1280 | + | |
| 1281 | +class Bitand { | |
| 1282 | + Bitand(); | |
| 1283 | + | |
| 1284 | + factory Bitand.fromJson(Map<String, dynamic> json) => Bitand( | |
| 1285 | + ); | |
| 1286 | + | |
| 1287 | + Map<String, dynamic> toJson() => { | |
| 1288 | + }; | |
| 1289 | +} | |
| 1290 | + | |
| 1291 | +class Bitor { | |
| 1292 | + Bitor(); | |
| 1293 | + | |
| 1294 | + factory Bitor.fromJson(Map<String, dynamic> json) => Bitor( | |
| 1295 | + ); | |
| 1296 | + | |
| 1297 | + Map<String, dynamic> toJson() => { | |
| 1298 | + }; | |
| 1299 | +} | |
| 1300 | + | |
| 1301 | +class Boolean { | |
| 1302 | + Boolean(); | |
| 1303 | + | |
| 1304 | + factory Boolean.fromJson(Map<String, dynamic> json) => Boolean( | |
| 1305 | + ); | |
| 1306 | + | |
| 1307 | + Map<String, dynamic> toJson() => { | |
| 1308 | + }; | |
| 1309 | +} | |
| 1310 | + | |
| 1311 | +class Bycopy { | |
| 1312 | + Bycopy(); | |
| 1313 | + | |
| 1314 | + factory Bycopy.fromJson(Map<String, dynamic> json) => Bycopy( | |
| 1315 | + ); | |
| 1316 | + | |
| 1317 | + Map<String, dynamic> toJson() => { | |
| 1318 | + }; | |
| 1319 | +} | |
| 1320 | + | |
| 1321 | +class Byref { | |
| 1322 | + Byref(); | |
| 1323 | + | |
| 1324 | + factory Byref.fromJson(Map<String, dynamic> json) => Byref( | |
| 1325 | + ); | |
| 1326 | + | |
| 1327 | + Map<String, dynamic> toJson() => { | |
| 1328 | + }; | |
| 1329 | +} | |
| 1330 | + | |
| 1331 | +class Byte { | |
| 1332 | + Byte(); | |
| 1333 | + | |
| 1334 | + factory Byte.fromJson(Map<String, dynamic> json) => Byte( | |
| 1335 | + ); | |
| 1336 | + | |
| 1337 | + Map<String, dynamic> toJson() => { | |
| 1338 | + }; | |
| 1339 | +} | |
| 1340 | + | |
| 1341 | +class Chan { | |
| 1342 | + Chan(); | |
| 1343 | + | |
| 1344 | + factory Chan.fromJson(Map<String, dynamic> json) => Chan( | |
| 1345 | + ); | |
| 1346 | + | |
| 1347 | + Map<String, dynamic> toJson() => { | |
| 1348 | + }; | |
| 1349 | +} | |
| 1350 | + | |
| 1351 | +class Char { | |
| 1352 | + Char(); | |
| 1353 | + | |
| 1354 | + factory Char.fromJson(Map<String, dynamic> json) => Char( | |
| 1355 | + ); | |
| 1356 | + | |
| 1357 | + Map<String, dynamic> toJson() => { | |
| 1358 | + }; | |
| 1359 | +} | |
| 1360 | + | |
| 1361 | +class Char16T { | |
| 1362 | + Char16T(); | |
| 1363 | + | |
| 1364 | + factory Char16T.fromJson(Map<String, dynamic> json) => Char16T( | |
| 1365 | + ); | |
| 1366 | + | |
| 1367 | + Map<String, dynamic> toJson() => { | |
| 1368 | + }; | |
| 1369 | +} | |
| 1370 | + | |
| 1371 | +class Char32T { | |
| 1372 | + Char32T(); | |
| 1373 | + | |
| 1374 | + factory Char32T.fromJson(Map<String, dynamic> json) => Char32T( | |
| 1375 | + ); | |
| 1376 | + | |
| 1377 | + Map<String, dynamic> toJson() => { | |
| 1378 | + }; | |
| 1379 | +} | |
| 1380 | + | |
| 1381 | +class Checked { | |
| 1382 | + Checked(); | |
| 1383 | + | |
| 1384 | + factory Checked.fromJson(Map<String, dynamic> json) => Checked( | |
| 1385 | + ); | |
| 1386 | + | |
| 1387 | + Map<String, dynamic> toJson() => { | |
| 1388 | + }; | |
| 1389 | +} | |
| 1390 | + | |
| 1391 | +class CoAwait { | |
| 1392 | + CoAwait(); | |
| 1393 | + | |
| 1394 | + factory CoAwait.fromJson(Map<String, dynamic> json) => CoAwait( | |
| 1395 | + ); | |
| 1396 | + | |
| 1397 | + Map<String, dynamic> toJson() => { | |
| 1398 | + }; | |
| 1399 | +} | |
| 1400 | + | |
| 1401 | +class CoReturn { | |
| 1402 | + CoReturn(); | |
| 1403 | + | |
| 1404 | + factory CoReturn.fromJson(Map<String, dynamic> json) => CoReturn( | |
| 1405 | + ); | |
| 1406 | + | |
| 1407 | + Map<String, dynamic> toJson() => { | |
| 1408 | + }; | |
| 1409 | +} | |
| 1410 | + | |
| 1411 | +class CoYield { | |
| 1412 | + CoYield(); | |
| 1413 | + | |
| 1414 | + factory CoYield.fromJson(Map<String, dynamic> json) => CoYield( | |
| 1415 | + ); | |
| 1416 | + | |
| 1417 | + Map<String, dynamic> toJson() => { | |
| 1418 | + }; | |
| 1419 | +} | |
| 1420 | + | |
| 1421 | +class Compl { | |
| 1422 | + Compl(); | |
| 1423 | + | |
| 1424 | + factory Compl.fromJson(Map<String, dynamic> json) => Compl( | |
| 1425 | + ); | |
| 1426 | + | |
| 1427 | + Map<String, dynamic> toJson() => { | |
| 1428 | + }; | |
| 1429 | +} | |
| 1430 | + | |
| 1431 | +class Complex { | |
| 1432 | + Complex(); | |
| 1433 | + | |
| 1434 | + factory Complex.fromJson(Map<String, dynamic> json) => Complex( | |
| 1435 | + ); | |
| 1436 | + | |
| 1437 | + Map<String, dynamic> toJson() => { | |
| 1438 | + }; | |
| 1439 | +} | |
| 1440 | + | |
| 1441 | +class Concept { | |
| 1442 | + Concept(); | |
| 1443 | + | |
| 1444 | + factory Concept.fromJson(Map<String, dynamic> json) => Concept( | |
| 1445 | + ); | |
| 1446 | + | |
| 1447 | + Map<String, dynamic> toJson() => { | |
| 1448 | + }; | |
| 1449 | +} | |
| 1450 | + | |
| 1451 | +class Console { | |
| 1452 | + Console(); | |
| 1453 | + | |
| 1454 | + factory Console.fromJson(Map<String, dynamic> json) => Console( | |
| 1455 | + ); | |
| 1456 | + | |
| 1457 | + Map<String, dynamic> toJson() => { | |
| 1458 | + }; | |
| 1459 | +} | |
| 1460 | + | |
| 1461 | +class ConstCast { | |
| 1462 | + ConstCast(); | |
| 1463 | + | |
| 1464 | + factory ConstCast.fromJson(Map<String, dynamic> json) => ConstCast( | |
| 1465 | + ); | |
| 1466 | + | |
| 1467 | + Map<String, dynamic> toJson() => { | |
| 1468 | + }; | |
| 1469 | +} | |
| 1470 | + | |
| 1471 | +class Constexpr { | |
| 1472 | + Constexpr(); | |
| 1473 | + | |
| 1474 | + factory Constexpr.fromJson(Map<String, dynamic> json) => Constexpr( | |
| 1475 | + ); | |
| 1476 | + | |
| 1477 | + Map<String, dynamic> toJson() => { | |
| 1478 | + }; | |
| 1479 | +} | |
| 1480 | + | |
| 1481 | +class Constructor { | |
| 1482 | + Constructor(); | |
| 1483 | + | |
| 1484 | + factory Constructor.fromJson(Map<String, dynamic> json) => Constructor( | |
| 1485 | + ); | |
| 1486 | + | |
| 1487 | + Map<String, dynamic> toJson() => { | |
| 1488 | + }; | |
| 1489 | +} | |
| 1490 | + | |
| 1491 | +class Convenience { | |
| 1492 | + Convenience(); | |
| 1493 | + | |
| 1494 | + factory Convenience.fromJson(Map<String, dynamic> json) => Convenience( | |
| 1495 | + ); | |
| 1496 | + | |
| 1497 | + Map<String, dynamic> toJson() => { | |
| 1498 | + }; | |
| 1499 | +} | |
| 1500 | + | |
| 1501 | +class Convert { | |
| 1502 | + Convert(); | |
| 1503 | + | |
| 1504 | + factory Convert.fromJson(Map<String, dynamic> json) => Convert( | |
| 1505 | + ); | |
| 1506 | + | |
| 1507 | + Map<String, dynamic> toJson() => { | |
| 1508 | + }; | |
| 1509 | +} | |
| 1510 | + | |
| 1511 | +class Converter { | |
| 1512 | + Converter(); | |
| 1513 | + | |
| 1514 | + factory Converter.fromJson(Map<String, dynamic> json) => Converter( | |
| 1515 | + ); | |
| 1516 | + | |
| 1517 | + Map<String, dynamic> toJson() => { | |
| 1518 | + }; | |
| 1519 | +} | |
| 1520 | + | |
| 1521 | +class Date { | |
| 1522 | + Date(); | |
| 1523 | + | |
| 1524 | + factory Date.fromJson(Map<String, dynamic> json) => Date( | |
| 1525 | + ); | |
| 1526 | + | |
| 1527 | + Map<String, dynamic> toJson() => { | |
| 1528 | + }; | |
| 1529 | +} | |
| 1530 | + | |
| 1531 | +class DateParseHandling { | |
| 1532 | + DateParseHandling(); | |
| 1533 | + | |
| 1534 | + factory DateParseHandling.fromJson(Map<String, dynamic> json) => DateParseHandling( | |
| 1535 | + ); | |
| 1536 | + | |
| 1537 | + Map<String, dynamic> toJson() => { | |
| 1538 | + }; | |
| 1539 | +} | |
| 1540 | + | |
| 1541 | +class Debugger { | |
| 1542 | + Debugger(); | |
| 1543 | + | |
| 1544 | + factory Debugger.fromJson(Map<String, dynamic> json) => Debugger( | |
| 1545 | + ); | |
| 1546 | + | |
| 1547 | + Map<String, dynamic> toJson() => { | |
| 1548 | + }; | |
| 1549 | +} | |
| 1550 | + | |
| 1551 | +class Decimal { | |
| 1552 | + Decimal(); | |
| 1553 | + | |
| 1554 | + factory Decimal.fromJson(Map<String, dynamic> json) => Decimal( | |
| 1555 | + ); | |
| 1556 | + | |
| 1557 | + Map<String, dynamic> toJson() => { | |
| 1558 | + }; | |
| 1559 | +} | |
| 1560 | + | |
| 1561 | +class Declare { | |
| 1562 | + Declare(); | |
| 1563 | + | |
| 1564 | + factory Declare.fromJson(Map<String, dynamic> json) => Declare( | |
| 1565 | + ); | |
| 1566 | + | |
| 1567 | + Map<String, dynamic> toJson() => { | |
| 1568 | + }; | |
| 1569 | +} | |
| 1570 | + | |
| 1571 | +class Decltype { | |
| 1572 | + Decltype(); | |
| 1573 | + | |
| 1574 | + factory Decltype.fromJson(Map<String, dynamic> json) => Decltype( | |
| 1575 | + ); | |
| 1576 | + | |
| 1577 | + Map<String, dynamic> toJson() => { | |
| 1578 | + }; | |
| 1579 | +} | |
| 1580 | + | |
| 1581 | +class DecodeString { | |
| 1582 | + DecodeString(); | |
| 1583 | + | |
| 1584 | + factory DecodeString.fromJson(Map<String, dynamic> json) => DecodeString( | |
| 1585 | + ); | |
| 1586 | + | |
| 1587 | + Map<String, dynamic> toJson() => { | |
| 1588 | + }; | |
| 1589 | +} | |
| 1590 | + | |
| 1591 | +class Def { | |
| 1592 | + Def(); | |
| 1593 | + | |
| 1594 | + factory Def.fromJson(Map<String, dynamic> json) => Def( | |
| 1595 | + ); | |
| 1596 | + | |
| 1597 | + Map<String, dynamic> toJson() => { | |
| 1598 | + }; | |
| 1599 | +} | |
| 1600 | + | |
| 1601 | +class Defer { | |
| 1602 | + Defer(); | |
| 1603 | + | |
| 1604 | + factory Defer.fromJson(Map<String, dynamic> json) => Defer( | |
| 1605 | + ); | |
| 1606 | + | |
| 1607 | + Map<String, dynamic> toJson() => { | |
| 1608 | + }; | |
| 1609 | +} | |
| 1610 | + | |
| 1611 | +class Deinit { | |
| 1612 | + Deinit(); | |
| 1613 | + | |
| 1614 | + factory Deinit.fromJson(Map<String, dynamic> json) => Deinit( | |
| 1615 | + ); | |
| 1616 | + | |
| 1617 | + Map<String, dynamic> toJson() => { | |
| 1618 | + }; | |
| 1619 | +} | |
| 1620 | + | |
| 1621 | +class Del { | |
| 1622 | + Del(); | |
| 1623 | + | |
| 1624 | + factory Del.fromJson(Map<String, dynamic> json) => Del( | |
| 1625 | + ); | |
| 1626 | + | |
| 1627 | + Map<String, dynamic> toJson() => { | |
| 1628 | + }; | |
| 1629 | +} | |
| 1630 | + | |
| 1631 | +class Delegate { | |
| 1632 | + Delegate(); | |
| 1633 | + | |
| 1634 | + factory Delegate.fromJson(Map<String, dynamic> json) => Delegate( | |
| 1635 | + ); | |
| 1636 | + | |
| 1637 | + Map<String, dynamic> toJson() => { | |
| 1638 | + }; | |
| 1639 | +} | |
| 1640 | + | |
| 1641 | +class Delete { | |
| 1642 | + Delete(); | |
| 1643 | + | |
| 1644 | + factory Delete.fromJson(Map<String, dynamic> json) => Delete( | |
| 1645 | + ); | |
| 1646 | + | |
| 1647 | + Map<String, dynamic> toJson() => { | |
| 1648 | + }; | |
| 1649 | +} | |
| 1650 | + | |
| 1651 | +class Dict { | |
| 1652 | + Dict(); | |
| 1653 | + | |
| 1654 | + factory Dict.fromJson(Map<String, dynamic> json) => Dict( | |
| 1655 | + ); | |
| 1656 | + | |
| 1657 | + Map<String, dynamic> toJson() => { | |
| 1658 | + }; | |
| 1659 | +} | |
| 1660 | + | |
| 1661 | +class Dictionary { | |
| 1662 | + Dictionary(); | |
| 1663 | + | |
| 1664 | + factory Dictionary.fromJson(Map<String, dynamic> json) => Dictionary( | |
| 1665 | + ); | |
| 1666 | + | |
| 1667 | + Map<String, dynamic> toJson() => { | |
| 1668 | + }; | |
| 1669 | +} | |
| 1670 | + | |
| 1671 | +class DidSet { | |
| 1672 | + DidSet(); | |
| 1673 | + | |
| 1674 | + factory DidSet.fromJson(Map<String, dynamic> json) => DidSet( | |
| 1675 | + ); | |
| 1676 | + | |
| 1677 | + Map<String, dynamic> toJson() => { | |
| 1678 | + }; | |
| 1679 | +} | |
| 1680 | + | |
| 1681 | +class DynamicCast { | |
| 1682 | + DynamicCast(); | |
| 1683 | + | |
| 1684 | + factory DynamicCast.fromJson(Map<String, dynamic> json) => DynamicCast( | |
| 1685 | + ); | |
| 1686 | + | |
| 1687 | + Map<String, dynamic> toJson() => { | |
| 1688 | + }; | |
| 1689 | +} | |
| 1690 | + | |
| 1691 | +class Elif { | |
| 1692 | + Elif(); | |
| 1693 | + | |
| 1694 | + factory Elif.fromJson(Map<String, dynamic> json) => Elif( | |
| 1695 | + ); | |
| 1696 | + | |
| 1697 | + Map<String, dynamic> toJson() => { | |
| 1698 | + }; | |
| 1699 | +} | |
| 1700 | + | |
| 1701 | +class Empty { | |
| 1702 | + Empty(); | |
| 1703 | + | |
| 1704 | + factory Empty.fromJson(Map<String, dynamic> json) => Empty( | |
| 1705 | + ); | |
| 1706 | + | |
| 1707 | + Map<String, dynamic> toJson() => { | |
| 1708 | + }; | |
| 1709 | +} | |
| 1710 | + | |
| 1711 | +class EncodeQuickType { | |
| 1712 | + EncodeQuickType(); | |
| 1713 | + | |
| 1714 | + factory EncodeQuickType.fromJson(Map<String, dynamic> json) => EncodeQuickType( | |
| 1715 | + ); | |
| 1716 | + | |
| 1717 | + Map<String, dynamic> toJson() => { | |
| 1718 | + }; | |
| 1719 | +} | |
| 1720 | + | |
| 1721 | +class Event { | |
| 1722 | + Event(); | |
| 1723 | + | |
| 1724 | + factory Event.fromJson(Map<String, dynamic> json) => Event( | |
| 1725 | + ); | |
| 1726 | + | |
| 1727 | + Map<String, dynamic> toJson() => { | |
| 1728 | + }; | |
| 1729 | +} | |
| 1730 | + | |
| 1731 | +class Except { | |
| 1732 | + Except(); | |
| 1733 | + | |
| 1734 | + factory Except.fromJson(Map<String, dynamic> json) => Except( | |
| 1735 | + ); | |
| 1736 | + | |
| 1737 | + Map<String, dynamic> toJson() => { | |
| 1738 | + }; | |
| 1739 | +} | |
| 1740 | + | |
| 1741 | +class Exception { | |
| 1742 | + Exception(); | |
| 1743 | + | |
| 1744 | + factory Exception.fromJson(Map<String, dynamic> json) => Exception( | |
| 1745 | + ); | |
| 1746 | + | |
| 1747 | + Map<String, dynamic> toJson() => { | |
| 1748 | + }; | |
| 1749 | +} | |
| 1750 | + | |
| 1751 | +class Explicit { | |
| 1752 | + Explicit(); | |
| 1753 | + | |
| 1754 | + factory Explicit.fromJson(Map<String, dynamic> json) => Explicit( | |
| 1755 | + ); | |
| 1756 | + | |
| 1757 | + Map<String, dynamic> toJson() => { | |
| 1758 | + }; | |
| 1759 | +} | |
| 1760 | + | |
| 1761 | +class Exposing { | |
| 1762 | + Exposing(); | |
| 1763 | + | |
| 1764 | + factory Exposing.fromJson(Map<String, dynamic> json) => Exposing( | |
| 1765 | + ); | |
| 1766 | + | |
| 1767 | + Map<String, dynamic> toJson() => { | |
| 1768 | + }; | |
| 1769 | +} | |
| 1770 | + | |
| 1771 | +class Extension { | |
| 1772 | + Extension(); | |
| 1773 | + | |
| 1774 | + factory Extension.fromJson(Map<String, dynamic> json) => Extension( | |
| 1775 | + ); | |
| 1776 | + | |
| 1777 | + Map<String, dynamic> toJson() => { | |
| 1778 | + }; | |
| 1779 | +} | |
| 1780 | + | |
| 1781 | +class Extern { | |
| 1782 | + Extern(); | |
| 1783 | + | |
| 1784 | + factory Extern.fromJson(Map<String, dynamic> json) => Extern( | |
| 1785 | + ); | |
| 1786 | + | |
| 1787 | + Map<String, dynamic> toJson() => { | |
| 1788 | + }; | |
| 1789 | +} | |
| 1790 | + | |
| 1791 | +class Fallthrough { | |
| 1792 | + Fallthrough(); | |
| 1793 | + | |
| 1794 | + factory Fallthrough.fromJson(Map<String, dynamic> json) => Fallthrough( | |
| 1795 | + ); | |
| 1796 | + | |
| 1797 | + Map<String, dynamic> toJson() => { | |
| 1798 | + }; | |
| 1799 | +} | |
| 1800 | + | |
| 1801 | +class Fileprivate { | |
| 1802 | + Fileprivate(); | |
| 1803 | + | |
| 1804 | + factory Fileprivate.fromJson(Map<String, dynamic> json) => Fileprivate( | |
| 1805 | + ); | |
| 1806 | + | |
| 1807 | + Map<String, dynamic> toJson() => { | |
| 1808 | + }; | |
| 1809 | +} | |
| 1810 | + | |
| 1811 | +class Fixed { | |
| 1812 | + Fixed(); | |
| 1813 | + | |
| 1814 | + factory Fixed.fromJson(Map<String, dynamic> json) => Fixed( | |
| 1815 | + ); | |
| 1816 | + | |
| 1817 | + Map<String, dynamic> toJson() => { | |
| 1818 | + }; | |
| 1819 | +} | |
| 1820 | + | |
| 1821 | +class Float { | |
| 1822 | + Float(); | |
| 1823 | + | |
| 1824 | + factory Float.fromJson(Map<String, dynamic> json) => Float( | |
| 1825 | + ); | |
| 1826 | + | |
| 1827 | + Map<String, dynamic> toJson() => { | |
| 1828 | + }; | |
| 1829 | +} | |
| 1830 | + | |
| 1831 | +class UnionBoolBool { | |
| 1832 | + UnionBoolBool(); | |
| 1833 | + | |
| 1834 | + factory UnionBoolBool.fromJson(Map<String, dynamic> json) => UnionBoolBool( | |
| 1835 | + ); | |
| 1836 | + | |
| 1837 | + Map<String, dynamic> toJson() => { | |
| 1838 | + }; | |
| 1839 | +} | |
| 1840 | + | |
| 1841 | +class Foreach { | |
| 1842 | + Foreach(); | |
| 1843 | + | |
| 1844 | + factory Foreach.fromJson(Map<String, dynamic> json) => Foreach( | |
| 1845 | + ); | |
| 1846 | + | |
| 1847 | + Map<String, dynamic> toJson() => { | |
| 1848 | + }; | |
| 1849 | +} | |
| 1850 | + | |
| 1851 | +class Friend { | |
| 1852 | + Friend(); | |
| 1853 | + | |
| 1854 | + factory Friend.fromJson(Map<String, dynamic> json) => Friend( | |
| 1855 | + ); | |
| 1856 | + | |
| 1857 | + Map<String, dynamic> toJson() => { | |
| 1858 | + }; | |
| 1859 | +} | |
| 1860 | + | |
| 1861 | +class From { | |
| 1862 | + From(); | |
| 1863 | + | |
| 1864 | + factory From.fromJson(Map<String, dynamic> json) => From( | |
| 1865 | + ); | |
| 1866 | + | |
| 1867 | + Map<String, dynamic> toJson() => { | |
| 1868 | + }; | |
| 1869 | +} | |
| 1870 | + | |
| 1871 | +class Func { | |
| 1872 | + Func(); | |
| 1873 | + | |
| 1874 | + factory Func.fromJson(Map<String, dynamic> json) => Func( | |
| 1875 | + ); | |
| 1876 | + | |
| 1877 | + Map<String, dynamic> toJson() => { | |
| 1878 | + }; | |
| 1879 | +} | |
| 1880 | + | |
| 1881 | +class FunctionClass { | |
| 1882 | + FunctionClass(); | |
| 1883 | + | |
| 1884 | + factory FunctionClass.fromJson(Map<String, dynamic> json) => FunctionClass( | |
| 1885 | + ); | |
| 1886 | + | |
| 1887 | + Map<String, dynamic> toJson() => { | |
| 1888 | + }; | |
| 1889 | +} | |
| 1890 | + | |
| 1891 | +class Global { | |
| 1892 | + Global(); | |
| 1893 | + | |
| 1894 | + factory Global.fromJson(Map<String, dynamic> json) => Global( | |
| 1895 | + ); | |
| 1896 | + | |
| 1897 | + Map<String, dynamic> toJson() => { | |
| 1898 | + }; | |
| 1899 | +} | |
| 1900 | + | |
| 1901 | +class Go { | |
| 1902 | + Go(); | |
| 1903 | + | |
| 1904 | + factory Go.fromJson(Map<String, dynamic> json) => Go( | |
| 1905 | + ); | |
| 1906 | + | |
| 1907 | + Map<String, dynamic> toJson() => { | |
| 1908 | + }; | |
| 1909 | +} | |
| 1910 | + | |
| 1911 | +class Goto { | |
| 1912 | + Goto(); | |
| 1913 | + | |
| 1914 | + factory Goto.fromJson(Map<String, dynamic> json) => Goto( | |
| 1915 | + ); | |
| 1916 | + | |
| 1917 | + Map<String, dynamic> toJson() => { | |
| 1918 | + }; | |
| 1919 | +} | |
| 1920 | + | |
| 1921 | +class Guard { | |
| 1922 | + Guard(); | |
| 1923 | + | |
| 1924 | + factory Guard.fromJson(Map<String, dynamic> json) => Guard( | |
| 1925 | + ); | |
| 1926 | + | |
| 1927 | + Map<String, dynamic> toJson() => { | |
| 1928 | + }; | |
| 1929 | +} | |
| 1930 | + | |
| 1931 | +class HasOwnProperty { | |
| 1932 | + HasOwnProperty(); | |
| 1933 | + | |
| 1934 | + factory HasOwnProperty.fromJson(Map<String, dynamic> json) => HasOwnProperty( | |
| 1935 | + ); | |
| 1936 | + | |
| 1937 | + Map<String, dynamic> toJson() => { | |
| 1938 | + }; | |
| 1939 | +} | |
| 1940 | + | |
| 1941 | +class Id { | |
| 1942 | + Id(); | |
| 1943 | + | |
| 1944 | + factory Id.fromJson(Map<String, dynamic> json) => Id( | |
| 1945 | + ); | |
| 1946 | + | |
| 1947 | + Map<String, dynamic> toJson() => { | |
| 1948 | + }; | |
| 1949 | +} | |
| 1950 | + | |
| 1951 | +class Imaginery { | |
| 1952 | + Imaginery(); | |
| 1953 | + | |
| 1954 | + factory Imaginery.fromJson(Map<String, dynamic> json) => Imaginery( | |
| 1955 | + ); | |
| 1956 | + | |
| 1957 | + Map<String, dynamic> toJson() => { | |
| 1958 | + }; | |
| 1959 | +} | |
| 1960 | + | |
| 1961 | +class Imp { | |
| 1962 | + Imp(); | |
| 1963 | + | |
| 1964 | + factory Imp.fromJson(Map<String, dynamic> json) => Imp( | |
| 1965 | + ); | |
| 1966 | + | |
| 1967 | + Map<String, dynamic> toJson() => { | |
| 1968 | + }; | |
| 1969 | +} | |
| 1970 | + | |
| 1971 | +class Implicit { | |
| 1972 | + Implicit(); | |
| 1973 | + | |
| 1974 | + factory Implicit.fromJson(Map<String, dynamic> json) => Implicit( | |
| 1975 | + ); | |
| 1976 | + | |
| 1977 | + Map<String, dynamic> toJson() => { | |
| 1978 | + }; | |
| 1979 | +} | |
| 1980 | + | |
| 1981 | +class Indirect { | |
| 1982 | + Indirect(); | |
| 1983 | + | |
| 1984 | + factory Indirect.fromJson(Map<String, dynamic> json) => Indirect( | |
| 1985 | + ); | |
| 1986 | + | |
| 1987 | + Map<String, dynamic> toJson() => { | |
| 1988 | + }; | |
| 1989 | +} | |
| 1990 | + | |
| 1991 | +class Infix { | |
| 1992 | + Infix(); | |
| 1993 | + | |
| 1994 | + factory Infix.fromJson(Map<String, dynamic> json) => Infix( | |
| 1995 | + ); | |
| 1996 | + | |
| 1997 | + Map<String, dynamic> toJson() => { | |
| 1998 | + }; | |
| 1999 | +} | |
| 2000 | + | |
| 2001 | +class Init { | |
| 2002 | + Init(); | |
| 2003 | + | |
| 2004 | + factory Init.fromJson(Map<String, dynamic> json) => Init( | |
| 2005 | + ); | |
| 2006 | + | |
| 2007 | + Map<String, dynamic> toJson() => { | |
| 2008 | + }; | |
| 2009 | +} | |
| 2010 | + | |
| 2011 | +class Inline { | |
| 2012 | + Inline(); | |
| 2013 | + | |
| 2014 | + factory Inline.fromJson(Map<String, dynamic> json) => Inline( | |
| 2015 | + ); | |
| 2016 | + | |
| 2017 | + Map<String, dynamic> toJson() => { | |
| 2018 | + }; | |
| 2019 | +} | |
| 2020 | + | |
| 2021 | +class Inout { | |
| 2022 | + Inout(); | |
| 2023 | + | |
| 2024 | + factory Inout.fromJson(Map<String, dynamic> json) => Inout( | |
| 2025 | + ); | |
| 2026 | + | |
| 2027 | + Map<String, dynamic> toJson() => { | |
| 2028 | + }; | |
| 2029 | +} | |
| 2030 | + | |
| 2031 | +class Instanceof { | |
| 2032 | + Instanceof(); | |
| 2033 | + | |
| 2034 | + factory Instanceof.fromJson(Map<String, dynamic> json) => Instanceof( | |
| 2035 | + ); | |
| 2036 | + | |
| 2037 | + Map<String, dynamic> toJson() => { | |
| 2038 | + }; | |
| 2039 | +} | |
| 2040 | + | |
| 2041 | +class Internal { | |
| 2042 | + Internal(); | |
| 2043 | + | |
| 2044 | + factory Internal.fromJson(Map<String, dynamic> json) => Internal( | |
| 2045 | + ); | |
| 2046 | + | |
| 2047 | + Map<String, dynamic> toJson() => { | |
| 2048 | + }; | |
| 2049 | +} | |
| 2050 | + | |
| 2051 | +class Iterable { | |
| 2052 | + Iterable(); | |
| 2053 | + | |
| 2054 | + factory Iterable.fromJson(Map<String, dynamic> json) => Iterable( | |
| 2055 | + ); | |
| 2056 | + | |
| 2057 | + Map<String, dynamic> toJson() => { | |
| 2058 | + }; | |
| 2059 | +} | |
| 2060 | + | |
| 2061 | +class Jdec { | |
| 2062 | + Jdec(); | |
| 2063 | + | |
| 2064 | + factory Jdec.fromJson(Map<String, dynamic> json) => Jdec( | |
| 2065 | + ); | |
| 2066 | + | |
| 2067 | + Map<String, dynamic> toJson() => { | |
| 2068 | + }; | |
| 2069 | +} | |
| 2070 | + | |
| 2071 | +class Jenc { | |
| 2072 | + Jenc(); | |
| 2073 | + | |
| 2074 | + factory Jenc.fromJson(Map<String, dynamic> json) => Jenc( | |
| 2075 | + ); | |
| 2076 | + | |
| 2077 | + Map<String, dynamic> toJson() => { | |
| 2078 | + }; | |
| 2079 | +} | |
| 2080 | + | |
| 2081 | +class Jpipe { | |
| 2082 | + Jpipe(); | |
| 2083 | + | |
| 2084 | + factory Jpipe.fromJson(Map<String, dynamic> json) => Jpipe( | |
| 2085 | + ); | |
| 2086 | + | |
| 2087 | + Map<String, dynamic> toJson() => { | |
| 2088 | + }; | |
| 2089 | +} | |
| 2090 | + | |
| 2091 | +class Json { | |
| 2092 | + Json(); | |
| 2093 | + | |
| 2094 | + factory Json.fromJson(Map<String, dynamic> json) => Json( | |
| 2095 | + ); | |
| 2096 | + | |
| 2097 | + Map<String, dynamic> toJson() => { | |
| 2098 | + }; | |
| 2099 | +} | |
| 2100 | + | |
| 2101 | +class JsonConverter { | |
| 2102 | + JsonConverter(); | |
| 2103 | + | |
| 2104 | + factory JsonConverter.fromJson(Map<String, dynamic> json) => JsonConverter( | |
| 2105 | + ); | |
| 2106 | + | |
| 2107 | + Map<String, dynamic> toJson() => { | |
| 2108 | + }; | |
| 2109 | +} | |
| 2110 | + | |
| 2111 | +class JsonSerializer { | |
| 2112 | + JsonSerializer(); | |
| 2113 | + | |
| 2114 | + factory JsonSerializer.fromJson(Map<String, dynamic> json) => JsonSerializer( | |
| 2115 | + ); | |
| 2116 | + | |
| 2117 | + Map<String, dynamic> toJson() => { | |
| 2118 | + }; | |
| 2119 | +} | |
| 2120 | + | |
| 2121 | +class JsonToken { | |
| 2122 | + JsonToken(); | |
| 2123 | + | |
| 2124 | + factory JsonToken.fromJson(Map<String, dynamic> json) => JsonToken( | |
| 2125 | + ); | |
| 2126 | + | |
| 2127 | + Map<String, dynamic> toJson() => { | |
| 2128 | + }; | |
| 2129 | +} | |
| 2130 | + | |
| 2131 | +class JsonWriter { | |
| 2132 | + JsonWriter(); | |
| 2133 | + | |
| 2134 | + factory JsonWriter.fromJson(Map<String, dynamic> json) => JsonWriter( | |
| 2135 | + ); | |
| 2136 | + | |
| 2137 | + Map<String, dynamic> toJson() => { | |
| 2138 | + }; | |
| 2139 | +} | |
| 2140 | + | |
| 2141 | +class Lambda { | |
| 2142 | + Lambda(); | |
| 2143 | + | |
| 2144 | + factory Lambda.fromJson(Map<String, dynamic> json) => Lambda( | |
| 2145 | + ); | |
| 2146 | + | |
| 2147 | + Map<String, dynamic> toJson() => { | |
| 2148 | + }; | |
| 2149 | +} | |
| 2150 | + | |
| 2151 | +class Lazy { | |
| 2152 | + Lazy(); | |
| 2153 | + | |
| 2154 | + factory Lazy.fromJson(Map<String, dynamic> json) => Lazy( | |
| 2155 | + ); | |
| 2156 | + | |
| 2157 | + Map<String, dynamic> toJson() => { | |
| 2158 | + }; | |
| 2159 | +} | |
| 2160 | + | |
| 2161 | +class Left { | |
| 2162 | + Left(); | |
| 2163 | + | |
| 2164 | + factory Left.fromJson(Map<String, dynamic> json) => Left( | |
| 2165 | + ); | |
| 2166 | + | |
| 2167 | + Map<String, dynamic> toJson() => { | |
| 2168 | + }; | |
| 2169 | +} | |
| 2170 | + | |
| 2171 | +class Let { | |
| 2172 | + Let(); | |
| 2173 | + | |
| 2174 | + factory Let.fromJson(Map<String, dynamic> json) => Let( | |
| 2175 | + ); | |
| 2176 | + | |
| 2177 | + Map<String, dynamic> toJson() => { | |
| 2178 | + }; | |
| 2179 | +} | |
| 2180 | + | |
| 2181 | +class ListClass { | |
| 2182 | + ListClass(); | |
| 2183 | + | |
| 2184 | + factory ListClass.fromJson(Map<String, dynamic> json) => ListClass( | |
| 2185 | + ); | |
| 2186 | + | |
| 2187 | + Map<String, dynamic> toJson() => { | |
| 2188 | + }; | |
| 2189 | +} | |
| 2190 | + | |
| 2191 | +class Lock { | |
| 2192 | + Lock(); | |
| 2193 | + | |
| 2194 | + factory Lock.fromJson(Map<String, dynamic> json) => Lock( | |
| 2195 | + ); | |
| 2196 | + | |
| 2197 | + Map<String, dynamic> toJson() => { | |
| 2198 | + }; | |
| 2199 | +} | |
| 2200 | + | |
| 2201 | +class Long { | |
| 2202 | + Long(); | |
| 2203 | + | |
| 2204 | + factory Long.fromJson(Map<String, dynamic> json) => Long( | |
| 2205 | + ); | |
| 2206 | + | |
| 2207 | + Map<String, dynamic> toJson() => { | |
| 2208 | + }; | |
| 2209 | +} | |
| 2210 | + | |
| 2211 | +class MapClass { | |
| 2212 | + MapClass(); | |
| 2213 | + | |
| 2214 | + factory MapClass.fromJson(Map<String, dynamic> json) => MapClass( | |
| 2215 | + ); | |
| 2216 | + | |
| 2217 | + Map<String, dynamic> toJson() => { | |
| 2218 | + }; | |
| 2219 | +} | |
| 2220 | + | |
| 2221 | +class MetadataPropertyHandling { | |
| 2222 | + MetadataPropertyHandling(); | |
| 2223 | + | |
| 2224 | + factory MetadataPropertyHandling.fromJson(Map<String, dynamic> json) => MetadataPropertyHandling( | |
| 2225 | + ); | |
| 2226 | + | |
| 2227 | + Map<String, dynamic> toJson() => { | |
| 2228 | + }; | |
| 2229 | +} | |
| 2230 | + | |
| 2231 | +class Module { | |
| 2232 | + Module(); | |
| 2233 | + | |
| 2234 | + factory Module.fromJson(Map<String, dynamic> json) => Module( | |
| 2235 | + ); | |
| 2236 | + | |
| 2237 | + Map<String, dynamic> toJson() => { | |
| 2238 | + }; | |
| 2239 | +} | |
| 2240 | + | |
| 2241 | +class Mutable { | |
| 2242 | + Mutable(); | |
| 2243 | + | |
| 2244 | + factory Mutable.fromJson(Map<String, dynamic> json) => Mutable( | |
| 2245 | + ); | |
| 2246 | + | |
| 2247 | + Map<String, dynamic> toJson() => { | |
| 2248 | + }; | |
| 2249 | +} | |
| 2250 | + | |
| 2251 | +class Mutating { | |
| 2252 | + Mutating(); | |
| 2253 | + | |
| 2254 | + factory Mutating.fromJson(Map<String, dynamic> json) => Mutating( | |
| 2255 | + ); | |
| 2256 | + | |
| 2257 | + Map<String, dynamic> toJson() => { | |
| 2258 | + }; | |
| 2259 | +} | |
| 2260 | + | |
| 2261 | +class Namespace { | |
| 2262 | + Namespace(); | |
| 2263 | + | |
| 2264 | + factory Namespace.fromJson(Map<String, dynamic> json) => Namespace( | |
| 2265 | + ); | |
| 2266 | + | |
| 2267 | + Map<String, dynamic> toJson() => { | |
| 2268 | + }; | |
| 2269 | +} | |
| 2270 | + | |
| 2271 | +class Native { | |
| 2272 | + Native(); | |
| 2273 | + | |
| 2274 | + factory Native.fromJson(Map<String, dynamic> json) => Native( | |
| 2275 | + ); | |
| 2276 | + | |
| 2277 | + Map<String, dynamic> toJson() => { | |
| 2278 | + }; | |
| 2279 | +} | |
| 2280 | + | |
| 2281 | +class Newtonsoft { | |
| 2282 | + Newtonsoft(); | |
| 2283 | + | |
| 2284 | + factory Newtonsoft.fromJson(Map<String, dynamic> json) => Newtonsoft( | |
| 2285 | + ); | |
| 2286 | + | |
| 2287 | + Map<String, dynamic> toJson() => { | |
| 2288 | + }; | |
| 2289 | +} | |
| 2290 | + | |
| 2291 | +class Nil { | |
| 2292 | + Nil(); | |
| 2293 | + | |
| 2294 | + factory Nil.fromJson(Map<String, dynamic> json) => Nil( | |
| 2295 | + ); | |
| 2296 | + | |
| 2297 | + Map<String, dynamic> toJson() => { | |
| 2298 | + }; | |
| 2299 | +} | |
| 2300 | + | |
| 2301 | +class No { | |
| 2302 | + No(); | |
| 2303 | + | |
| 2304 | + factory No.fromJson(Map<String, dynamic> json) => No( | |
| 2305 | + ); | |
| 2306 | + | |
| 2307 | + Map<String, dynamic> toJson() => { | |
| 2308 | + }; | |
| 2309 | +} | |
| 2310 | + | |
| 2311 | +class Noexcept { | |
| 2312 | + Noexcept(); | |
| 2313 | + | |
| 2314 | + factory Noexcept.fromJson(Map<String, dynamic> json) => Noexcept( | |
| 2315 | + ); | |
| 2316 | + | |
| 2317 | + Map<String, dynamic> toJson() => { | |
| 2318 | + }; | |
| 2319 | +} | |
| 2320 | + | |
| 2321 | +class Nonatomic { | |
| 2322 | + Nonatomic(); | |
| 2323 | + | |
| 2324 | + factory Nonatomic.fromJson(Map<String, dynamic> json) => Nonatomic( | |
| 2325 | + ); | |
| 2326 | + | |
| 2327 | + Map<String, dynamic> toJson() => { | |
| 2328 | + }; | |
| 2329 | +} | |
| 2330 | + | |
| 2331 | +class None { | |
| 2332 | + None(); | |
| 2333 | + | |
| 2334 | + factory None.fromJson(Map<String, dynamic> json) => None( | |
| 2335 | + ); | |
| 2336 | + | |
| 2337 | + Map<String, dynamic> toJson() => { | |
| 2338 | + }; | |
| 2339 | +} | |
| 2340 | + | |
| 2341 | +class Nonlocal { | |
| 2342 | + Nonlocal(); | |
| 2343 | + | |
| 2344 | + factory Nonlocal.fromJson(Map<String, dynamic> json) => Nonlocal( | |
| 2345 | + ); | |
| 2346 | + | |
| 2347 | + Map<String, dynamic> toJson() => { | |
| 2348 | + }; | |
| 2349 | +} | |
| 2350 | + | |
| 2351 | +class Nonmutating { | |
| 2352 | + Nonmutating(); | |
| 2353 | + | |
| 2354 | + factory Nonmutating.fromJson(Map<String, dynamic> json) => Nonmutating( | |
| 2355 | + ); | |
| 2356 | + | |
| 2357 | + Map<String, dynamic> toJson() => { | |
| 2358 | + }; | |
| 2359 | +} | |
| 2360 | + | |
| 2361 | +class Not { | |
| 2362 | + Not(); | |
| 2363 | + | |
| 2364 | + factory Not.fromJson(Map<String, dynamic> json) => Not( | |
| 2365 | + ); | |
| 2366 | + | |
| 2367 | + Map<String, dynamic> toJson() => { | |
| 2368 | + }; | |
| 2369 | +} | |
| 2370 | + | |
| 2371 | +class NotEq { | |
| 2372 | + NotEq(); | |
| 2373 | + | |
| 2374 | + factory NotEq.fromJson(Map<String, dynamic> json) => NotEq( | |
| 2375 | + ); | |
| 2376 | + | |
| 2377 | + Map<String, dynamic> toJson() => { | |
| 2378 | + }; | |
| 2379 | +} | |
| 2380 | + | |
| 2381 | +class NsString { | |
| 2382 | + NsString(); | |
| 2383 | + | |
| 2384 | + factory NsString.fromJson(Map<String, dynamic> json) => NsString( | |
| 2385 | + ); | |
| 2386 | + | |
| 2387 | + Map<String, dynamic> toJson() => { | |
| 2388 | + }; | |
| 2389 | +} | |
| 2390 | + | |
| 2391 | +class Nullptr { | |
| 2392 | + Nullptr(); | |
| 2393 | + | |
| 2394 | + factory Nullptr.fromJson(Map<String, dynamic> json) => Nullptr( | |
| 2395 | + ); | |
| 2396 | + | |
| 2397 | + Map<String, dynamic> toJson() => { | |
| 2398 | + }; | |
| 2399 | +} | |
| 2400 | + | |
| 2401 | +class Number { | |
| 2402 | + Number(); | |
| 2403 | + | |
| 2404 | + factory Number.fromJson(Map<String, dynamic> json) => Number( | |
| 2405 | + ); | |
| 2406 | + | |
| 2407 | + Map<String, dynamic> toJson() => { | |
| 2408 | + }; | |
| 2409 | +} | |
| 2410 | + | |
| 2411 | +class Object { | |
| 2412 | + Object(); | |
| 2413 | + | |
| 2414 | + factory Object.fromJson(Map<String, dynamic> json) => Object( | |
| 2415 | + ); | |
| 2416 | + | |
| 2417 | + Map<String, dynamic> toJson() => { | |
| 2418 | + }; | |
| 2419 | +} | |
| 2420 | + | |
| 2421 | +class Of { | |
| 2422 | + Of(); | |
| 2423 | + | |
| 2424 | + factory Of.fromJson(Map<String, dynamic> json) => Of( | |
| 2425 | + ); | |
| 2426 | + | |
| 2427 | + Map<String, dynamic> toJson() => { | |
| 2428 | + }; | |
| 2429 | +} | |
| 2430 | + | |
| 2431 | +class Oneway { | |
| 2432 | + Oneway(); | |
| 2433 | + | |
| 2434 | + factory Oneway.fromJson(Map<String, dynamic> json) => Oneway( | |
| 2435 | + ); | |
| 2436 | + | |
| 2437 | + Map<String, dynamic> toJson() => { | |
| 2438 | + }; | |
| 2439 | +} | |
| 2440 | + | |
| 2441 | +class Open { | |
| 2442 | + Open(); | |
| 2443 | + | |
| 2444 | + factory Open.fromJson(Map<String, dynamic> json) => Open( | |
| 2445 | + ); | |
| 2446 | + | |
| 2447 | + Map<String, dynamic> toJson() => { | |
| 2448 | + }; | |
| 2449 | +} | |
| 2450 | + | |
| 2451 | +class Optional { | |
| 2452 | + Optional(); | |
| 2453 | + | |
| 2454 | + factory Optional.fromJson(Map<String, dynamic> json) => Optional( | |
| 2455 | + ); | |
| 2456 | + | |
| 2457 | + Map<String, dynamic> toJson() => { | |
| 2458 | + }; | |
| 2459 | +} | |
| 2460 | + | |
| 2461 | +class Or { | |
| 2462 | + Or(); | |
| 2463 | + | |
| 2464 | + factory Or.fromJson(Map<String, dynamic> json) => Or( | |
| 2465 | + ); | |
| 2466 | + | |
| 2467 | + Map<String, dynamic> toJson() => { | |
| 2468 | + }; | |
| 2469 | +} | |
| 2470 | + | |
| 2471 | +class OrEq { | |
| 2472 | + OrEq(); | |
| 2473 | + | |
| 2474 | + factory OrEq.fromJson(Map<String, dynamic> json) => OrEq( | |
| 2475 | + ); | |
| 2476 | + | |
| 2477 | + Map<String, dynamic> toJson() => { | |
| 2478 | + }; | |
| 2479 | +} | |
| 2480 | + | |
| 2481 | +class Out { | |
| 2482 | + Out(); | |
| 2483 | + | |
| 2484 | + factory Out.fromJson(Map<String, dynamic> json) => Out( | |
| 2485 | + ); | |
| 2486 | + | |
| 2487 | + Map<String, dynamic> toJson() => { | |
| 2488 | + }; | |
| 2489 | +} | |
| 2490 | + | |
| 2491 | +class Override { | |
| 2492 | + Override(); | |
| 2493 | + | |
| 2494 | + factory Override.fromJson(Map<String, dynamic> json) => Override( | |
| 2495 | + ); | |
| 2496 | + | |
| 2497 | + Map<String, dynamic> toJson() => { | |
| 2498 | + }; | |
| 2499 | +} | |
| 2500 | + | |
| 2501 | +class Package { | |
| 2502 | + Package(); | |
| 2503 | + | |
| 2504 | + factory Package.fromJson(Map<String, dynamic> json) => Package( | |
| 2505 | + ); | |
| 2506 | + | |
| 2507 | + Map<String, dynamic> toJson() => { | |
| 2508 | + }; | |
| 2509 | +} | |
| 2510 | + | |
| 2511 | +class Params { | |
| 2512 | + Params(); | |
| 2513 | + | |
| 2514 | + factory Params.fromJson(Map<String, dynamic> json) => Params( | |
| 2515 | + ); | |
| 2516 | + | |
| 2517 | + Map<String, dynamic> toJson() => { | |
| 2518 | + }; | |
| 2519 | +} | |
| 2520 | + | |
| 2521 | +class Pass { | |
| 2522 | + Pass(); | |
| 2523 | + | |
| 2524 | + factory Pass.fromJson(Map<String, dynamic> json) => Pass( | |
| 2525 | + ); | |
| 2526 | + | |
| 2527 | + Map<String, dynamic> toJson() => { | |
| 2528 | + }; | |
| 2529 | +} | |
| 2530 | + | |
| 2531 | +class Port { | |
| 2532 | + Port(); | |
| 2533 | + | |
| 2534 | + factory Port.fromJson(Map<String, dynamic> json) => Port( | |
| 2535 | + ); | |
| 2536 | + | |
| 2537 | + Map<String, dynamic> toJson() => { | |
| 2538 | + }; | |
| 2539 | +} | |
| 2540 | + | |
| 2541 | +class Postfix { | |
| 2542 | + Postfix(); | |
| 2543 | + | |
| 2544 | + factory Postfix.fromJson(Map<String, dynamic> json) => Postfix( | |
| 2545 | + ); | |
| 2546 | + | |
| 2547 | + Map<String, dynamic> toJson() => { | |
| 2548 | + }; | |
| 2549 | +} | |
| 2550 | + | |
| 2551 | +class Precedence { | |
| 2552 | + Precedence(); | |
| 2553 | + | |
| 2554 | + factory Precedence.fromJson(Map<String, dynamic> json) => Precedence( | |
| 2555 | + ); | |
| 2556 | + | |
| 2557 | + Map<String, dynamic> toJson() => { | |
| 2558 | + }; | |
| 2559 | +} | |
| 2560 | + | |
| 2561 | +class Prefix { | |
| 2562 | + Prefix(); | |
| 2563 | + | |
| 2564 | + factory Prefix.fromJson(Map<String, dynamic> json) => Prefix( | |
| 2565 | + ); | |
| 2566 | + | |
| 2567 | + Map<String, dynamic> toJson() => { | |
| 2568 | + }; | |
| 2569 | +} | |
| 2570 | + | |
| 2571 | +class Print { | |
| 2572 | + Print(); | |
| 2573 | + | |
| 2574 | + factory Print.fromJson(Map<String, dynamic> json) => Print( | |
| 2575 | + ); | |
| 2576 | + | |
| 2577 | + Map<String, dynamic> toJson() => { | |
| 2578 | + }; | |
| 2579 | +} | |
| 2580 | + | |
| 2581 | +class Printf { | |
| 2582 | + Printf(); | |
| 2583 | + | |
| 2584 | + factory Printf.fromJson(Map<String, dynamic> json) => Printf( | |
| 2585 | + ); | |
| 2586 | + | |
| 2587 | + Map<String, dynamic> toJson() => { | |
| 2588 | + }; | |
| 2589 | +} | |
| 2590 | + | |
| 2591 | +class Private { | |
| 2592 | + Private(); | |
| 2593 | + | |
| 2594 | + factory Private.fromJson(Map<String, dynamic> json) => Private( | |
| 2595 | + ); | |
| 2596 | + | |
| 2597 | + Map<String, dynamic> toJson() => { | |
| 2598 | + }; | |
| 2599 | +} | |
| 2600 | + | |
| 2601 | +class Protected { | |
| 2602 | + Protected(); | |
| 2603 | + | |
| 2604 | + factory Protected.fromJson(Map<String, dynamic> json) => Protected( | |
| 2605 | + ); | |
| 2606 | + | |
| 2607 | + Map<String, dynamic> toJson() => { | |
| 2608 | + }; | |
| 2609 | +} | |
| 2610 | + | |
| 2611 | +class Protocol { | |
| 2612 | + Protocol(); | |
| 2613 | + | |
| 2614 | + factory Protocol.fromJson(Map<String, dynamic> json) => Protocol( | |
| 2615 | + ); | |
| 2616 | + | |
| 2617 | + Map<String, dynamic> toJson() => { | |
| 2618 | + }; | |
| 2619 | +} | |
| 2620 | + | |
| 2621 | +class Public { | |
| 2622 | + Public(); | |
| 2623 | + | |
| 2624 | + factory Public.fromJson(Map<String, dynamic> json) => Public( | |
| 2625 | + ); | |
| 2626 | + | |
| 2627 | + Map<String, dynamic> toJson() => { | |
| 2628 | + }; | |
| 2629 | +} | |
| 2630 | + | |
| 2631 | +class BoolClass { | |
| 2632 | + BoolClass(); | |
| 2633 | + | |
| 2634 | + factory BoolClass.fromJson(Map<String, dynamic> json) => BoolClass( | |
| 2635 | + ); | |
| 2636 | + | |
| 2637 | + Map<String, dynamic> toJson() => { | |
| 2638 | + }; | |
| 2639 | +} | |
| 2640 | + | |
| 2641 | +class ClassClass { | |
| 2642 | + ClassClass(); | |
| 2643 | + | |
| 2644 | + factory ClassClass.fromJson(Map<String, dynamic> json) => ClassClass( | |
| 2645 | + ); | |
| 2646 | + | |
| 2647 | + Map<String, dynamic> toJson() => { | |
| 2648 | + }; | |
| 2649 | +} | |
| 2650 | + | |
| 2651 | +class FalseClass { | |
| 2652 | + FalseClass(); | |
| 2653 | + | |
| 2654 | + factory FalseClass.fromJson(Map<String, dynamic> json) => FalseClass( | |
| 2655 | + ); | |
| 2656 | + | |
| 2657 | + Map<String, dynamic> toJson() => { | |
| 2658 | + }; | |
| 2659 | +} | |
| 2660 | + | |
| 2661 | +class NullClass { | |
| 2662 | + NullClass(); | |
| 2663 | + | |
| 2664 | + factory NullClass.fromJson(Map<String, dynamic> json) => NullClass( | |
| 2665 | + ); | |
| 2666 | + | |
| 2667 | + Map<String, dynamic> toJson() => { | |
| 2668 | + }; | |
| 2669 | +} | |
| 2670 | + | |
| 2671 | +class TrueClass { | |
| 2672 | + TrueClass(); | |
| 2673 | + | |
| 2674 | + factory TrueClass.fromJson(Map<String, dynamic> json) => TrueClass( | |
| 2675 | + ); | |
| 2676 | + | |
| 2677 | + Map<String, dynamic> toJson() => { | |
| 2678 | + }; | |
| 2679 | +} | |
| 2680 | + | |
| 2681 | +class Quicktype { | |
| 2682 | + Quicktype(); | |
| 2683 | + | |
| 2684 | + factory Quicktype.fromJson(Map<String, dynamic> json) => Quicktype( | |
| 2685 | + ); | |
| 2686 | + | |
| 2687 | + Map<String, dynamic> toJson() => { | |
| 2688 | + }; | |
| 2689 | +} | |
| 2690 | + | |
| 2691 | +class Raise { | |
| 2692 | + Raise(); | |
| 2693 | + | |
| 2694 | + factory Raise.fromJson(Map<String, dynamic> json) => Raise( | |
| 2695 | + ); | |
| 2696 | + | |
| 2697 | + Map<String, dynamic> toJson() => { | |
| 2698 | + }; | |
| 2699 | +} | |
| 2700 | + | |
| 2701 | +class Range { | |
| 2702 | + Range(); | |
| 2703 | + | |
| 2704 | + factory Range.fromJson(Map<String, dynamic> json) => Range( | |
| 2705 | + ); | |
| 2706 | + | |
| 2707 | + Map<String, dynamic> toJson() => { | |
| 2708 | + }; | |
| 2709 | +} | |
| 2710 | + | |
| 2711 | +class Readonly { | |
| 2712 | + Readonly(); | |
| 2713 | + | |
| 2714 | + factory Readonly.fromJson(Map<String, dynamic> json) => Readonly( | |
| 2715 | + ); | |
| 2716 | + | |
| 2717 | + Map<String, dynamic> toJson() => { | |
| 2718 | + }; | |
| 2719 | +} | |
| 2720 | + | |
| 2721 | +class Ref { | |
| 2722 | + Ref(); | |
| 2723 | + | |
| 2724 | + factory Ref.fromJson(Map<String, dynamic> json) => Ref( | |
| 2725 | + ); | |
| 2726 | + | |
| 2727 | + Map<String, dynamic> toJson() => { | |
| 2728 | + }; | |
| 2729 | +} | |
| 2730 | + | |
| 2731 | +class Register { | |
| 2732 | + Register(); | |
| 2733 | + | |
| 2734 | + factory Register.fromJson(Map<String, dynamic> json) => Register( | |
| 2735 | + ); | |
| 2736 | + | |
| 2737 | + Map<String, dynamic> toJson() => { | |
| 2738 | + }; | |
| 2739 | +} | |
| 2740 | + | |
| 2741 | +class ReinterpretCast { | |
| 2742 | + ReinterpretCast(); | |
| 2743 | + | |
| 2744 | + factory ReinterpretCast.fromJson(Map<String, dynamic> json) => ReinterpretCast( | |
| 2745 | + ); | |
| 2746 | + | |
| 2747 | + Map<String, dynamic> toJson() => { | |
| 2748 | + }; | |
| 2749 | +} | |
| 2750 | + | |
| 2751 | +class Repeat { | |
| 2752 | + Repeat(); | |
| 2753 | + | |
| 2754 | + factory Repeat.fromJson(Map<String, dynamic> json) => Repeat( | |
| 2755 | + ); | |
| 2756 | + | |
| 2757 | + Map<String, dynamic> toJson() => { | |
| 2758 | + }; | |
| 2759 | +} | |
| 2760 | + | |
| 2761 | +class Require { | |
| 2762 | + Require(); | |
| 2763 | + | |
| 2764 | + factory Require.fromJson(Map<String, dynamic> json) => Require( | |
| 2765 | + ); | |
| 2766 | + | |
| 2767 | + Map<String, dynamic> toJson() => { | |
| 2768 | + }; | |
| 2769 | +} | |
| 2770 | + | |
| 2771 | +class Required { | |
| 2772 | + Required(); | |
| 2773 | + | |
| 2774 | + factory Required.fromJson(Map<String, dynamic> json) => Required( | |
| 2775 | + ); | |
| 2776 | + | |
| 2777 | + Map<String, dynamic> toJson() => { | |
| 2778 | + }; | |
| 2779 | +} | |
| 2780 | + | |
| 2781 | +class Requires { | |
| 2782 | + Requires(); | |
| 2783 | + | |
| 2784 | + factory Requires.fromJson(Map<String, dynamic> json) => Requires( | |
| 2785 | + ); | |
| 2786 | + | |
| 2787 | + Map<String, dynamic> toJson() => { | |
| 2788 | + }; | |
| 2789 | +} | |
| 2790 | + | |
| 2791 | +class Restrict { | |
| 2792 | + Restrict(); | |
| 2793 | + | |
| 2794 | + factory Restrict.fromJson(Map<String, dynamic> json) => Restrict( | |
| 2795 | + ); | |
| 2796 | + | |
| 2797 | + Map<String, dynamic> toJson() => { | |
| 2798 | + }; | |
| 2799 | +} | |
| 2800 | + | |
| 2801 | +class Retain { | |
| 2802 | + Retain(); | |
| 2803 | + | |
| 2804 | + factory Retain.fromJson(Map<String, dynamic> json) => Retain( | |
| 2805 | + ); | |
| 2806 | + | |
| 2807 | + Map<String, dynamic> toJson() => { | |
| 2808 | + }; | |
| 2809 | +} | |
| 2810 | + | |
| 2811 | +class Rethrows { | |
| 2812 | + Rethrows(); | |
| 2813 | + | |
| 2814 | + factory Rethrows.fromJson(Map<String, dynamic> json) => Rethrows( | |
| 2815 | + ); | |
| 2816 | + | |
| 2817 | + Map<String, dynamic> toJson() => { | |
| 2818 | + }; | |
| 2819 | +} | |
| 2820 | + | |
| 2821 | +class Right { | |
| 2822 | + Right(); | |
| 2823 | + | |
| 2824 | + factory Right.fromJson(Map<String, dynamic> json) => Right( | |
| 2825 | + ); | |
| 2826 | + | |
| 2827 | + Map<String, dynamic> toJson() => { | |
| 2828 | + }; | |
| 2829 | +} | |
| 2830 | + | |
| 2831 | +class Sbyte { | |
| 2832 | + Sbyte(); | |
| 2833 | + | |
| 2834 | + factory Sbyte.fromJson(Map<String, dynamic> json) => Sbyte( | |
| 2835 | + ); | |
| 2836 | + | |
| 2837 | + Map<String, dynamic> toJson() => { | |
| 2838 | + }; | |
| 2839 | +} | |
| 2840 | + | |
| 2841 | +class Sealed { | |
| 2842 | + Sealed(); | |
| 2843 | + | |
| 2844 | + factory Sealed.fromJson(Map<String, dynamic> json) => Sealed( | |
| 2845 | + ); | |
| 2846 | + | |
| 2847 | + Map<String, dynamic> toJson() => { | |
| 2848 | + }; | |
| 2849 | +} | |
| 2850 | + | |
| 2851 | +class Sel { | |
| 2852 | + Sel(); | |
| 2853 | + | |
| 2854 | + factory Sel.fromJson(Map<String, dynamic> json) => Sel( | |
| 2855 | + ); | |
| 2856 | + | |
| 2857 | + Map<String, dynamic> toJson() => { | |
| 2858 | + }; | |
| 2859 | +} | |
| 2860 | + | |
| 2861 | +class Select { | |
| 2862 | + Select(); | |
| 2863 | + | |
| 2864 | + factory Select.fromJson(Map<String, dynamic> json) => Select( | |
| 2865 | + ); | |
| 2866 | + | |
| 2867 | + Map<String, dynamic> toJson() => { | |
| 2868 | + }; | |
| 2869 | +} | |
| 2870 | + | |
| 2871 | +class Self { | |
| 2872 | + Self(); | |
| 2873 | + | |
| 2874 | + factory Self.fromJson(Map<String, dynamic> json) => Self( | |
| 2875 | + ); | |
| 2876 | + | |
| 2877 | + Map<String, dynamic> toJson() => { | |
| 2878 | + }; | |
| 2879 | +} | |
| 2880 | + | |
| 2881 | +class Serialize { | |
| 2882 | + Serialize(); | |
| 2883 | + | |
| 2884 | + factory Serialize.fromJson(Map<String, dynamic> json) => Serialize( | |
| 2885 | + ); | |
| 2886 | + | |
| 2887 | + Map<String, dynamic> toJson() => { | |
| 2888 | + }; | |
| 2889 | +} | |
| 2890 | + | |
| 2891 | +class Short { | |
| 2892 | + Short(); | |
| 2893 | + | |
| 2894 | + factory Short.fromJson(Map<String, dynamic> json) => Short( | |
| 2895 | + ); | |
| 2896 | + | |
| 2897 | + Map<String, dynamic> toJson() => { | |
| 2898 | + }; | |
| 2899 | +} | |
| 2900 | + | |
| 2901 | +class Signed { | |
| 2902 | + Signed(); | |
| 2903 | + | |
| 2904 | + factory Signed.fromJson(Map<String, dynamic> json) => Signed( | |
| 2905 | + ); | |
| 2906 | + | |
| 2907 | + Map<String, dynamic> toJson() => { | |
| 2908 | + }; | |
| 2909 | +} | |
| 2910 | + | |
| 2911 | +class Sizeof { | |
| 2912 | + Sizeof(); | |
| 2913 | + | |
| 2914 | + factory Sizeof.fromJson(Map<String, dynamic> json) => Sizeof( | |
| 2915 | + ); | |
| 2916 | + | |
| 2917 | + Map<String, dynamic> toJson() => { | |
| 2918 | + }; | |
| 2919 | +} | |
| 2920 | + | |
| 2921 | +class Stackalloc { | |
| 2922 | + Stackalloc(); | |
| 2923 | + | |
| 2924 | + factory Stackalloc.fromJson(Map<String, dynamic> json) => Stackalloc( | |
| 2925 | + ); | |
| 2926 | + | |
| 2927 | + Map<String, dynamic> toJson() => { | |
| 2928 | + }; | |
| 2929 | +} | |
| 2930 | + | |
| 2931 | +class StaticAssert { | |
| 2932 | + StaticAssert(); | |
| 2933 | + | |
| 2934 | + factory StaticAssert.fromJson(Map<String, dynamic> json) => StaticAssert( | |
| 2935 | + ); | |
| 2936 | + | |
| 2937 | + Map<String, dynamic> toJson() => { | |
| 2938 | + }; | |
| 2939 | +} | |
| 2940 | + | |
| 2941 | +class StaticCast { | |
| 2942 | + StaticCast(); | |
| 2943 | + | |
| 2944 | + factory StaticCast.fromJson(Map<String, dynamic> json) => StaticCast( | |
| 2945 | + ); | |
| 2946 | + | |
| 2947 | + Map<String, dynamic> toJson() => { | |
| 2948 | + }; | |
| 2949 | +} | |
| 2950 | + | |
| 2951 | +class Strictfp { | |
| 2952 | + Strictfp(); | |
| 2953 | + | |
| 2954 | + factory Strictfp.fromJson(Map<String, dynamic> json) => Strictfp( | |
| 2955 | + ); | |
| 2956 | + | |
| 2957 | + Map<String, dynamic> toJson() => { | |
| 2958 | + }; | |
| 2959 | +} | |
| 2960 | + | |
| 2961 | +class StringClass { | |
| 2962 | + StringClass(); | |
| 2963 | + | |
| 2964 | + factory StringClass.fromJson(Map<String, dynamic> json) => StringClass( | |
| 2965 | + ); | |
| 2966 | + | |
| 2967 | + Map<String, dynamic> toJson() => { | |
| 2968 | + }; | |
| 2969 | +} | |
| 2970 | + | |
| 2971 | +class Struct { | |
| 2972 | + Struct(); | |
| 2973 | + | |
| 2974 | + factory Struct.fromJson(Map<String, dynamic> json) => Struct( | |
| 2975 | + ); | |
| 2976 | + | |
| 2977 | + Map<String, dynamic> toJson() => { | |
| 2978 | + }; | |
| 2979 | +} | |
| 2980 | + | |
| 2981 | +class Subscript { | |
| 2982 | + Subscript(); | |
| 2983 | + | |
| 2984 | + factory Subscript.fromJson(Map<String, dynamic> json) => Subscript( | |
| 2985 | + ); | |
| 2986 | + | |
| 2987 | + Map<String, dynamic> toJson() => { | |
| 2988 | + }; | |
| 2989 | +} | |
| 2990 | + | |
| 2991 | +class Symbol { | |
| 2992 | + Symbol(); | |
| 2993 | + | |
| 2994 | + factory Symbol.fromJson(Map<String, dynamic> json) => Symbol( | |
| 2995 | + ); | |
| 2996 | + | |
| 2997 | + Map<String, dynamic> toJson() => { | |
| 2998 | + }; | |
| 2999 | +} | |
| 3000 | + | |
| 3001 | +class Synchronized { | |
| 3002 | + Synchronized(); | |
| 3003 | + | |
| 3004 | + factory Synchronized.fromJson(Map<String, dynamic> json) => Synchronized( | |
| 3005 | + ); | |
| 3006 | + | |
| 3007 | + Map<String, dynamic> toJson() => { | |
| 3008 | + }; | |
| 3009 | +} | |
| 3010 | + | |
| 3011 | +class System { | |
| 3012 | + System(); | |
| 3013 | + | |
| 3014 | + factory System.fromJson(Map<String, dynamic> json) => System( | |
| 3015 | + ); | |
| 3016 | + | |
| 3017 | + Map<String, dynamic> toJson() => { | |
| 3018 | + }; | |
| 3019 | +} | |
| 3020 | + | |
| 3021 | +class Template { | |
| 3022 | + Template(); | |
| 3023 | + | |
| 3024 | + factory Template.fromJson(Map<String, dynamic> json) => Template( | |
| 3025 | + ); | |
| 3026 | + | |
| 3027 | + Map<String, dynamic> toJson() => { | |
| 3028 | + }; | |
| 3029 | +} | |
| 3030 | + | |
| 3031 | +class Then { | |
| 3032 | + Then(); | |
| 3033 | + | |
| 3034 | + factory Then.fromJson(Map<String, dynamic> json) => Then( | |
| 3035 | + ); | |
| 3036 | + | |
| 3037 | + Map<String, dynamic> toJson() => { | |
| 3038 | + }; | |
| 3039 | +} | |
| 3040 | + | |
| 3041 | +class ThreadLocal { | |
| 3042 | + ThreadLocal(); | |
| 3043 | + | |
| 3044 | + factory ThreadLocal.fromJson(Map<String, dynamic> json) => ThreadLocal( | |
| 3045 | + ); | |
| 3046 | + | |
| 3047 | + Map<String, dynamic> toJson() => { | |
| 3048 | + }; | |
| 3049 | +} | |
| 3050 | + | |
| 3051 | +class Throws { | |
| 3052 | + Throws(); | |
| 3053 | + | |
| 3054 | + factory Throws.fromJson(Map<String, dynamic> json) => Throws( | |
| 3055 | + ); | |
| 3056 | + | |
| 3057 | + Map<String, dynamic> toJson() => { | |
| 3058 | + }; | |
| 3059 | +} | |
| 3060 | + | |
| 3061 | +class TopLevelClass { | |
| 3062 | + TopLevelClass(); | |
| 3063 | + | |
| 3064 | + factory TopLevelClass.fromJson(Map<String, dynamic> json) => TopLevelClass( | |
| 3065 | + ); | |
| 3066 | + | |
| 3067 | + Map<String, dynamic> toJson() => { | |
| 3068 | + }; | |
| 3069 | +} | |
| 3070 | + | |
| 3071 | +class Abstract { | |
| 3072 | + Abstract(); | |
| 3073 | + | |
| 3074 | + factory Abstract.fromJson(Map<String, dynamic> json) => Abstract( | |
| 3075 | + ); | |
| 3076 | + | |
| 3077 | + Map<String, dynamic> toJson() => { | |
| 3078 | + }; | |
| 3079 | +} | |
| 3080 | + | |
| 3081 | +class AnyClass { | |
| 3082 | + AnyClass(); | |
| 3083 | + | |
| 3084 | + factory AnyClass.fromJson(Map<String, dynamic> json) => AnyClass( | |
| 3085 | + ); | |
| 3086 | + | |
| 3087 | + Map<String, dynamic> toJson() => { | |
| 3088 | + }; | |
| 3089 | +} | |
| 3090 | + | |
| 3091 | +class As { | |
| 3092 | + As(); | |
| 3093 | + | |
| 3094 | + factory As.fromJson(Map<String, dynamic> json) => As( | |
| 3095 | + ); | |
| 3096 | + | |
| 3097 | + Map<String, dynamic> toJson() => { | |
| 3098 | + }; | |
| 3099 | +} | |
| 3100 | + | |
| 3101 | +class Assert { | |
| 3102 | + Assert(); | |
| 3103 | + | |
| 3104 | + factory Assert.fromJson(Map<String, dynamic> json) => Assert( | |
| 3105 | + ); | |
| 3106 | + | |
| 3107 | + Map<String, dynamic> toJson() => { | |
| 3108 | + }; | |
| 3109 | +} | |
| 3110 | + | |
| 3111 | +class Async { | |
| 3112 | + Async(); | |
| 3113 | + | |
| 3114 | + factory Async.fromJson(Map<String, dynamic> json) => Async( | |
| 3115 | + ); | |
| 3116 | + | |
| 3117 | + Map<String, dynamic> toJson() => { | |
| 3118 | + }; | |
| 3119 | +} | |
| 3120 | + | |
| 3121 | +class Await { | |
| 3122 | + Await(); | |
| 3123 | + | |
| 3124 | + factory Await.fromJson(Map<String, dynamic> json) => Await( | |
| 3125 | + ); | |
| 3126 | + | |
| 3127 | + Map<String, dynamic> toJson() => { | |
| 3128 | + }; | |
| 3129 | +} | |
| 3130 | + | |
| 3131 | +class Bool { | |
| 3132 | + Bool(); | |
| 3133 | + | |
| 3134 | + factory Bool.fromJson(Map<String, dynamic> json) => Bool( | |
| 3135 | + ); | |
| 3136 | + | |
| 3137 | + Map<String, dynamic> toJson() => { | |
| 3138 | + }; | |
| 3139 | +} | |
| 3140 | + | |
| 3141 | +class Break { | |
| 3142 | + Break(); | |
| 3143 | + | |
| 3144 | + factory Break.fromJson(Map<String, dynamic> json) => Break( | |
| 3145 | + ); | |
| 3146 | + | |
| 3147 | + Map<String, dynamic> toJson() => { | |
| 3148 | + }; | |
| 3149 | +} | |
| 3150 | + | |
| 3151 | +class Case { | |
| 3152 | + Case(); | |
| 3153 | + | |
| 3154 | + factory Case.fromJson(Map<String, dynamic> json) => Case( | |
| 3155 | + ); | |
| 3156 | + | |
| 3157 | + Map<String, dynamic> toJson() => { | |
| 3158 | + }; | |
| 3159 | +} | |
| 3160 | + | |
| 3161 | +class Catch { | |
| 3162 | + Catch(); | |
| 3163 | + | |
| 3164 | + factory Catch.fromJson(Map<String, dynamic> json) => Catch( | |
| 3165 | + ); | |
| 3166 | + | |
| 3167 | + Map<String, dynamic> toJson() => { | |
| 3168 | + }; | |
| 3169 | +} | |
| 3170 | + | |
| 3171 | +class Class { | |
| 3172 | + Class(); | |
| 3173 | + | |
| 3174 | + factory Class.fromJson(Map<String, dynamic> json) => Class( | |
| 3175 | + ); | |
| 3176 | + | |
| 3177 | + Map<String, dynamic> toJson() => { | |
| 3178 | + }; | |
| 3179 | +} | |
| 3180 | + | |
| 3181 | +class Const { | |
| 3182 | + Const(); | |
| 3183 | + | |
| 3184 | + factory Const.fromJson(Map<String, dynamic> json) => Const( | |
| 3185 | + ); | |
| 3186 | + | |
| 3187 | + Map<String, dynamic> toJson() => { | |
| 3188 | + }; | |
| 3189 | +} | |
| 3190 | + | |
| 3191 | +class Continue { | |
| 3192 | + Continue(); | |
| 3193 | + | |
| 3194 | + factory Continue.fromJson(Map<String, dynamic> json) => Continue( | |
| 3195 | + ); | |
| 3196 | + | |
| 3197 | + Map<String, dynamic> toJson() => { | |
| 3198 | + }; | |
| 3199 | +} | |
| 3200 | + | |
| 3201 | +class Default { | |
| 3202 | + Default(); | |
| 3203 | + | |
| 3204 | + factory Default.fromJson(Map<String, dynamic> json) => Default( | |
| 3205 | + ); | |
| 3206 | + | |
| 3207 | + Map<String, dynamic> toJson() => { | |
| 3208 | + }; | |
| 3209 | +} | |
| 3210 | + | |
| 3211 | +class Do { | |
| 3212 | + Do(); | |
| 3213 | + | |
| 3214 | + factory Do.fromJson(Map<String, dynamic> json) => Do( | |
| 3215 | + ); | |
| 3216 | + | |
| 3217 | + Map<String, dynamic> toJson() => { | |
| 3218 | + }; | |
| 3219 | +} | |
| 3220 | + | |
| 3221 | +class Double { | |
| 3222 | + Double(); | |
| 3223 | + | |
| 3224 | + factory Double.fromJson(Map<String, dynamic> json) => Double( | |
| 3225 | + ); | |
| 3226 | + | |
| 3227 | + Map<String, dynamic> toJson() => { | |
| 3228 | + }; | |
| 3229 | +} | |
| 3230 | + | |
| 3231 | +class Dynamic { | |
| 3232 | + Dynamic(); | |
| 3233 | + | |
| 3234 | + factory Dynamic.fromJson(Map<String, dynamic> json) => Dynamic( | |
| 3235 | + ); | |
| 3236 | + | |
| 3237 | + Map<String, dynamic> toJson() => { | |
| 3238 | + }; | |
| 3239 | +} | |
| 3240 | + | |
| 3241 | +class Else { | |
| 3242 | + Else(); | |
| 3243 | + | |
| 3244 | + factory Else.fromJson(Map<String, dynamic> json) => Else( | |
| 3245 | + ); | |
| 3246 | + | |
| 3247 | + Map<String, dynamic> toJson() => { | |
| 3248 | + }; | |
| 3249 | +} | |
| 3250 | + | |
| 3251 | +class Enum { | |
| 3252 | + Enum(); | |
| 3253 | + | |
| 3254 | + factory Enum.fromJson(Map<String, dynamic> json) => Enum( | |
| 3255 | + ); | |
| 3256 | + | |
| 3257 | + Map<String, dynamic> toJson() => { | |
| 3258 | + }; | |
| 3259 | +} | |
| 3260 | + | |
| 3261 | +class Export { | |
| 3262 | + Export(); | |
| 3263 | + | |
| 3264 | + factory Export.fromJson(Map<String, dynamic> json) => Export( | |
| 3265 | + ); | |
| 3266 | + | |
| 3267 | + Map<String, dynamic> toJson() => { | |
| 3268 | + }; | |
| 3269 | +} | |
| 3270 | + | |
| 3271 | +class Extends { | |
| 3272 | + Extends(); | |
| 3273 | + | |
| 3274 | + factory Extends.fromJson(Map<String, dynamic> json) => Extends( | |
| 3275 | + ); | |
| 3276 | + | |
| 3277 | + Map<String, dynamic> toJson() => { | |
| 3278 | + }; | |
| 3279 | +} | |
| 3280 | + | |
| 3281 | +class False { | |
| 3282 | + False(); | |
| 3283 | + | |
| 3284 | + factory False.fromJson(Map<String, dynamic> json) => False( | |
| 3285 | + ); | |
| 3286 | + | |
| 3287 | + Map<String, dynamic> toJson() => { | |
| 3288 | + }; | |
| 3289 | +} | |
| 3290 | + | |
| 3291 | +class Final { | |
| 3292 | + Final(); | |
| 3293 | + | |
| 3294 | + factory Final.fromJson(Map<String, dynamic> json) => Final( | |
| 3295 | + ); | |
| 3296 | + | |
| 3297 | + Map<String, dynamic> toJson() => { | |
| 3298 | + }; | |
| 3299 | +} | |
| 3300 | + | |
| 3301 | +class Finally { | |
| 3302 | + Finally(); | |
| 3303 | + | |
| 3304 | + factory Finally.fromJson(Map<String, dynamic> json) => Finally( | |
| 3305 | + ); | |
| 3306 | + | |
| 3307 | + Map<String, dynamic> toJson() => { | |
| 3308 | + }; | |
| 3309 | +} | |
| 3310 | + | |
| 3311 | +class For { | |
| 3312 | + For(); | |
| 3313 | + | |
| 3314 | + factory For.fromJson(Map<String, dynamic> json) => For( | |
| 3315 | + ); | |
| 3316 | + | |
| 3317 | + Map<String, dynamic> toJson() => { | |
| 3318 | + }; | |
| 3319 | +} | |
| 3320 | + | |
| 3321 | +class FromJson { | |
| 3322 | + FromJson(); | |
| 3323 | + | |
| 3324 | + factory FromJson.fromJson(Map<String, dynamic> json) => FromJson( | |
| 3325 | + ); | |
| 3326 | + | |
| 3327 | + Map<String, dynamic> toJson() => { | |
| 3328 | + }; | |
| 3329 | +} | |
| 3330 | + | |
| 3331 | +class Get { | |
| 3332 | + Get(); | |
| 3333 | + | |
| 3334 | + factory Get.fromJson(Map<String, dynamic> json) => Get( | |
| 3335 | + ); | |
| 3336 | + | |
| 3337 | + Map<String, dynamic> toJson() => { | |
| 3338 | + }; | |
| 3339 | +} | |
| 3340 | + | |
| 3341 | +class If { | |
| 3342 | + If(); | |
| 3343 | + | |
| 3344 | + factory If.fromJson(Map<String, dynamic> json) => If( | |
| 3345 | + ); | |
| 3346 | + | |
| 3347 | + Map<String, dynamic> toJson() => { | |
| 3348 | + }; | |
| 3349 | +} | |
| 3350 | + | |
| 3351 | +class Implements { | |
| 3352 | + Implements(); | |
| 3353 | + | |
| 3354 | + factory Implements.fromJson(Map<String, dynamic> json) => Implements( | |
| 3355 | + ); | |
| 3356 | + | |
| 3357 | + Map<String, dynamic> toJson() => { | |
| 3358 | + }; | |
| 3359 | +} | |
| 3360 | + | |
| 3361 | +class Import { | |
| 3362 | + Import(); | |
| 3363 | + | |
| 3364 | + factory Import.fromJson(Map<String, dynamic> json) => Import( | |
| 3365 | + ); | |
| 3366 | + | |
| 3367 | + Map<String, dynamic> toJson() => { | |
| 3368 | + }; | |
| 3369 | +} | |
| 3370 | + | |
| 3371 | +class In { | |
| 3372 | + In(); | |
| 3373 | + | |
| 3374 | + factory In.fromJson(Map<String, dynamic> json) => In( | |
| 3375 | + ); | |
| 3376 | + | |
| 3377 | + Map<String, dynamic> toJson() => { | |
| 3378 | + }; | |
| 3379 | +} | |
| 3380 | + | |
| 3381 | +class Int { | |
| 3382 | + Int(); | |
| 3383 | + | |
| 3384 | + factory Int.fromJson(Map<String, dynamic> json) => Int( | |
| 3385 | + ); | |
| 3386 | + | |
| 3387 | + Map<String, dynamic> toJson() => { | |
| 3388 | + }; | |
| 3389 | +} | |
| 3390 | + | |
| 3391 | +class Interface { | |
| 3392 | + Interface(); | |
| 3393 | + | |
| 3394 | + factory Interface.fromJson(Map<String, dynamic> json) => Interface( | |
| 3395 | + ); | |
| 3396 | + | |
| 3397 | + Map<String, dynamic> toJson() => { | |
| 3398 | + }; | |
| 3399 | +} | |
| 3400 | + | |
| 3401 | +class Is { | |
| 3402 | + Is(); | |
| 3403 | + | |
| 3404 | + factory Is.fromJson(Map<String, dynamic> json) => Is( | |
| 3405 | + ); | |
| 3406 | + | |
| 3407 | + Map<String, dynamic> toJson() => { | |
| 3408 | + }; | |
| 3409 | +} | |
| 3410 | + | |
| 3411 | +class New { | |
| 3412 | + New(); | |
| 3413 | + | |
| 3414 | + factory New.fromJson(Map<String, dynamic> json) => New( | |
| 3415 | + ); | |
| 3416 | + | |
| 3417 | + Map<String, dynamic> toJson() => { | |
| 3418 | + }; | |
| 3419 | +} | |
| 3420 | + | |
| 3421 | +class NoneClass { | |
| 3422 | + NoneClass(); | |
| 3423 | + | |
| 3424 | + factory NoneClass.fromJson(Map<String, dynamic> json) => NoneClass( | |
| 3425 | + ); | |
| 3426 | + | |
| 3427 | + Map<String, dynamic> toJson() => { | |
| 3428 | + }; | |
| 3429 | +} | |
| 3430 | + | |
| 3431 | +class Null { | |
| 3432 | + Null(); | |
| 3433 | + | |
| 3434 | + factory Null.fromJson(Map<String, dynamic> json) => Null( | |
| 3435 | + ); | |
| 3436 | + | |
| 3437 | + Map<String, dynamic> toJson() => { | |
| 3438 | + }; | |
| 3439 | +} | |
| 3440 | + | |
| 3441 | +class Operator { | |
| 3442 | + Operator(); | |
| 3443 | + | |
| 3444 | + factory Operator.fromJson(Map<String, dynamic> json) => Operator( | |
| 3445 | + ); | |
| 3446 | + | |
| 3447 | + Map<String, dynamic> toJson() => { | |
| 3448 | + }; | |
| 3449 | +} | |
| 3450 | + | |
| 3451 | +class ProtocolClass { | |
| 3452 | + ProtocolClass(); | |
| 3453 | + | |
| 3454 | + factory ProtocolClass.fromJson(Map<String, dynamic> json) => ProtocolClass( | |
| 3455 | + ); | |
| 3456 | + | |
| 3457 | + Map<String, dynamic> toJson() => { | |
| 3458 | + }; | |
| 3459 | +} | |
| 3460 | + | |
| 3461 | +class Return { | |
| 3462 | + Return(); | |
| 3463 | + | |
| 3464 | + factory Return.fromJson(Map<String, dynamic> json) => Return( | |
| 3465 | + ); | |
| 3466 | + | |
| 3467 | + Map<String, dynamic> toJson() => { | |
| 3468 | + }; | |
| 3469 | +} | |
| 3470 | + | |
| 3471 | +class SelfClass { | |
| 3472 | + SelfClass(); | |
| 3473 | + | |
| 3474 | + factory SelfClass.fromJson(Map<String, dynamic> json) => SelfClass( | |
| 3475 | + ); | |
| 3476 | + | |
| 3477 | + Map<String, dynamic> toJson() => { | |
| 3478 | + }; | |
| 3479 | +} | |
| 3480 | + | |
| 3481 | +class Set { | |
| 3482 | + Set(); | |
| 3483 | + | |
| 3484 | + factory Set.fromJson(Map<String, dynamic> json) => Set( | |
| 3485 | + ); | |
| 3486 | + | |
| 3487 | + Map<String, dynamic> toJson() => { | |
| 3488 | + }; | |
| 3489 | +} | |
| 3490 | + | |
| 3491 | +class Static { | |
| 3492 | + Static(); | |
| 3493 | + | |
| 3494 | + factory Static.fromJson(Map<String, dynamic> json) => Static( | |
| 3495 | + ); | |
| 3496 | + | |
| 3497 | + Map<String, dynamic> toJson() => { | |
| 3498 | + }; | |
| 3499 | +} | |
| 3500 | + | |
| 3501 | +class Super { | |
| 3502 | + Super(); | |
| 3503 | + | |
| 3504 | + factory Super.fromJson(Map<String, dynamic> json) => Super( | |
| 3505 | + ); | |
| 3506 | + | |
| 3507 | + Map<String, dynamic> toJson() => { | |
| 3508 | + }; | |
| 3509 | +} | |
| 3510 | + | |
| 3511 | +class Switch { | |
| 3512 | + Switch(); | |
| 3513 | + | |
| 3514 | + factory Switch.fromJson(Map<String, dynamic> json) => Switch( | |
| 3515 | + ); | |
| 3516 | + | |
| 3517 | + Map<String, dynamic> toJson() => { | |
| 3518 | + }; | |
| 3519 | +} | |
| 3520 | + | |
| 3521 | +class This { | |
| 3522 | + This(); | |
| 3523 | + | |
| 3524 | + factory This.fromJson(Map<String, dynamic> json) => This( | |
| 3525 | + ); | |
| 3526 | + | |
| 3527 | + Map<String, dynamic> toJson() => { | |
| 3528 | + }; | |
| 3529 | +} | |
| 3530 | + | |
| 3531 | +class Throw { | |
| 3532 | + Throw(); | |
| 3533 | + | |
| 3534 | + factory Throw.fromJson(Map<String, dynamic> json) => Throw( | |
| 3535 | + ); | |
| 3536 | + | |
| 3537 | + Map<String, dynamic> toJson() => { | |
| 3538 | + }; | |
| 3539 | +} | |
| 3540 | + | |
| 3541 | +class ToJson { | |
| 3542 | + ToJson(); | |
| 3543 | + | |
| 3544 | + factory ToJson.fromJson(Map<String, dynamic> json) => ToJson( | |
| 3545 | + ); | |
| 3546 | + | |
| 3547 | + Map<String, dynamic> toJson() => { | |
| 3548 | + }; | |
| 3549 | +} | |
| 3550 | + | |
| 3551 | +class True { | |
| 3552 | + True(); | |
| 3553 | + | |
| 3554 | + factory True.fromJson(Map<String, dynamic> json) => True( | |
| 3555 | + ); | |
| 3556 | + | |
| 3557 | + Map<String, dynamic> toJson() => { | |
| 3558 | + }; | |
| 3559 | +} | |
| 3560 | + | |
| 3561 | +class Try { | |
| 3562 | + Try(); | |
| 3563 | + | |
| 3564 | + factory Try.fromJson(Map<String, dynamic> json) => Try( | |
| 3565 | + ); | |
| 3566 | + | |
| 3567 | + Map<String, dynamic> toJson() => { | |
| 3568 | + }; | |
| 3569 | +} | |
| 3570 | + | |
| 3571 | +class TypeClass { | |
| 3572 | + TypeClass(); | |
| 3573 | + | |
| 3574 | + factory TypeClass.fromJson(Map<String, dynamic> json) => TypeClass( | |
| 3575 | + ); | |
| 3576 | + | |
| 3577 | + Map<String, dynamic> toJson() => { | |
| 3578 | + }; | |
| 3579 | +} | |
| 3580 | + | |
| 3581 | +class Typedef { | |
| 3582 | + Typedef(); | |
| 3583 | + | |
| 3584 | + factory Typedef.fromJson(Map<String, dynamic> json) => Typedef( | |
| 3585 | + ); | |
| 3586 | + | |
| 3587 | + Map<String, dynamic> toJson() => { | |
| 3588 | + }; | |
| 3589 | +} | |
| 3590 | + | |
| 3591 | +class Var { | |
| 3592 | + Var(); | |
| 3593 | + | |
| 3594 | + factory Var.fromJson(Map<String, dynamic> json) => Var( | |
| 3595 | + ); | |
| 3596 | + | |
| 3597 | + Map<String, dynamic> toJson() => { | |
| 3598 | + }; | |
| 3599 | +} | |
| 3600 | + | |
| 3601 | +class Void { | |
| 3602 | + Void(); | |
| 3603 | + | |
| 3604 | + factory Void.fromJson(Map<String, dynamic> json) => Void( | |
| 3605 | + ); | |
| 3606 | + | |
| 3607 | + Map<String, dynamic> toJson() => { | |
| 3608 | + }; | |
| 3609 | +} | |
| 3610 | + | |
| 3611 | +class While { | |
| 3612 | + While(); | |
| 3613 | + | |
| 3614 | + factory While.fromJson(Map<String, dynamic> json) => While( | |
| 3615 | + ); | |
| 3616 | + | |
| 3617 | + Map<String, dynamic> toJson() => { | |
| 3618 | + }; | |
| 3619 | +} | |
| 3620 | + | |
| 3621 | +class With { | |
| 3622 | + With(); | |
| 3623 | + | |
| 3624 | + factory With.fromJson(Map<String, dynamic> json) => With( | |
| 3625 | + ); | |
| 3626 | + | |
| 3627 | + Map<String, dynamic> toJson() => { | |
| 3628 | + }; | |
| 3629 | +} | |
| 3630 | + | |
| 3631 | +class Yield { | |
| 3632 | + Yield(); | |
| 3633 | + | |
| 3634 | + factory Yield.fromJson(Map<String, dynamic> json) => Yield( | |
| 3635 | + ); | |
| 3636 | + | |
| 3637 | + Map<String, dynamic> toJson() => { | |
| 3638 | + }; | |
| 3639 | +} | |
| 3640 | + | |
| 3641 | +class Transient { | |
| 3642 | + Transient(); | |
| 3643 | + | |
| 3644 | + factory Transient.fromJson(Map<String, dynamic> json) => Transient( | |
| 3645 | + ); | |
| 3646 | + | |
| 3647 | + Map<String, dynamic> toJson() => { | |
| 3648 | + }; | |
| 3649 | +} | |
| 3650 | + | |
| 3651 | +class Type { | |
| 3652 | + Type(); | |
| 3653 | + | |
| 3654 | + factory Type.fromJson(Map<String, dynamic> json) => Type( | |
| 3655 | + ); | |
| 3656 | + | |
| 3657 | + Map<String, dynamic> toJson() => { | |
| 3658 | + }; | |
| 3659 | +} | |
| 3660 | + | |
| 3661 | +class Typealias { | |
| 3662 | + Typealias(); | |
| 3663 | + | |
| 3664 | + factory Typealias.fromJson(Map<String, dynamic> json) => Typealias( | |
| 3665 | + ); | |
| 3666 | + | |
| 3667 | + Map<String, dynamic> toJson() => { | |
| 3668 | + }; | |
| 3669 | +} | |
| 3670 | + | |
| 3671 | +class Typeid { | |
| 3672 | + Typeid(); | |
| 3673 | + | |
| 3674 | + factory Typeid.fromJson(Map<String, dynamic> json) => Typeid( | |
| 3675 | + ); | |
| 3676 | + | |
| 3677 | + Map<String, dynamic> toJson() => { | |
| 3678 | + }; | |
| 3679 | +} | |
| 3680 | + | |
| 3681 | +class Typename { | |
| 3682 | + Typename(); | |
| 3683 | + | |
| 3684 | + factory Typename.fromJson(Map<String, dynamic> json) => Typename( | |
| 3685 | + ); | |
| 3686 | + | |
| 3687 | + Map<String, dynamic> toJson() => { | |
| 3688 | + }; | |
| 3689 | +} | |
| 3690 | + | |
| 3691 | +class Typeof { | |
| 3692 | + Typeof(); | |
| 3693 | + | |
| 3694 | + factory Typeof.fromJson(Map<String, dynamic> json) => Typeof( | |
| 3695 | + ); | |
| 3696 | + | |
| 3697 | + Map<String, dynamic> toJson() => { | |
| 3698 | + }; | |
| 3699 | +} | |
| 3700 | + | |
| 3701 | +class Uint { | |
| 3702 | + Uint(); | |
| 3703 | + | |
| 3704 | + factory Uint.fromJson(Map<String, dynamic> json) => Uint( | |
| 3705 | + ); | |
| 3706 | + | |
| 3707 | + Map<String, dynamic> toJson() => { | |
| 3708 | + }; | |
| 3709 | +} | |
| 3710 | + | |
| 3711 | +class Ulong { | |
| 3712 | + Ulong(); | |
| 3713 | + | |
| 3714 | + factory Ulong.fromJson(Map<String, dynamic> json) => Ulong( | |
| 3715 | + ); | |
| 3716 | + | |
| 3717 | + Map<String, dynamic> toJson() => { | |
| 3718 | + }; | |
| 3719 | +} | |
| 3720 | + | |
| 3721 | +class Unchecked { | |
| 3722 | + Unchecked(); | |
| 3723 | + | |
| 3724 | + factory Unchecked.fromJson(Map<String, dynamic> json) => Unchecked( | |
| 3725 | + ); | |
| 3726 | + | |
| 3727 | + Map<String, dynamic> toJson() => { | |
| 3728 | + }; | |
| 3729 | +} | |
| 3730 | + | |
| 3731 | +class Undefined { | |
| 3732 | + Undefined(); | |
| 3733 | + | |
| 3734 | + factory Undefined.fromJson(Map<String, dynamic> json) => Undefined( | |
| 3735 | + ); | |
| 3736 | + | |
| 3737 | + Map<String, dynamic> toJson() => { | |
| 3738 | + }; | |
| 3739 | +} | |
| 3740 | + | |
| 3741 | +class Union { | |
| 3742 | + Union(); | |
| 3743 | + | |
| 3744 | + factory Union.fromJson(Map<String, dynamic> json) => Union( | |
| 3745 | + ); | |
| 3746 | + | |
| 3747 | + Map<String, dynamic> toJson() => { | |
| 3748 | + }; | |
| 3749 | +} | |
| 3750 | + | |
| 3751 | +class Unowned { | |
| 3752 | + Unowned(); | |
| 3753 | + | |
| 3754 | + factory Unowned.fromJson(Map<String, dynamic> json) => Unowned( | |
| 3755 | + ); | |
| 3756 | + | |
| 3757 | + Map<String, dynamic> toJson() => { | |
| 3758 | + }; | |
| 3759 | +} | |
| 3760 | + | |
| 3761 | +class Unsafe { | |
| 3762 | + Unsafe(); | |
| 3763 | + | |
| 3764 | + factory Unsafe.fromJson(Map<String, dynamic> json) => Unsafe( | |
| 3765 | + ); | |
| 3766 | + | |
| 3767 | + Map<String, dynamic> toJson() => { | |
| 3768 | + }; | |
| 3769 | +} | |
| 3770 | + | |
| 3771 | +class Unsigned { | |
| 3772 | + Unsigned(); | |
| 3773 | + | |
| 3774 | + factory Unsigned.fromJson(Map<String, dynamic> json) => Unsigned( | |
| 3775 | + ); | |
| 3776 | + | |
| 3777 | + Map<String, dynamic> toJson() => { | |
| 3778 | + }; | |
| 3779 | +} | |
| 3780 | + | |
| 3781 | +class Ushort { | |
| 3782 | + Ushort(); | |
| 3783 | + | |
| 3784 | + factory Ushort.fromJson(Map<String, dynamic> json) => Ushort( | |
| 3785 | + ); | |
| 3786 | + | |
| 3787 | + Map<String, dynamic> toJson() => { | |
| 3788 | + }; | |
| 3789 | +} | |
| 3790 | + | |
| 3791 | +class Using { | |
| 3792 | + Using(); | |
| 3793 | + | |
| 3794 | + factory Using.fromJson(Map<String, dynamic> json) => Using( | |
| 3795 | + ); | |
| 3796 | + | |
| 3797 | + Map<String, dynamic> toJson() => { | |
| 3798 | + }; | |
| 3799 | +} | |
| 3800 | + | |
| 3801 | +class Virtual { | |
| 3802 | + Virtual(); | |
| 3803 | + | |
| 3804 | + factory Virtual.fromJson(Map<String, dynamic> json) => Virtual( | |
| 3805 | + ); | |
| 3806 | + | |
| 3807 | + Map<String, dynamic> toJson() => { | |
| 3808 | + }; | |
| 3809 | +} | |
| 3810 | + | |
| 3811 | +class Volatile { | |
| 3812 | + Volatile(); | |
| 3813 | + | |
| 3814 | + factory Volatile.fromJson(Map<String, dynamic> json) => Volatile( | |
| 3815 | + ); | |
| 3816 | + | |
| 3817 | + Map<String, dynamic> toJson() => { | |
| 3818 | + }; | |
| 3819 | +} | |
| 3820 | + | |
| 3821 | +class WcharT { | |
| 3822 | + WcharT(); | |
| 3823 | + | |
| 3824 | + factory WcharT.fromJson(Map<String, dynamic> json) => WcharT( | |
| 3825 | + ); | |
| 3826 | + | |
| 3827 | + Map<String, dynamic> toJson() => { | |
| 3828 | + }; | |
| 3829 | +} | |
| 3830 | + | |
| 3831 | +class Weak { | |
| 3832 | + Weak(); | |
| 3833 | + | |
| 3834 | + factory Weak.fromJson(Map<String, dynamic> json) => Weak( | |
| 3835 | + ); | |
| 3836 | + | |
| 3837 | + Map<String, dynamic> toJson() => { | |
| 3838 | + }; | |
| 3839 | +} | |
| 3840 | + | |
| 3841 | +class Where { | |
| 3842 | + Where(); | |
| 3843 | + | |
| 3844 | + factory Where.fromJson(Map<String, dynamic> json) => Where( | |
| 3845 | + ); | |
| 3846 | + | |
| 3847 | + Map<String, dynamic> toJson() => { | |
| 3848 | + }; | |
| 3849 | +} | |
| 3850 | + | |
| 3851 | +class WillSet { | |
| 3852 | + WillSet(); | |
| 3853 | + | |
| 3854 | + factory WillSet.fromJson(Map<String, dynamic> json) => WillSet( | |
| 3855 | + ); | |
| 3856 | + | |
| 3857 | + Map<String, dynamic> toJson() => { | |
| 3858 | + }; | |
| 3859 | +} | |
| 3860 | + | |
| 3861 | +class Xor { | |
| 3862 | + Xor(); | |
| 3863 | + | |
| 3864 | + factory Xor.fromJson(Map<String, dynamic> json) => Xor( | |
| 3865 | + ); | |
| 3866 | + | |
| 3867 | + Map<String, dynamic> toJson() => { | |
| 3868 | + }; | |
| 3869 | +} | |
| 3870 | + | |
| 3871 | +class XorEq { | |
| 3872 | + XorEq(); | |
| 3873 | + | |
| 3874 | + factory XorEq.fromJson(Map<String, dynamic> json) => XorEq( | |
| 3875 | + ); | |
| 3876 | + | |
| 3877 | + Map<String, dynamic> toJson() => { | |
| 3878 | + }; | |
| 3879 | +} | |
| 3880 | + | |
| 3881 | +class Yes { | |
| 3882 | + Yes(); | |
| 3883 | + | |
| 3884 | + factory Yes.fromJson(Map<String, dynamic> json) => Yes( | |
| 3885 | + ); | |
| 3886 | + | |
| 3887 | + Map<String, dynamic> toJson() => { | |
| 3888 | + }; | |
| 3889 | +} |
Test case
1 generated file · +2 −2test/inputs/schema/unevaluated-properties.schema
Mschema-dartdefault / TopLevel.dart+2 −2
| @@ -38,13 +38,13 @@ class Config { | ||
| 38 | 38 | factory Config.fromJson(Map<String, dynamic> json) => Config( |
| 39 | 39 | closed: json["closed"], |
| 40 | 40 | name: json["name"], |
| 41 | - settings: Map.from(json["settings"]!).map((k, v) => MapEntry<String, List<Item>>(k, List<Item>.from(v.map((x) => Item.fromJson(x))))), | |
| 41 | + settings: json["settings"] == null ? null : Map.from(json["settings"]!).map((k, v) => MapEntry<String, List<Item>>(k, List<Item>.from(v.map((x) => Item.fromJson(x))))), | |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | Map<String, dynamic> toJson() => { |
| 45 | 45 | "closed": closed, |
| 46 | 46 | "name": name, |
| 47 | - "settings": Map.from(settings!).map((k, v) => MapEntry<String, dynamic>(k, List<dynamic>.from(v.map((x) => x.toJson())))), | |
| 47 | + "settings": settings == null ? null : Map.from(settings!).map((k, v) => MapEntry<String, dynamic>(k, List<dynamic>.from(v.map((x) => x.toJson())))), | |
| 48 | 48 | }; |
| 49 | 49 | } |
Test case
1 generated file · +16 −16test/inputs/schema/vega-lite.schema
Mschema-dartdefault / TopLevel.dart+16 −16
| @@ -189,7 +189,7 @@ class TopLevel { | ||
| 189 | 189 | name: json["name"], |
| 190 | 190 | padding: json["padding"], |
| 191 | 191 | projection: json["projection"] == null ? null : Projection.fromJson(json["projection"]), |
| 192 | - selection: Map.from(json["selection"]!).map((k, v) => MapEntry<String, SelectionDef>(k, SelectionDef.fromJson(v))), | |
| 192 | + selection: json["selection"] == null ? null : Map.from(json["selection"]!).map((k, v) => MapEntry<String, SelectionDef>(k, SelectionDef.fromJson(v))), | |
| 193 | 193 | title: json["title"], |
| 194 | 194 | transform: json["transform"] == null ? null : List<Transform>.from(json["transform"]!.map((x) => Transform.fromJson(x))), |
| 195 | 195 | width: json["width"]?.toDouble(), |
| @@ -215,7 +215,7 @@ class TopLevel { | ||
| 215 | 215 | "name": name, |
| 216 | 216 | "padding": padding, |
| 217 | 217 | "projection": projection?.toJson(), |
| 218 | - "selection": Map.from(selection!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 218 | + "selection": selection == null ? null : Map.from(selection!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 219 | 219 | "title": title, |
| 220 | 220 | "transform": transform == null ? null : List<dynamic>.from(transform!.map((x) => x.toJson())), |
| 221 | 221 | "width": width, |
| @@ -534,14 +534,14 @@ class Config { | ||
| 534 | 534 | padding: json["padding"], |
| 535 | 535 | point: json["point"] == null ? null : MarkConfig.fromJson(json["point"]), |
| 536 | 536 | projection: json["projection"] == null ? null : ProjectionConfig.fromJson(json["projection"]), |
| 537 | - range: Map.from(json["range"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 537 | + range: json["range"] == null ? null : Map.from(json["range"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 538 | 538 | rect: json["rect"] == null ? null : MarkConfig.fromJson(json["rect"]), |
| 539 | 539 | rule: json["rule"] == null ? null : MarkConfig.fromJson(json["rule"]), |
| 540 | 540 | scale: json["scale"] == null ? null : ScaleConfig.fromJson(json["scale"]), |
| 541 | 541 | selection: json["selection"] == null ? null : SelectionConfig.fromJson(json["selection"]), |
| 542 | 542 | square: json["square"] == null ? null : MarkConfig.fromJson(json["square"]), |
| 543 | 543 | stack: stackOffsetValues.map[json["stack"]], |
| 544 | - style: Map.from(json["style"]!).map((k, v) => MapEntry<String, VgMarkConfig>(k, VgMarkConfig.fromJson(v))), | |
| 544 | + style: json["style"] == null ? null : Map.from(json["style"]!).map((k, v) => MapEntry<String, VgMarkConfig>(k, VgMarkConfig.fromJson(v))), | |
| 545 | 545 | text: json["text"] == null ? null : TextConfig.fromJson(json["text"]), |
| 546 | 546 | tick: json["tick"] == null ? null : TickConfig.fromJson(json["tick"]), |
| 547 | 547 | timeFormat: json["timeFormat"], |
| @@ -574,14 +574,14 @@ class Config { | ||
| 574 | 574 | "padding": padding, |
| 575 | 575 | "point": point?.toJson(), |
| 576 | 576 | "projection": projection?.toJson(), |
| 577 | - "range": Map.from(range!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 577 | + "range": range == null ? null : Map.from(range!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 578 | 578 | "rect": rect?.toJson(), |
| 579 | 579 | "rule": rule?.toJson(), |
| 580 | 580 | "scale": scale?.toJson(), |
| 581 | 581 | "selection": selection?.toJson(), |
| 582 | 582 | "square": square?.toJson(), |
| 583 | 583 | "stack": stackOffsetValues.reverse[stack], |
| 584 | - "style": Map.from(style!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 584 | + "style": style == null ? null : Map.from(style!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 585 | 585 | "text": text?.toJson(), |
| 586 | 586 | "tick": tick?.toJson(), |
| 587 | 587 | "timeFormat": timeFormat, |
| @@ -2376,7 +2376,7 @@ class ProjectionConfig { | ||
| 2376 | 2376 | fraction: json["fraction"]?.toDouble(), |
| 2377 | 2377 | lobes: json["lobes"]?.toDouble(), |
| 2378 | 2378 | parallel: json["parallel"]?.toDouble(), |
| 2379 | - precision: Map.from(json["precision"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 2379 | + precision: json["precision"] == null ? null : Map.from(json["precision"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 2380 | 2380 | radius: json["radius"]?.toDouble(), |
| 2381 | 2381 | ratio: json["ratio"]?.toDouble(), |
| 2382 | 2382 | rotate: json["rotate"] == null ? null : List<double>.from(json["rotate"]!.map((x) => x?.toDouble())), |
| @@ -2394,7 +2394,7 @@ class ProjectionConfig { | ||
| 2394 | 2394 | "fraction": fraction, |
| 2395 | 2395 | "lobes": lobes, |
| 2396 | 2396 | "parallel": parallel, |
| 2397 | - "precision": Map.from(precision!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 2397 | + "precision": precision == null ? null : Map.from(precision!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 2398 | 2398 | "radius": radius, |
| 2399 | 2399 | "ratio": ratio, |
| 2400 | 2400 | "rotate": rotate == null ? null : List<dynamic>.from(rotate!.map((x) => x)), |
| @@ -3067,7 +3067,7 @@ class SingleSelectionConfig { | ||
| 3067 | 3067 | }); |
| 3068 | 3068 | |
| 3069 | 3069 | factory SingleSelectionConfig.fromJson(Map<String, dynamic> json) => SingleSelectionConfig( |
| 3070 | - bind: Map.from(json["bind"]!).map((k, v) => MapEntry<String, VgBinding>(k, VgBinding.fromJson(v))), | |
| 3070 | + bind: json["bind"] == null ? null : Map.from(json["bind"]!).map((k, v) => MapEntry<String, VgBinding>(k, VgBinding.fromJson(v))), | |
| 3071 | 3071 | empty: emptyValues.map[json["empty"]], |
| 3072 | 3072 | encodings: json["encodings"] == null ? null : List<SingleDefChannel>.from(json["encodings"]!.map((x) => singleDefChannelValues.map[x]!)), |
| 3073 | 3073 | fields: json["fields"] == null ? null : List<String>.from(json["fields"]!.map((x) => x)), |
| @@ -3077,7 +3077,7 @@ class SingleSelectionConfig { | ||
| 3077 | 3077 | ); |
| 3078 | 3078 | |
| 3079 | 3079 | Map<String, dynamic> toJson() => { |
| 3080 | - "bind": Map.from(bind!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 3080 | + "bind": bind == null ? null : Map.from(bind!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 3081 | 3081 | "empty": emptyValues.reverse[empty], |
| 3082 | 3082 | "encodings": encodings == null ? null : List<dynamic>.from(encodings!.map((x) => singleDefChannelValues.reverse[x])), |
| 3083 | 3083 | "fields": fields == null ? null : List<dynamic>.from(fields!.map((x) => x)), |
| @@ -7050,7 +7050,7 @@ class Spec { | ||
| 7050 | 7050 | encoding: json["encoding"] == null ? null : Encoding.fromJson(json["encoding"]), |
| 7051 | 7051 | mark: json["mark"], |
| 7052 | 7052 | projection: json["projection"] == null ? null : Projection.fromJson(json["projection"]), |
| 7053 | - selection: Map.from(json["selection"]!).map((k, v) => MapEntry<String, SelectionDef>(k, SelectionDef.fromJson(v))), | |
| 7053 | + selection: json["selection"] == null ? null : Map.from(json["selection"]!).map((k, v) => MapEntry<String, SelectionDef>(k, SelectionDef.fromJson(v))), | |
| 7054 | 7054 | facet: json["facet"] == null ? null : FacetMapping.fromJson(json["facet"]), |
| 7055 | 7055 | spec: json["spec"] == null ? null : Spec.fromJson(json["spec"]), |
| 7056 | 7056 | repeat: json["repeat"] == null ? null : Repeat.fromJson(json["repeat"]), |
| @@ -7071,7 +7071,7 @@ class Spec { | ||
| 7071 | 7071 | "encoding": encoding?.toJson(), |
| 7072 | 7072 | "mark": mark, |
| 7073 | 7073 | "projection": projection?.toJson(), |
| 7074 | - "selection": Map.from(selection!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 7074 | + "selection": selection == null ? null : Map.from(selection!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 7075 | 7075 | "facet": facet?.toJson(), |
| 7076 | 7076 | "spec": spec?.toJson(), |
| 7077 | 7077 | "repeat": repeat?.toJson(), |
| @@ -7314,7 +7314,7 @@ class LayerSpec { | ||
| 7314 | 7314 | encoding: json["encoding"] == null ? null : Encoding.fromJson(json["encoding"]), |
| 7315 | 7315 | mark: json["mark"], |
| 7316 | 7316 | projection: json["projection"] == null ? null : Projection.fromJson(json["projection"]), |
| 7317 | - selection: Map.from(json["selection"]!).map((k, v) => MapEntry<String, SelectionDef>(k, SelectionDef.fromJson(v))), | |
| 7317 | + selection: json["selection"] == null ? null : Map.from(json["selection"]!).map((k, v) => MapEntry<String, SelectionDef>(k, SelectionDef.fromJson(v))), | |
| 7318 | 7318 | ); |
| 7319 | 7319 | |
| 7320 | 7320 | Map<String, dynamic> toJson() => { |
| @@ -7330,7 +7330,7 @@ class LayerSpec { | ||
| 7330 | 7330 | "encoding": encoding?.toJson(), |
| 7331 | 7331 | "mark": mark, |
| 7332 | 7332 | "projection": projection?.toJson(), |
| 7333 | - "selection": Map.from(selection!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 7333 | + "selection": selection == null ? null : Map.from(selection!).map((k, v) => MapEntry<String, dynamic>(k, v.toJson())), | |
| 7334 | 7334 | }; |
| 7335 | 7335 | } |
| 7336 | 7336 | |
| @@ -7737,7 +7737,7 @@ class Projection { | ||
| 7737 | 7737 | fraction: json["fraction"]?.toDouble(), |
| 7738 | 7738 | lobes: json["lobes"]?.toDouble(), |
| 7739 | 7739 | parallel: json["parallel"]?.toDouble(), |
| 7740 | - precision: Map.from(json["precision"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 7740 | + precision: json["precision"] == null ? null : Map.from(json["precision"]!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 7741 | 7741 | radius: json["radius"]?.toDouble(), |
| 7742 | 7742 | ratio: json["ratio"]?.toDouble(), |
| 7743 | 7743 | rotate: json["rotate"] == null ? null : List<double>.from(json["rotate"]!.map((x) => x?.toDouble())), |
| @@ -7755,7 +7755,7 @@ class Projection { | ||
| 7755 | 7755 | "fraction": fraction, |
| 7756 | 7756 | "lobes": lobes, |
| 7757 | 7757 | "parallel": parallel, |
| 7758 | - "precision": Map.from(precision!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 7758 | + "precision": precision == null ? null : Map.from(precision!).map((k, v) => MapEntry<String, dynamic>(k, v)), | |
| 7759 | 7759 | "radius": radius, |
| 7760 | 7760 | "ratio": ratio, |
| 7761 | 7761 | "rotate": rotate == null ? null : List<dynamic>.from(rotate!.map((x) => x)), |
No generated files match these filters.