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

从Flutter 2开始,Flutter便在配置中默认启用了空安全,通过将空检查合并到类型系统中,可以在开发过程中捕获这些错误,从而防止再生产环境导致的崩溃。如果当前项目开启了空安全,而引入的三方插件没有适配的话运行回报如下错误。

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

 - package:provider

For solutions, see https://dart.dev/go/unsound-null-safety
Restarted application in 341ms.

这个时候可以看下引入的插件新版本是否支持了空安全,如果插件支持了空安全插件平台会为其打上空安全的标:
Flutter Error Cannot run with sound null safety, because the following dependencies don‘t support_第1张图片
如果引入插件还没不支持空安全,则可在终端执行以下命令来运行软件

flutter run --no-sound-null-safety

你可能感兴趣的:(前端,html,面试,flutter,android,studio,前端)