Json_serializable.dart: flutter_test from sdk is incompatible with json_serializable >=0.5.3.

Created on 19 Jun 2018  Â·  8Comments  Â·  Source: google/json_serializable.dart

After updating my pubspec.yaml with my dependencies (denoted below), the flutter tool is giving me this error when I try flutter packages get

_Because every version of flutter_test from sdk depends on test 0.12.37 which depends on analyzer >=0.26.4 <0.32.0, every version of flutter_test from sdk requires analyzer >=0.26.4 <0.32.0.
And because json_serializable >=0.5.3 depends on analyzer ^0.32.0,_ flutter_test from sdk is incompatible with json_serializable >=0.5.3.
_So, because jam2018 depends on both json_serializable ^0.5.4 and flutter_test any from sdk,_ version solving failed.
pub get failed (1)

screen shot 2018-06-19 at 2 29 35 pm

is there any way around this issue?

needs info

Most helpful comment

just a workaround for me:

remove flutter_test, and use build_runner: "^0.8.10" for now.

and wait for flutter_test to be updated to support the latest analyzer.

dev_dependencies:
  # flutter_test:   # <-- remove this for now.
  #   sdk: flutter

  build_runner: "^0.8.10"  # <-- use this for now.
  json_serializable: "^0.5.8"

All 8 comments

Which version of Flutter are you on? Did you upgrade to the latest beta (today)?

Yes, I'm pretty sure I checked my latest version of Flutter was up-to-date, but to be sure, I checked again. Flutter Doctor reported no issues, but I get a slightly different error this time in the console after running _flutter packages upgrade_.

Flutter Version info

_Flutter 0.5.1 • channel beta • https://github.com/flutter/flutter.git_
_Framework • revision c7ea3ca377 (3 weeks ago) • 2018-05-29 21:07:33 +0200_
_Engine • revision 1ed25ca7b7_
_Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760_

flutter upgrade console output

Error Message from 'flutter packages upgrade'

_Because every version of flutter_test from sdk depends on analyzer 0.31.2-alpha.2 and json_serializable >=0.5.3 depends on analyzer ^0.32.0, flutter_test from sdk is incompatible with json_serializable >=0.5.3._

_So, because jam2018 depends on both json_serializable ^0.5.4 and flutter_test any from sdk, version solving failed._

_pub get failed (1)_

screen shot 2018-06-20 at 4 01 09 pm

Yup. flutter_test needs to be updated to support the latest analyzer. I'd file a bug on the flutter repo...reference this issue...

will do. thanks!

just a workaround for me:

remove flutter_test, and use build_runner: "^0.8.10" for now.

and wait for flutter_test to be updated to support the latest analyzer.

dev_dependencies:
  # flutter_test:   # <-- remove this for now.
  #   sdk: flutter

  build_runner: "^0.8.10"  # <-- use this for now.
  json_serializable: "^0.5.8"

The suggestion from @pcqpcq is a good one.

Downgrade version of JSON_serializable

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xiang23 picture xiang23  Â·  5Comments

enyo picture enyo  Â·  6Comments

alexantenna picture alexantenna  Â·  3Comments

fzyzcjy picture fzyzcjy  Â·  5Comments

hatjs880328s picture hatjs880328s  Â·  3Comments