关于Flutter报Cannot run with sound null safety

Posted wx5aae83353cec4

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Flutter报Cannot run with sound null safety相关的知识,希望对你有一定的参考价值。


flutter sdk 版本升级到2.0或者更高的版本后,运行之前的代码会报错,比如:

Error: Cannot run with sound null safety, because the following dependencies
dont support null safety:

- package:flutter_swiper
- package:flutter_page_indicator
- package:transformer_page_view

For solutions, see https://dart.dev/go/unsound-null-safety


FAILURE: Build failed with an exception.

上面的问题是,这些包不支持 safety模式。我们可以在运行的时候添加​​--no-sound-null-safety​​。打开android Studio,然后依次选择【Run】 -->【 Edit Configurations】 --> 【Add Additional Run args 】–> 【–no-sound-null-safety】,如下图。

关于Flutter报Cannot


然后,再次运行就没有错误了。

除了上面找个方法外,对于一些老的项目,我们还可以通过降低sdk版本的方式来解决报错,比如。

sdk: ">=2.12.0 <3.0.0" 改为   sdk: ">=2.8.0 <3.0.0"

因为sdk 2.12 以上版本有了空安全要求。


以上是关于关于Flutter报Cannot run with sound null safety的主要内容,如果未能解决你的问题,请参考以下文章

Cannot run with sound null safety

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

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

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support(代

mysql主从赋值,从机验证报错:ERROR 3021(HY000):this operation cannot be performed with a running salve io thread

mysql报错The MySQL server is running with the LOCK_WRITE_GROWTH option so it cannot executethisstatem