Skip to content

Commit 74e6d01

Browse files
authored
Fix enum support for upcoming enhanced enums in Dart 2.17 (#1111)
Fixes #1110 Prepare v6.1.5 release
1 parent ff32528 commit 74e6d01

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

json_serializable/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.1.5
2+
3+
- Fix enum support for upcoming enhanced enums in Dart 2.17.
4+
15
## 6.1.4
26

37
- Fix issues with latest `package:analyzer` related to enums and annotations.

json_serializable/lib/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ConstructorElement constructorByName(ClassElement classElement, String name) {
156156
/// Otherwise, `null`.
157157
Iterable<FieldElement>? iterateEnumFields(DartType targetType) {
158158
if (targetType is InterfaceType && targetType.element.isEnum) {
159-
return targetType.element.fields.where((element) => !element.isSynthetic);
159+
return targetType.element.fields.where((element) => element.isEnumConstant);
160160
}
161161
return null;
162162
}

json_serializable/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: json_serializable
2-
version: 6.1.4
2+
version: 6.1.5
33
description: >-
44
Automatically generate code for converting to and from JSON by annotating
55
Dart classes.

0 commit comments

Comments
 (0)