Ank*_*sal 10 dart flutter dart-null-safety
当我运行“dart migrate”以启用空安全时,它会给出以下输出。
\n\nBefore migrating your package, we recommend ensuring that every library it\nimports (either directly or indirectly) has been migrated to null safety, so\nthat you will be able to run your unit tests in sound null checking mode. You\nare currently importing the following non-null-safe libraries:\n\n package:stepfly/common/Functions/Constants/constants.dart\n package:stepfly/common/Functions/Utils/random_string.dart\n package:stepfly/common/Functions/Utils/timeUtils.dart\n package:stepfly/common/Functions/Utils/utilExam.dart\n package:stepfly/common/Functions/Utils/utilInternet.dart\n package:stepfly/common/Functions/Utils/utils.dart\n package:stepfly/common/Functions/Utils/utilsResourse.dart\n package:stepfly/common/Functions/Utils/utilsUserData.dart\n package:stepfly/common/Responsive/enums/device_screen_type.dart\n package:stepfly/common/Responsive/platformInfo.dart\n package:stepfly/common/Responsive/responsive/responsive_builder.dart\n ......\n\nPlease upgrade the packages containing these libraries to null safe versions\nbefore continuing. To see what null safe package versions are available, run\nthe following command: `dart pub outdated --mode=null-safety`.\n\nTo skip this check and try to migrate anyway, re-run with the flag\n`--skip-import-check`\nRun Code Online (Sandbox Code Playgroud)\n虽然这些文件是我自己的代码文件。
\n运行以下命令dart pub outdated --mode=null-safety给出的输出如下:
Showing dependencies that are currently not opted in to null-safety.\n[\xe2\x9c\x97] indicates versions without null safety support.\n[\xe2\x9c\x93] indicates versions opting in to null safety.\n\nComputing null safety support...\nAll your dependencies declare support for null-safety.\nRun Code Online (Sandbox Code Playgroud)\n如何使用dart migrate工具将我的 flutter 代码迁移到空安全
如果我理解正确,您的文件会从您自己的库导入其他文件。这些文件尚未迁移到空安全(因为这就是您想要做的),这就是您收到此错误的原因。
尝试使用提到的再次运行它
To skip this check and try to migrate anyway, re-run with the flag
`--skip-import-check`
Run Code Online (Sandbox Code Playgroud)
我遇到过同样的问题。使用此标志迁移它后,现在一切正常。
| 归档时间: |
|
| 查看次数: |
2586 次 |
| 最近记录: |