【发布时间】:2021-11-22 21:55:52
【问题描述】:
我想将我的项目迁移到空安全,但依赖 flutter_template_images 不支持空安全:
Package Name Current Upgradable Resolvable Latest
direct dependencies:
flutter_template_images ✗4.0.0 ✗4.0.0 ✗4.0.0 ✗4.0.0
dev_dependencies: all support null safety.
You are already using the newest resolvable versions listed in the 'Resolvable' column.
Newer versions, listed in 'Latest', may not be mutually compatible.
我不知道这个包来自哪里,也没有在 pubspec.yaml 文件中找到它。我可以在不升级此依赖项的情况下迁移 null 安全性吗?
编辑: 这是我的 pubspec.yaml 文件:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
material_design_icons_flutter: ^4.0.5955
pdf: ^3.3.0
path_provider: ^2.0.2
provider: ^6.0.0
open_file: ^3.2.1
intl: ^0.17.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
cloud_firestore: ^2.3.0
get: ^4.1.4
printing: ^5.4.3
google_sign_in: ^5.0.5
firebase_auth: ^3.0.1
fl_chart: ^0.36.3
url_launcher: ^6.0.9
sqflite: ^2.0.0+4
【问题讨论】:
-
你能附上你的
pubspec.yaml,正如错误中提到的那样,它是一个直接依赖关系,它应该存在于文件中,或者你可能正在使用一些捆绑了flutter_template_images的库在他们里面 -
我将 pubspec.yaml 文件添加到我的问题中
-
能否将 dart sdk 和所有库更新到最新版本
-
有命令可以做到吗?
-
转到工具 -> Flutter -> Flutter Upgrade(这是更新您的 dart sdk)并参考upgrade dependencies
标签: flutter dart package dependencies dart-null-safety