诊断Flutter版本解决问题

时间:2019-10-14 14:07:18

标签: flutter dart dependency-management

instructions to add integration tests之后进入我的Flutter应用程序时,我在运行packages get时遇到以下错误:

Because test <1.3.0 requires SDK version >=1.8.0 <2.0.0-∞ and test >=1.3.0 <1.6.1 depends on stream_channel ^1.6.0, test <1.6.1 requires stream_channel ^1.6.0.
And because test >=1.6.0 <1.6.5 depends on analyzer >=0.26.4 <0.37.0 and test >=1.6.4 <1.6.8 depends on test_api 0.2.6, test <1.6.8 requires stream_channel ^1.6.0 or analyzer >=0.26.4 <0.37.0 or test_api 0.2.6.
And because test >=1.6.8 <1.6.11 depends on test_api 0.2.7 and test >=1.6.11 depends on test_api 0.2.8, every version of test requires test_api 0.2.6 or 0.2.7 or 0.2.8 or stream_channel ^1.6.0 or analyzer >=0.26.4 <0.37.0.
And because every version of flutter_test from sdk depends on both stream_channel 2.0.0 and test_api 0.2.5, if flutter_test any from sdk and test any then analyzer >=0.26.4 <0.37.0.
And because json_serializable 3.2.3 depends on analyzer >=0.37.1 <0.39.0 and my_app depends on test any, flutter_test from sdk is incompatible with json_serializable 3.2.3.
So, because my_app depends on both json_serializable 3.2.3 and flutter_test any from sdk, version solving failed.

这大概表明通过依赖关系图出现了某种版本冲突,但是要弄清楚问题到底是什么或我能做些什么我有点不知所措。我的pubspec.yaml如下:


environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  flutter_svg: 0.14.2
  email_validator: 1.0.0
  dio: 3.0.2
  dio_cookie_manager: 1.0.0
  cookie_jar: 1.0.1
  provider: 3.1.0
  path_provider: 1.3.0
  json_annotation: 3.0.0
  timeago: 2.0.19
  flutter_launcher_icons: 0.7.3

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: 1.7.1
  json_serializable: 3.2.3
  mockito: 4.1.1
  flutter_driver:
    sdk: flutter
  test: any

希望有人可以给我正确的方向。

1 个答案:

答案 0 :(得分:0)

您是否尝试从pubsec.yaml中删除test依赖项? 看起来flutter_test软件包已经存在于flutter SDK中。