@@ -43,38 +43,19 @@ class Settings {
43
43
GenericFactoryHelper (),
44
44
].followedBy (_typeHelpers).followedBy (_coreHelpers);
45
45
46
- final JsonSerializable _config;
47
-
48
- // #CHANGE WHEN UPDATING json_annotation
49
- ClassConfig get config => ClassConfig (
50
- checked: _config.checked ?? ClassConfig .defaults.checked,
51
- anyMap: _config.anyMap ?? ClassConfig .defaults.anyMap,
52
- constructor: _config.constructor ?? ClassConfig .defaults.constructor,
53
- createFactory:
54
- _config.createFactory ?? ClassConfig .defaults.createFactory,
55
- createToJson: _config.createToJson ?? ClassConfig .defaults.createToJson,
56
- ignoreUnannotated:
57
- _config.ignoreUnannotated ?? ClassConfig .defaults.ignoreUnannotated,
58
- explicitToJson:
59
- _config.explicitToJson ?? ClassConfig .defaults.explicitToJson,
60
- includeIfNull:
61
- _config.includeIfNull ?? ClassConfig .defaults.includeIfNull,
62
- genericArgumentFactories: _config.genericArgumentFactories ??
63
- ClassConfig .defaults.genericArgumentFactories,
64
- fieldRename: _config.fieldRename ?? ClassConfig .defaults.fieldRename,
65
- disallowUnrecognizedKeys: _config.disallowUnrecognizedKeys ??
66
- ClassConfig .defaults.disallowUnrecognizedKeys,
67
- );
46
+ final ClassConfig config;
68
47
69
48
/// Creates an instance of [Settings] .
70
49
///
71
50
/// If [typeHelpers] is not provided, the built-in helpers are used:
72
51
/// [BigIntHelper] , [DateTimeHelper] , [DurationHelper] , [JsonHelper] , and
73
52
/// [UriHelper] .
74
- const Settings ({
53
+ Settings ({
75
54
JsonSerializable ? config,
76
55
List <TypeHelper >? typeHelpers,
77
- }) : _config = config ?? ClassConfig .defaults,
56
+ }) : config = config != null
57
+ ? ClassConfig .fromJsonSerializable (config)
58
+ : ClassConfig .defaults,
78
59
_typeHelpers = typeHelpers ?? defaultHelpers;
79
60
80
61
/// Creates an instance of [Settings] .
0 commit comments