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

Ad大成

关注

阅读 52

2022-01-31

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"

 

 

精彩评论(0)

0 0 举报