Chapter 10: Failed to build build_runner:build_runner

I have run into an error that I haven’t been able to work around in Chapter 10: Serialization with Json. At the step where we are supposed to run
flutter pub run build_runner build
in the Terminal I always get the same error:
The property 'displayString' is defined in multiple extensions for 'TargetKind' and neither is more specific.

Initial research indicates that this is likely an issue with versions of meta and analyzer being used, but it appears that I cannot use the newer versions that fix the issue because of dependencies in the json_serializable package. Any suggestions?

1 Like

Can you give me a bit more information? Are you on the flutter stable channel? (Type flutter channel from the command line to find out). What are the versions you have for your packages?
Currently it should be:
cupertino_icons: ^1.0.3
cached_network_image: ^3.1.0
flutter_slidable: ^0.6.0
flutter_svg: ^0.22.0
shared_preferences: ^2.0.7
json_annotation: ^4.1.0

and then:
build_runner: ^2.1.1
json_serializable: ^4.1.4

Let me know if your version numbers are different

1 Like