|
13 | 13 | // IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
14 | 14 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
15 | 15 |
|
16 | | -import 'package:woosignal/models/collection.dart'; |
17 | | -import 'package:woosignal/models/self.dart'; |
18 | | - |
19 | | -class Links { |
20 | | - List<Self>? self; |
21 | | - List<Collection>? collection; |
22 | | - List<Collection>? up; |
23 | | - List<Collection>? describes; |
24 | | - |
25 | | - Links({this.self, this.collection, this.up}); |
26 | | - |
27 | | - Links.fromJson(Map<String, dynamic> json) { |
28 | | - if (json['self'] != null) { |
29 | | - self = []; |
30 | | - json['self'].forEach((v) { |
31 | | - self!.add(Self.fromJson(v)); |
32 | | - }); |
33 | | - } |
34 | | - if (json['collection'] != null) { |
35 | | - collection = []; |
36 | | - json['collection'].forEach((v) { |
37 | | - collection!.add(Collection.fromJson(v)); |
38 | | - }); |
39 | | - } |
40 | | - if (json['up'] != null) { |
41 | | - up = []; |
42 | | - json['up'].forEach((v) { |
43 | | - up!.add(Collection.fromJson(v)); |
44 | | - }); |
45 | | - } |
46 | | - if (json['describes'] != null) { |
47 | | - describes = []; |
48 | | - json['describes'].forEach((v) { |
49 | | - describes!.add(Collection.fromJson(v)); |
50 | | - }); |
51 | | - } |
52 | | - } |
53 | | - |
54 | | - Map<String, dynamic> toJson() { |
55 | | - final Map<String, dynamic> data = <String, dynamic>{}; |
56 | | - if (self != null) { |
57 | | - data['self'] = self!.map((v) => v.toJson()).toList(); |
58 | | - } |
59 | | - if (collection != null) { |
60 | | - data['collection'] = collection!.map((v) => v.toJson()).toList(); |
61 | | - } |
62 | | - if (up != null) { |
63 | | - data['up'] = up!.map((v) => v.toJson()).toList(); |
64 | | - } |
65 | | - if (describes != null) { |
66 | | - data['describes'] = describes!.map((v) => v.toJson()).toList(); |
67 | | - } |
68 | | - return data; |
69 | | - } |
70 | | -} |
0 commit comments