当我在 Fedora 32 中编译我的项目时,显示此错误:
Running "flutter pub get" in cruise-open...
Because every version of flutter_driver from sdk depends on crypto 2.1.5 and Cruise depends on crypto 3.0.0, flutter_driver from sdk is forbidden.
So, because Cruise depends on flutter_driver any from sdk, version solving failed.
pub get failed (1; So, because Cruise depends on flutter_driver any from sdk, version solving failed.)
这是我的 pubspec.yaml
文件:
name: Cruise
description: A RSS article read Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: 0.17.0
meta: ^1.1.8
flutter_svg: 0.19.0
logger: 0.9.4
scoped_model: ^1.1.0
shrine_images: ^1.1.2
flare_dart: 2.3.4
flare_flutter: ^2.0.2
vector_math: ^2.0.8
collection: ^1.14.0
package_info: ^0.4.0
fluttertoast: 7.1.6
flutter_staggered_grid_view: ^0.3.0
adaptive_breakpoints: ^0.0.2
cupertino_icons: 1.0.0
http: ^0.12.0+2
flutter_icons: ^1.0.0
timeago: 2.0.26
animations: 1.1.2
flutter_hooks: ^0.12.0
share: ^0.6.4+3
shimmer: 1.1.1
crypto: 3.0.0
url_launcher: 5.5.0
uni_links: 0.4.0
flutter_html: 1.2.0
shared_preferences: ^0.5.8
state_notifier: ^0.5.0
flutter_secure_storage: 3.3.3
flutter_slidable: "^0.5.5"
hive: ^1.4.1+1
pull_to_refresh: 1.6.3
intl_phone_number_input: ^0.5.0
dio: 3.0.10
fish_redux: 0.3.4
hive_flutter: 0.3.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_driver:
sdk: flutter
test:
path:
args:
grinder: ^0.8.0
pedantic: ^1.9.0
string_scanner: ^1.0.5
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
generate: true
我该怎么做才能修复它?这是颤振版本信息:
[dolphin@MiWiFi-R4CM-srv]~/Documents/GitHub/cruise-open% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] IntelliJ IDEA Community Edition (version 2020.2)
[✓] VS Code (version 1.54.1)
[✓] Connected device (2 available)
• No issues found!
答案 0 :(得分:7)
发生这种情况是因为 flutter_driver
的空安全迁移没有及时完成。
即使现在已经修复,它也不会在 6 月初左右(或下一个稳定频道发布)在稳定频道中发布。
同时,我们有两个解决方案:
beta
或 dev
渠道尽快获得修复。dependency_overrides
中使用 pubspec.yaml
以在 Flutter 2 中继续使用 flutter_driver
(同时保持在 stable
频道中)。我更喜欢第二个选择。所以我像这样编辑我的 pubspec.yaml
:
dependencies:
# my list of deps...
dev_dependencies:
flutter_driver:
sdk: flutter
test: any
# my other dev_deps...
# add this section???
dependency_overrides:
convert: ^3.0.0
crypto: ^3.0.0
# add this section ???
这个解决方案对我有用。我现在可以安装 flutter_driver
。 ?
答案 1 :(得分:2)
通过将我在 pubspec.yaml 中的 sdk 约束更改为
environment:
sdk: ">=2.12.0 <3.0.0"
并从flutters稳定频道改为主频道
答案 2 :(得分:0)
将 crypto 添加到依赖项并运行 flutter pub get
:
dependencies:
crypto: ^3.0.0
答案 3 :(得分:0)
使用下一个方法。但要小心,测试可能会中断。 在 pubspec.yaml 中的依赖项部分之后插入下一个代码
dependency_overrides:
crypto: 3.0.0