pubspec.yaml没有下限SDK约束

我正在参加 MDC101 颤振代码实验室。我按照说明从 git 存储库克隆了启动项目,但是在克隆完成后,我执行了flutter pub get它,但它给了我以下错误。

pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:
environment:
  sdk: '>=2.10.0 <3.0.0'

回答

如果您在 pubspec.yaml 文件包含正确的 sdk 行时收到此错误,请务必检查主文件夹中的子文件夹。注意到在flutter packages get从 font_awesome_flutter 包中执行 a 时会发生这种情况。原因是,即使主要的 pubspec.yaml 包含正确的行,也存在违规的example/pubspec.yaml. 将这些行添加到该文件中:

environment:
  sdk: ">=2.7.0 <3.0.0"

参考问题。

  • This is one of the problems. Should really be the accepted answer.

以上是pubspec.yaml没有下限SDK约束的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>