[英]Cannot run with sound null safety, because the following dependencies [build\windows\flutter\flutter_assemble.vcxproj]
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 safety当null 安全不支持您的项目或 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当您在项目中点击此命令时,如果您遇到任何错误,它应该运行,请评论
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.