首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dart迁移会在我自己的代码文件中产生错误。

dart迁移会在我自己的代码文件中产生错误。
EN

Stack Overflow用户
提问于 2021-07-06 04:17:10
回答 1查看 684关注 0票数 5

当我运行"dart迁移“以启用空安全时,它会给出以下输出。

代码语言:javascript
复制
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将给出如下输出:

代码语言:javascript
复制
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 工具将颤振代码迁移到空安全

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-06 10:01:21

如果我正确理解您的文件,则从您自己的库导入其他文件。这些文件还没有迁移到空安全(因为这是您想要做的),这就是为什么您会得到这个错误。

试着用上面提到的

代码语言:javascript
复制
To skip this check and try to migrate anyway, re-run with the flag
`--skip-import-check`

我也有过同样的问题。在使用此标记迁移它之后,现在一切正常。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68264479

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档