/
json_serializable.g.dart
121 lines (113 loc) · 4.01 KB
/
json_serializable.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'json_serializable.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
JsonSerializable _$JsonSerializableFromJson(Map<String, dynamic> json) =>
$checkedCreate(
'JsonSerializable',
json,
($checkedConvert) {
$checkKeys(
json,
allowedKeys: const [
'any_map',
'checked',
'constructor',
'create_factory',
'create_to_json',
'disallow_unrecognized_keys',
'explicit_to_json',
'field_rename',
'generic_argument_factories',
'ignore_unannotated',
'include_if_null'
],
);
final val = JsonSerializable(
anyMap: $checkedConvert('any_map', (v) => v as bool?),
checked: $checkedConvert('checked', (v) => v as bool?),
constructor: $checkedConvert('constructor', (v) => v as String?),
createFactory: $checkedConvert('create_factory', (v) => v as bool?),
createToJson: $checkedConvert('create_to_json', (v) => v as bool?),
disallowUnrecognizedKeys:
$checkedConvert('disallow_unrecognized_keys', (v) => v as bool?),
explicitToJson:
$checkedConvert('explicit_to_json', (v) => v as bool?),
fieldRename: $checkedConvert('field_rename',
(v) => _$enumDecodeNullable(_$FieldRenameEnumMap, v)),
ignoreUnannotated:
$checkedConvert('ignore_unannotated', (v) => v as bool?),
includeIfNull: $checkedConvert('include_if_null', (v) => v as bool?),
genericArgumentFactories:
$checkedConvert('generic_argument_factories', (v) => v as bool?),
);
return val;
},
fieldKeyMap: const {
'anyMap': 'any_map',
'createFactory': 'create_factory',
'createToJson': 'create_to_json',
'disallowUnrecognizedKeys': 'disallow_unrecognized_keys',
'explicitToJson': 'explicit_to_json',
'fieldRename': 'field_rename',
'ignoreUnannotated': 'ignore_unannotated',
'includeIfNull': 'include_if_null',
'genericArgumentFactories': 'generic_argument_factories'
},
);
Map<String, dynamic> _$JsonSerializableToJson(JsonSerializable instance) =>
<String, dynamic>{
'any_map': instance.anyMap,
'checked': instance.checked,
'constructor': instance.constructor,
'create_factory': instance.createFactory,
'create_to_json': instance.createToJson,
'disallow_unrecognized_keys': instance.disallowUnrecognizedKeys,
'explicit_to_json': instance.explicitToJson,
'field_rename': _$FieldRenameEnumMap[instance.fieldRename],
'generic_argument_factories': instance.genericArgumentFactories,
'ignore_unannotated': instance.ignoreUnannotated,
'include_if_null': instance.includeIfNull,
};
K _$enumDecode<K, V>(
Map<K, V> enumValues,
Object? source, {
K? unknownValue,
}) {
if (source == null) {
throw ArgumentError(
'A value must be provided. Supported values: '
'${enumValues.values.join(', ')}',
);
}
return enumValues.entries.singleWhere(
(e) => e.value == source,
orElse: () {
if (unknownValue == null) {
throw ArgumentError(
'`$source` is not one of the supported values: '
'${enumValues.values.join(', ')}',
);
}
return MapEntry(unknownValue, enumValues.values.first);
},
).key;
}
K? _$enumDecodeNullable<K, V>(
Map<K, V> enumValues,
dynamic source, {
K? unknownValue,
}) {
if (source == null) {
return null;
}
return _$enumDecode<K, V>(enumValues, source, unknownValue: unknownValue);
}
const _$FieldRenameEnumMap = {
FieldRename.none: 'none',
FieldRename.kebab: 'kebab',
FieldRename.snake: 'snake',
FieldRename.pascal: 'pascal',
FieldRename.screamingSnake: 'screamingSnake',
};