flutterSDK升级失败解决方案

最近在学习flutter,有时从GitHub下载开源项目学习,运行项目时会遇到flutter SDK版本太低的情况,这时就需要升级SDK。

The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.

Because buddy depends on flutter_built_redux 0.4.5 which requires SDK
version >=2.2.0 <3.0.0, version solving failed.
pub get failed (1)

升级 Flutter channel 和 packages
要同时更新Flutter SDK和你的依赖包,在你的应用程序根目录(包含pubspec.yaml文件的目录)中运行flutter upgrade 命令:

$ flutter upgrade

实际运行时会执行失败,结果如下图:

Pasted Graphic 5.png

提示你中国地区用户参考:https://flutter.dev/community/china

$ export PUB_HOSTED_URL=https://pub.flutter-io.cn
$ export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
$  git clone -b dev https://github.com/flutter/flutter.git
$ export PATH="$PWD/flutter/bin:$PATH"
$ cd ./flutter
$ flutter doctor

执行成功结果如下:

Pasted Graphic 4.png

你可能感兴趣的:(flutterSDK升级失败解决方案)