Skip to content

Commit ae20162

Browse files
committed
Resolve issue with latest analyzer, enums and annotations
Fixes #1083
1 parent da0307d commit ae20162

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.4
2+
3+
- Fix issues with latest `package:analyzer` related to enums and annotations.
4+
15
## 6.1.3
26

37
- Allow latest `package:analyzer`.

json_serializable/lib/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ T enumValueForDartObject<T>(
4545
List<T> items,
4646
String Function(T) name,
4747
) =>
48-
items.singleWhere((v) => source.getField(name(v)) != null);
48+
items[source.getField('index')!.toIntValue()!];
4949

5050
/// Return an instance of [JsonSerializable] corresponding to a the provided
5151
/// [reader].

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.3
2+
version: 6.1.4
33
description: >-
44
Automatically generate code for converting to and from JSON by annotating
55
Dart classes.

0 commit comments

Comments
 (0)