Dart Flutter 报错:SDK constraint:environment: sdk: ‘^2.12.0‘

[Dart语法] dart pub get
Resolving dependencies...
pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:

environment:
  sdk: '^2.12.0'

在 pubspec.yaml 文件中添加

environment:
  sdk: '^2.12.0'

然后再重新:

dart pub get

如果接着出现下面报错:

Got TLS error trying to find package http at https://pub.dev.

那么修改镜像:

我这里使用的是腾讯镜像:

配置环境变量的方式(win10)

分别新建两个变量:

变量名:

PUB_HOSTED_URL

值:

https://mirrors.cloud.tencent.com/dart-pub

变量名:

扫描二维码关注公众号,回复: 15909965 查看本文章

FLUTTER_STORAGE_BASE_URL

值:

https://mirrors.cloud.tencent.com/flutter

猜你喜欢

转载自blog.csdn.net/A88552211/article/details/129366819
SDK
今日推荐