I'm using the latest version of all these packages.
dependencies
json_annotation: ^4.5.0
dev_dependencies:
json_serializable: ^6.2.0
build_runner: ^2.1.10
I also found that json_serializable: 6.1.5
added support for enhanced enums. But when I run flutter pub build_runner build
on
@JsonEnum(fieldRename: FieldRename.snake)
enum Foo {
helloWorld,
bar;
}
I get this error:
This builder requires Dart inputs without syntax errors. However, package:example/main.dart (or an existing part) contains the > following errors. main.dart:15:8: This requires the 'enhanced-enums' language feature to be enabled.
I also noticed that all these packages's pubspec.yaml
are still not using the Dart SDK 2.17.0
. I manually changed them to 2.17.0
.