flutter - dart migrate 在我自己的代码文件中给出错误
问题描述
当我运行“dart migrate”以启用空安全时,它会给出以下输出。
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:
package:stepfly/common/Functions/Constants/constants.dart
package:stepfly/common/Functions/Utils/random_string.dart
package:stepfly/common/Functions/Utils/timeUtils.dart
package:stepfly/common/Functions/Utils/utilExam.dart
package:stepfly/common/Functions/Utils/utilInternet.dart
package:stepfly/common/Functions/Utils/utils.dart
package:stepfly/common/Functions/Utils/utilsResourse.dart
package:stepfly/common/Functions/Utils/utilsUserData.dart
package:stepfly/common/Responsive/enums/device_screen_type.dart
package:stepfly/common/Responsive/platformInfo.dart
package:stepfly/common/Responsive/responsive/responsive_builder.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
给我输出如下:
Showing dependencies that are currently not opted in to null-safety.
[✗] indicates versions without null safety support.
[✓] indicates versions opting in to null safety.
Computing null safety support...
All your dependencies declare support for null-safety.
如何使用dart migrate
工具将我的颤振代码迁移到空安全
解决方案
如果我理解正确,您的文件会从您自己的库中导入其他文件。这些文件尚未迁移到空安全(因为这是您想要做的),这就是您收到此错误的原因。
尝试使用提到的再次运行它
To skip this check and try to migrate anyway, re-run with the flag
`--skip-import-check`
我遇到过同样的问题。使用此标志迁移它后,现在一切正常。
推荐阅读
- matlab - 通过循环复制图像不起作用
- selenium-webdriver - 如何单击具有类名和文本的div中的元素
- css - 带有 IE11 的 svg 上的 css 背景大小问题
- c# - 如何使用 .NET Core 使用 UTC 时间验证 JWT
- azure - Azure 计划测试 - 测试计划设置 - 发布管道不出现在下拉列表中
- sql - 如何在 group by 子句中按日期获取最新项目
- javascript - Javascript代码在wordpress页面内不起作用
- stack-trace - 如何在 C# 中禁用发布配置的堆栈跟踪
- windows - 基于文件日期的 ForFiles 语句
- angular - Ionic v4 菜单仅在 router-outlet 具有主要属性时有效