[已解决] You can enable the experiment using the ‘--enable-experiment=non-nullable‘ command line option

[已解决] You can enable the experiment using the ‘--enable-experiment=non-nullable‘ command line option,第1张

[已解决] You can enable the experiment using the ‘--enable-experiment=non-nullable‘ command line option
Error: This requires the null safety language feature, 
which is experimental. You can enable the experiment
 using the '--enable-experiment=non-nullable' command line option.

解决方法

解决这个问题需要两个步骤:

确认 Flutter 版本(若版本过低,即便调整下方 SDK 版本也无法成功让环境运作)在pubspec.yaml文件中调整environment参数底下的sdk版本。

(可以先调整 SDK 版本,若无法顺利让环境运作,再来升级 Flutter 版本)

flutter upgrade
environment:
  sdk: ">=2.12.0 <3.0.0"

 

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5716430.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-18

发表评论

登录后才能评论

评论列表(0条)

保存