質問編集履歴
1
ErrorCodeと自動生成されたmodelを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -190,116 +190,262 @@
|
|
190
190
|
|
191
191
|
],
|
192
192
|
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
{
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
{
|
260
|
-
|
261
|
-
"id": "2",
|
262
|
-
|
263
|
-
"type": "genre",
|
264
|
-
|
265
|
-
"attributes": {
|
266
|
-
|
267
|
-
"name": "genre2"
|
268
|
-
|
269
|
-
}
|
270
|
-
|
271
|
-
},
|
272
|
-
|
273
|
-
{
|
274
|
-
|
275
|
-
"id": "3",
|
276
|
-
|
277
|
-
"type": "other_user",
|
278
|
-
|
279
|
-
"attributes": {
|
280
|
-
|
281
|
-
"username": "test-user",
|
282
|
-
|
283
|
-
"introduction": null,
|
284
|
-
|
285
|
-
"profileImagePath": null,
|
286
|
-
|
287
|
-
"headerImagePath": null,
|
288
|
-
|
289
|
-
"lastLoggedIn": "2020-10-17T07:35:51.424Z"
|
290
|
-
|
291
|
-
}
|
292
|
-
|
293
|
-
}
|
294
|
-
|
295
|
-
]
|
193
|
+
```
|
194
|
+
|
195
|
+
```model
|
196
|
+
|
197
|
+
class Autogenerated {
|
198
|
+
|
199
|
+
List<Data> data;
|
200
|
+
|
201
|
+
List<Included> included;
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
Autogenerated({this.data, this.included});
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
Autogenerated.fromJson(Map<String, dynamic> json) {
|
210
|
+
|
211
|
+
if (json['data'] != null) {
|
212
|
+
|
213
|
+
data = new List<Data>();
|
214
|
+
|
215
|
+
json['data'].forEach((v) {
|
216
|
+
|
217
|
+
data.add(new Data.fromJson(v));
|
218
|
+
|
219
|
+
});
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
if (json['included'] != null) {
|
224
|
+
|
225
|
+
included = new List<Included>();
|
226
|
+
|
227
|
+
json['included'].forEach((v) {
|
228
|
+
|
229
|
+
included.add(new Included.fromJson(v));
|
230
|
+
|
231
|
+
});
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
Map<String, dynamic> toJson() {
|
240
|
+
|
241
|
+
final Map<String, dynamic> data = new Map<String, dynamic>();
|
242
|
+
|
243
|
+
if (this.data != null) {
|
244
|
+
|
245
|
+
data['data'] = this.data.map((v) => v.toJson()).toList();
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
if (this.included != null) {
|
250
|
+
|
251
|
+
data['included'] = this.included.map((v) => v.toJson()).toList();
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
return data;
|
256
|
+
|
257
|
+
}
|
296
258
|
|
297
259
|
}
|
298
260
|
|
261
|
+
|
262
|
+
|
263
|
+
class Data {
|
264
|
+
|
265
|
+
String id;
|
266
|
+
|
267
|
+
String type;
|
268
|
+
|
269
|
+
Attributes attributes;
|
270
|
+
|
271
|
+
Relationships relationships;
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
Data({this.id, this.type, this.attributes, this.relationships});
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
Data.fromJson(Map<String, dynamic> json) {
|
280
|
+
|
281
|
+
id = json['id'];
|
282
|
+
|
283
|
+
type = json['type'];
|
284
|
+
|
285
|
+
attributes = json['attributes'] != null
|
286
|
+
|
287
|
+
? new Attributes.fromJson(json['attributes'])
|
288
|
+
|
289
|
+
: null;
|
290
|
+
|
291
|
+
relationships = json['relationships'] != null
|
292
|
+
|
293
|
+
? new Relationships.fromJson(json['relationships'])
|
294
|
+
|
295
|
+
: null;
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
Map<String, dynamic> toJson() {
|
302
|
+
|
303
|
+
final Map<String, dynamic> data = new Map<String, dynamic>();
|
304
|
+
|
305
|
+
data['id'] = this.id;
|
306
|
+
|
307
|
+
data['type'] = this.type;
|
308
|
+
|
309
|
+
if (this.attributes != null) {
|
310
|
+
|
311
|
+
data['attributes'] = this.attributes.toJson();
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
if (this.relationships != null) {
|
316
|
+
|
317
|
+
data['relationships'] = this.relationships.toJson();
|
318
|
+
|
319
|
+
}
|
320
|
+
|
321
|
+
return data;
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
class Attributes {
|
330
|
+
|
331
|
+
String title;
|
332
|
+
|
333
|
+
String description;
|
334
|
+
|
335
|
+
String imagePath;
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
Attributes({this.title, this.description, this.imagePath});
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
Attributes.fromJson(Map<String, dynamic> json) {
|
344
|
+
|
345
|
+
title = json['title'];
|
346
|
+
|
347
|
+
description = json['description'];
|
348
|
+
|
349
|
+
imagePath = json['image_path'];
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
Map<String, dynamic> toJson() {
|
356
|
+
|
357
|
+
final Map<String, dynamic> data = new Map<String, dynamic>();
|
358
|
+
|
359
|
+
data['title'] = this.title;
|
360
|
+
|
361
|
+
data['description'] = this.description;
|
362
|
+
|
363
|
+
data['image_path'] = this.imagePath;
|
364
|
+
|
365
|
+
return data;
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
class Attributes {
|
374
|
+
|
375
|
+
String name;
|
376
|
+
|
377
|
+
String username;
|
378
|
+
|
379
|
+
Null introduction;
|
380
|
+
|
381
|
+
Null profileImagePath;
|
382
|
+
|
383
|
+
Null headerImagePath;
|
384
|
+
|
385
|
+
String lastLoggedIn;
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
Attributes(
|
390
|
+
|
391
|
+
{this.name,
|
392
|
+
|
393
|
+
this.username,
|
394
|
+
|
395
|
+
this.introduction,
|
396
|
+
|
397
|
+
this.profileImagePath,
|
398
|
+
|
399
|
+
this.headerImagePath,
|
400
|
+
|
401
|
+
this.lastLoggedIn});
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
Attributes.fromJson(Map<String, dynamic> json) {
|
406
|
+
|
407
|
+
name = json['name'];
|
408
|
+
|
409
|
+
username = json['username'];
|
410
|
+
|
411
|
+
introduction = json['introduction'];
|
412
|
+
|
413
|
+
profileImagePath = json['profileImagePath'];
|
414
|
+
|
415
|
+
headerImagePath = json['headerImagePath'];
|
416
|
+
|
417
|
+
lastLoggedIn = json['lastLoggedIn'];
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
Map<String, dynamic> toJson() {
|
424
|
+
|
425
|
+
final Map<String, dynamic> data = new Map<String, dynamic>();
|
426
|
+
|
427
|
+
data['name'] = this.name;
|
428
|
+
|
429
|
+
data['username'] = this.username;
|
430
|
+
|
431
|
+
data['introduction'] = this.introduction;
|
432
|
+
|
433
|
+
data['profileImagePath'] = this.profileImagePath;
|
434
|
+
|
435
|
+
data['headerImagePath'] = this.headerImagePath;
|
436
|
+
|
437
|
+
data['lastLoggedIn'] = this.lastLoggedIn;
|
438
|
+
|
439
|
+
return data;
|
440
|
+
|
441
|
+
}
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
|
446
|
+
|
299
447
|
```
|
300
448
|
|
301
|
-
|
302
|
-
|
303
449
|
```apidart
|
304
450
|
|
305
451
|
import 'dart:convert' show json, jsonDecode;
|
@@ -346,7 +492,7 @@
|
|
346
492
|
|
347
493
|
|
348
494
|
|
349
|
-
return new
|
495
|
+
return new Attributes.fromJson(res);
|
350
496
|
|
351
497
|
}
|
352
498
|
|
@@ -432,4 +578,10 @@
|
|
432
578
|
|
433
579
|
|
434
580
|
|
581
|
+
```ErrorCode
|
582
|
+
|
583
|
+
Error: The argument type 'List<dynamic>' can't be assigned to the parameter type
|
584
|
+
|
435
|
-
|
585
|
+
'Map<String, dynamic>'.
|
586
|
+
|
587
|
+
```
|