由于依赖项不支持空安全性,因此无法以可靠的空安全性运行 [英] Cannot run with sound null safety because dependencies don't support null safety

查看:103
本文介绍了由于依赖项不支持空安全性,因此无法以可靠的空安全性运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已遵循 dart.dev 上以及 已迁移 我的整个Flutter应用都没有安全性.

I have followed "Enabling null safety" on dart.dev and also migrated my whole Flutter app to null safety.

现在,我正在尝试使用 flutter run 运行它,但是由于以下错误,它无法启动:

Now, I am trying to run it using flutter run, however, it will not start because of the following error:

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:cloud_firestore_web
 - package:firebase_core_web
 - package:shared_preferences
 - package:url_launcher_web
 - package:firebase_auth
 - package:http
 - package:provider
...

For solutions, see https://dart.dev/go/unsound-null-safety
Failed to compile application.

URL上的指南说,在迁移依赖项之前,我应该"等待迁移包" ,但我现在想使用NNBD.

The guide at the URL says that I should "wait for dependencies to migrate before you migrate your package", but I want to use NNBD now.

我该怎么做?

推荐答案

首先,您应该通读了解无效的null安全性.
如果您确定要以无效的null安全性运行应用程序,则可以使用以下命令:

First, you should read through the guide to understand unsound null safety.
If you are sure that you want to run your app with unsound null safety, you can use the following command:

flutter run --no-sound-null-safety

该文章未记录-no-sound-null-safety 选项,但是,最近几个月我没有遇到任何问题(尤其是自从整体Flutter框架已迁移到null安全).

The --no-sound-null-safety option is not documented in the article, however, I have not experienced any problems with it for the last few months (and especially not since the whole Flutter framework has been migrated to null safety).

编辑:文档现已更新为包含此内容.请参见测试或运行混合版本程序.

Edit: the documentation has now been updated to include this. See Testing or running mixed-version programs.

要在您选择的IDE中进行设置,可以使用编辑配置"(在您的 run 配置中)→"Additional run args"在IntelliJ中搜索其他Args",(带有"Dart"/"Flutter")在VSCode中的用户设置中.

To set this up in your IDE of choice, you can use "Edit Configurations" (in your run configurations) → "Additional run args" in IntelliJ and search for "Additional Args" (with "Dart"/"Flutter") in your user settings in VSCode.

这篇关于由于依赖项不支持空安全性,因此无法以可靠的空安全性运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆