@@ -51,29 +51,23 @@ mixin DecodeHelper implements HelperCore {
5151
5252 final fromJsonLines = < String > [];
5353
54- String deserializeFun (String paramOrFieldName,
55- {ParameterElement ? ctorParam}) =>
56- _deserializeForField (accessibleFields[paramOrFieldName]! ,
57- ctorParam: ctorParam);
54+ String deserializeFun (String paramOrFieldName, {ParameterElement ? ctorParam}) =>
55+ _deserializeForField (accessibleFields[paramOrFieldName]! , ctorParam: ctorParam);
5856
5957 final data = _writeConstructorInvocation (
6058 element,
6159 config.constructor,
6260 accessibleFields.keys,
6361 accessibleFields.values
64- .where ((fe) =>
65- element.augmented
66- .lookUpSetter (name: fe.name, library: element.library) !=
67- null )
62+ .where ((fe) => element.lookUpSetter (fe.name, element.library) != null )
6863 .map ((fe) => fe.name)
6964 .toList (),
7065 unavailableReasons,
7166 deserializeFun,
7267 );
7368
7469 final checks = _checkKeys (
75- accessibleFields.values
76- .where ((fe) => data.usedCtorParamsAndFields.contains (fe.name)),
70+ accessibleFields.values.where ((fe) => data.usedCtorParamsAndFields.contains (fe.name)),
7771 ).toList ();
7872
7973 if (config.checked) {
@@ -162,26 +156,22 @@ mixin DecodeHelper implements HelperCore {
162156 Iterable <String > _checkKeys (Iterable <FieldElement > accessibleFields) sync * {
163157 final args = < String > [];
164158
165- String constantList (Iterable <FieldElement > things) =>
166- 'const ${jsonLiteralAsDart (things .map (nameAccess ).toList ())}' ;
159+ String constantList (Iterable <FieldElement > things) => 'const ${jsonLiteralAsDart (things .map (nameAccess ).toList ())}' ;
167160
168161 if (config.disallowUnrecognizedKeys) {
169162 final allowKeysLiteral = constantList (accessibleFields);
170163
171164 args.add ('allowedKeys: $allowKeysLiteral ' );
172165 }
173166
174- final requiredKeys =
175- accessibleFields.where ((fe) => jsonKeyFor (fe).required ).toList ();
167+ final requiredKeys = accessibleFields.where ((fe) => jsonKeyFor (fe).required ).toList ();
176168 if (requiredKeys.isNotEmpty) {
177169 final requiredKeyLiteral = constantList (requiredKeys);
178170
179171 args.add ('requiredKeys: $requiredKeyLiteral ' );
180172 }
181173
182- final disallowNullKeys = accessibleFields
183- .where ((fe) => jsonKeyFor (fe).disallowNullValue)
184- .toList ();
174+ final disallowNullKeys = accessibleFields.where ((fe) => jsonKeyFor (fe).disallowNullValue).toList ();
185175 if (disallowNullKeys.isNotEmpty) {
186176 final disallowNullKeyLiteral = constantList (disallowNullKeys);
187177
@@ -220,8 +210,7 @@ mixin DecodeHelper implements HelperCore {
220210 if (config.checked) {
221211 value = deserialize ('v' );
222212 if (! checkedProperty) {
223- final readValueBit =
224- readValueFunc == null ? '' : ',readValue: $readValueFunc ,' ;
213+ final readValueBit = readValueFunc == null ? '' : ',readValue: $readValueFunc ,' ;
225214 value = '\$ checkedConvert($jsonKeyName , (v) => $value $readValueBit )' ;
226215 }
227216 } else {
@@ -231,9 +220,7 @@ mixin DecodeHelper implements HelperCore {
231220 );
232221
233222 value = deserialize (
234- readValueFunc == null
235- ? 'json[$jsonKeyName ]'
236- : '$readValueFunc (json, $jsonKeyName )' ,
223+ readValueFunc == null ? 'json[$jsonKeyName ]' : '$readValueFunc (json, $jsonKeyName )' ,
237224 );
238225 }
239226 } on UnsupportedTypeError catch (e) // ignore: avoid_catching_errors
@@ -268,8 +255,7 @@ _ConstructorData _writeConstructorInvocation(
268255 Iterable <String > availableConstructorParameters,
269256 Iterable <String > writableFields,
270257 Map <String , String > unavailableReasons,
271- String Function (String paramOrFieldName, {ParameterElement ctorParam})
272- deserializeForField,
258+ String Function (String paramOrFieldName, {ParameterElement ctorParam}) deserializeForField,
273259) {
274260 final className = classElement.name;
275261
@@ -307,8 +293,7 @@ _ConstructorData _writeConstructorInvocation(
307293 }
308294
309295 // fields that aren't already set by the constructor and that aren't final
310- final remainingFieldsForInvocationBody =
311- writableFields.toSet ().difference (usedCtorParamsAndFields);
296+ final remainingFieldsForInvocationBody = writableFields.toSet ().difference (usedCtorParamsAndFields);
312297
313298 final constructorExtra = constructorName.isEmpty ? '' : '.$constructorName ' ;
314299
@@ -322,17 +307,15 @@ _ConstructorData _writeConstructorInvocation(
322307 buffer
323308 ..writeln ()
324309 ..writeAll (constructorArguments.map ((paramElement) {
325- final content =
326- deserializeForField (paramElement.name, ctorParam: paramElement);
310+ final content = deserializeForField (paramElement.name, ctorParam: paramElement);
327311 return ' $content ,\n ' ;
328312 }));
329313 }
330314 if (namedConstructorArguments.isNotEmpty) {
331315 buffer
332316 ..writeln ()
333317 ..writeAll (namedConstructorArguments.map ((paramElement) {
334- final value =
335- deserializeForField (paramElement.name, ctorParam: paramElement);
318+ final value = deserializeForField (paramElement.name, ctorParam: paramElement);
336319 return ' ${paramElement .name }: $value ,\n ' ;
337320 }));
338321 }
0 commit comments