简体   繁体   English

无法正常运行 null 安全,因为以下依赖项 [build\windows\flutter\flutter_assemble.vcxproj]

[英]Cannot run with sound null safety, because the following dependencies [build\windows\flutter\flutter_assemble.vcxproj]

I have shifted my entire code to latest dart version 2.15.1.我已将我的整个代码转移到最新的 dart 版本 2.15.1。 Now I am trying to run the code and it is giving this error.现在我正在尝试运行代码,但它给出了这个错误。

Image 1图片1

Why I am getting this error.为什么我收到此错误。 Anyone please help me.任何人都请帮助我。

Thanks谢谢

This is because some of your dependencies that you are using in your project doesn't support null-safety or Your project itself doesn't support null-safety but using dependencies that supports null-safety .这是因为您在项目中使用的某些dependencies项不支持null-safety或者Your project本身不支持 null-safety 但使用支持null-safety dependencies项。 To get rid of this problem you can try upgrading the dependency that is causing the error and if there's no update available for that plugin that run your project using below command:要解决此问题,您可以尝试upgrading导致错误的dependency项,如果没有可用的更新可用于运行您的项目的插件,请使用以下命令:

To Run Run

flutter run --no-sound-null-safety

To Build Build

flutter build apk --release --no-sound-null-safety

This error comes when your project or package is not supported on null safetynull 安全不支持您的项目或 package 时,会出现此错误
when you are trying to run the project its gives you an error which you see in your picture当您尝试运行该项目时,它会给您一个您在图片中看到的错误

if you want to run without null safety use this command如果您想在没有 null 安全的情况下运行,请使用此命令

flutter run --no-sound-null-safety

when you hit this command on your project it should be run if you face any error kindly comment当您在项目中点击此命令时,如果您遇到任何错误,它应该运行,请评论

1.Press Run
2.Edit Configurations
3.Add Additional Run args 
4.--no-sound-null-safety

在此处输入图像描述

I just ran into this.我刚遇到这个。 I tried to build for Windows and got the null-safety error but the output did not say which packages were the problem, it just showed several paths to Visual Studio.我尝试为 Windows 构建并遇到空安全错误,但 output 没有说明是哪个包有问题,它只是显示了 Visual Studio 的几个路径。

I then tried to build for Chrome and it did list the packages that did not support null-safety.然后我尝试为 Chrome 构建,它确实列出了不支持 null-safety 的包。 Hope this helps.希望这可以帮助。

in my case i just type the major version avalaible for the dependency and it works: from shared_preferences:在我的例子中,我只是输入依赖项可用的主要版本并且它有效:来自 shared_preferences:

to shared_preferences: ^2.0.16共享首选项:^2.0.16

With the flutter pub update command, it threw me a reference to the shared_preferences dependency and after investigated options I saw this solution and applied it and it worked fine使用 flutter pub update 命令,它向我提供了对 shared_preferences 依赖项的引用,在调查了选项之后,我看到了这个解决方案并应用了它并且工作正常

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter 不能以空安全运行,因为以下依赖不支持空安全 - Flutter Cannot run with sound null safety, because the following dependencies don't support null safety 错误:无法以健全的 null 安全运行,因为以下依赖项不支持 null 安全; 在 flutter - Error: Cannot run with sound null safety, because the following dependencies don't support null safety; in flutter 错误:无法以声音空安全运行,因为以下依赖项(flutter_absolute_path) - Error: Cannot run with sound null safety, because the following dependencies (flutter_absolute_path) "无法以可靠的 null 安全性运行,因为以下依赖项不支持 null 安全性:" - Cannot run with sound null safety, because the following dependencies don't support null safety: 错误:无法以健全的 null 安全运行,因为以下依赖项不支持 null 安全: - Error: Cannot run with sound null safety, because the following dependencies don't support null safety: 无法以健全的 null 安全运行,因为以下依赖项不支持 null 安全 - Cannot run with sound null safety, because the following dependencies don't support null safety 无法正常运行 null 安全,Flutter - Cannot run with sound null safety, Flutter 无法以声音 null 安全运行,因为依赖项不支持 null 安全 - Cannot run with sound null safety because dependencies doesnot support null safety 无法以声音 null 安全运行,因为依赖项不支持 null 安全 - Cannot run with sound null safety because dependencies don't support null safety 如何在 Flutter APK Build 中使用 Visual Studio AppCenter 处理“Cannot run with sound null safety”错误 - How to Handle "Cannot run with sound null safety" error with Visual Studio AppCenter in Flutter APK Build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM