简体   繁体   English

Flutter integration_test package 与我的代码冲突,无法通过调整 package 版本来解决 - 所以整个应用程序无法运行

[英]Flutter integration_test package conflict with my code and cannot be resolved by tweaking package versions - so the whole app cannot run

I have an app (with null-safety), and want to use integration_test package to do some testing.我有一个应用程序(具有空安全性),并且想使用 integration_test package 进行一些测试。 The pubspec.yaml looks like: pubspec.yaml 看起来像:

dependencies:
  archive: ^3.1.2
  ...

dev_dependencies:
  build_resolvers: ^2.0.0
  build_runner: ^1.11.5
  flutter_test:
    sdk: flutter
  integration_test:
    sdk: flutter
  ...

Then it errors:然后它错误:

Because every version of flutter_driver from sdk depends on archive 2.0.13 and my_app depends on archive ^3.1.2, flutter_driver from sdk is forbidden.

I cannot use the non-null-safety version (2.x) of archive package, because if I do so, my app code will fail to run in null safety mode!不能使用存档 package 的非空安全版本 (2.x),因为如果我这样做,我的应用程序代码将无法在 null 安全模式下运行! I can accept that my tests run in non-null-safety mode, but I cannot tolerate my app code run in non-null-safety mode.我可以接受我的测试在非空安全模式下运行,但我不能容忍我的应用程序代码在非空安全模式下运行。

Thanks for any suggestions!感谢您的任何建议!

You need to override the archive package version to tell flutter_driver to use the latest one:您需要覆盖archive package 版本来告诉flutter_driver使用最新的版本:

dev_dependencies:
  build_resolvers: ^2.0.0
  build_runner: ^1.11.5
  flutter_test:
    sdk: flutter
  integration_test:
    sdk: flutter
dependency_overrides:
  archive: ">=3.1.2"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM