forked from google/json_serializable.dart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.g.dart
107 lines (93 loc) · 3.36 KB
/
example.g.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'example.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Person _$PersonFromJson(Map<String, dynamic> json) => Person(
json['firstName'] as String,
json['lastName'] as String,
DateTime.parse(json['date-of-birth'] as String),
middleName: json['middleName'] as String?,
lastOrder: json['last-order'] == null
? null
: DateTime.parse(json['last-order'] as String),
orders: (json['orders'] as List<dynamic>?)
?.map((e) => Order.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$PersonToJson(Person instance) {
final val = <String, dynamic>{
'firstName': instance.firstName,
};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('middleName', instance.middleName);
val['lastName'] = instance.lastName;
val['date-of-birth'] = instance.dateOfBirth.toIso8601String();
val['last-order'] = instance.lastOrder?.toIso8601String();
val['orders'] = instance.orders;
return val;
}
Order _$OrderFromJson(Map<String, dynamic> json) => Order(
Order._dateTimeFromEpochUs((json['date'] as num).toInt()),
)
..count = (json['count'] as num?)?.toInt()
..itemNumber = (json['itemNumber'] as num?)?.toInt()
..isRushed = json['isRushed'] as bool?
..item = json['item'] == null
? null
: Item.fromJson(json['item'] as Map<String, dynamic>)
..prepTime =
Order._durationFromMilliseconds((json['prep-time'] as num?)?.toInt());
Map<String, dynamic> _$OrderToJson(Order instance) {
final val = <String, dynamic>{};
void writeNotNull(String key, dynamic value) {
if (value != null) {
val[key] = value;
}
}
writeNotNull('count', instance.count);
writeNotNull('itemNumber', instance.itemNumber);
writeNotNull('isRushed', instance.isRushed);
writeNotNull('item', instance.item);
writeNotNull('prep-time', Order._durationToMilliseconds(instance.prepTime));
writeNotNull('date', Order._dateTimeToEpochUs(instance.date));
return val;
}
Item _$ItemFromJson(Map<String, dynamic> json) => Item()
..count = (json['count'] as num?)?.toInt()
..itemNumber = (json['itemNumber'] as num?)?.toInt()
..isRushed = json['isRushed'] as bool?;
Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{
'count': instance.count,
'itemNumber': instance.itemNumber,
'isRushed': instance.isRushed,
};
// **************************************************************************
// JsonLiteralGenerator
// **************************************************************************
final _$glossaryDataJsonLiteral = {
'glossary': {
'title': 'example glossary',
'GlossDiv': {
'title': 'S',
'GlossList': {
'GlossEntry': {
'ID': 'SGML',
'SortAs': 'SGML',
'GlossTerm': 'Standard Generalized Markup Language',
'Acronym': 'SGML',
'Abbrev': 'ISO 8879:1986',
'GlossDef': {
'para': 'A meta-markup language, used to create markup languages.',
'GlossSeeAlso': ['GML', 'XML']
},
'GlossSee': 'markup'
}
}
}
}
};