Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions json_serializable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.9.4

- Fix extra line being generated when targetting Dart 3.7 package.

## 6.9.3

- Error out if the target package does not have a language version of `3.0` or
Expand Down
33 changes: 12 additions & 21 deletions json_serializable/lib/src/decode_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,27 +317,18 @@ _ConstructorData _writeConstructorInvocation(
'$className'
'${genericClassArguments(classElement, false)}'
'$constructorExtra(',
);
if (constructorArguments.isNotEmpty) {
buffer
..writeln()
..writeAll(constructorArguments.map((paramElement) {
final content =
deserializeForField(paramElement.name, ctorParam: paramElement);
return ' $content,\n';
}));
}
if (namedConstructorArguments.isNotEmpty) {
buffer
..writeln()
..writeAll(namedConstructorArguments.map((paramElement) {
final value =
deserializeForField(paramElement.name, ctorParam: paramElement);
return ' ${paramElement.name}: $value,\n';
}));
}

buffer.write(')');
)
..writeAll(constructorArguments.map((paramElement) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only real change here is the removal of the extra ..writeln() but figured I'd do more general cleanup, too!

final content =
deserializeForField(paramElement.name, ctorParam: paramElement);
return ' $content,\n';
}))
..writeAll(namedConstructorArguments.map((paramElement) {
final value =
deserializeForField(paramElement.name, ctorParam: paramElement);
return ' ${paramElement.name}: $value,\n';
}))
..write(')');

usedCtorParamsAndFields.addAll(remainingFieldsForInvocationBody);

Expand Down
2 changes: 1 addition & 1 deletion json_serializable/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: json_serializable
version: 6.9.3
version: 6.9.4
description: >-
Automatically generate code for converting to and from JSON by annotating
Dart classes.
Expand Down
Loading