Android Studio 运行flutter报错Cannot run with sound null safety
Android Studio 运行flutter报错Flutter报Cannot run with sound null safetyError: Cannot run with sound null safety, because the following dependenciesdon't support null safety:- package:flutter_swiper- packa
·
MAC上 Android Studio 运行flutter报错Flutter报Cannot run with sound null safety
Error: Cannot run with sound null safety, because the following dependencies
don't 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.
找了解决方案
一:终端运行
flutter run --no-sound-null-safety
治标不治本 只能在终端运行程序
方案二:
我们可以在运行的时候添加–no-sound-null-safety。打开Android Studio,然后依次选择【Run】 ->【 Edit Configurations】 -> 【Add Additional Run args 】-> --no-sound-null-safety,如下图。
原因:
Flutter便在配置中默认启用了空安全,通过将空检查合并到类型系统中,可以在开发过程中捕获这些错误,从而防止再生产环境导致的崩溃。如果当前项目开启了空安全,而引入的三方插件没有适配的话运行回报这样运行空错误
参考一:
https://blog.csdn.net/mixin716/article/details/119762233
参考二:
https://zhuanlan.zhihu.com/p/405838959
更多推荐
已为社区贡献6条内容
所有评论(0)