我在跑步
> dart pub outdated --mode=null-safety
Showing dependencies that are currently not opted in to null-safety.
[✗] indicates versions without null safety support.
[✓] indicates versions opting in to null safety.
All your dependencies declare support for null-safety.
> dart pub upgrade --null-safety
No dependencies changed.
1 package is discontinued.
148 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
No changes to pubspec.yaml!
> dart pub get
然后运行dart migrate
,得到以下输出:
Analyzing project...
[---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\]Bad state: Error: package has unmigrated dependencies.
Before migrating your package, we recommend ensuring that every library it
imports (either directly or indirectly) has been migrated to null safety, so
that you will be able to run your unit tests in sound null checking mode. You
are currently importing the following non-null-safe libraries:
(a list of files of my project like: package:opengames/presentation/widgets/not_found_screen.dart)
Please upgrade the packages containing these libraries to null safe versions
before continuing. To see what null safe package versions are available, run
the following command: `dart pub outdated --mode=null-safety`.
To skip this check and try to migrate anyway, re-run with the flag
`--skip-import-check`.
为什么会这样?我已经运行了dart pub outdated --mode=null-safety
1条答案
按热度按时间nsc4cvqm1#
问题是您已经迁移到了新版本的dart。您不能从新版本迁移您的项目,实际上没有任何可迁移的地方。
如果您想将旧的项目(没有null安全性)迁移到新版本,您的dart版本必须早于2.12.0版本。在这种情况下,考虑更改pubspec.yaml文件中的版本。
然后运行这个:-
dart migrate --apply-changes