环境说明

  • mac MoJave 10.14.5
  • 旧版本:1.12.13+hotfix.8
  • 新版本:2.2.3

步骤说明

flutter upgrade 方式

看文档说直接执行flutter upgrade 即可升级

试试

# axin @ AxindeMacBook-Pro in /usr/local/flutter on git:stable x [17:02:04] C:141
$ flutter upgrade

死也不动,查看当前分支

flutter channel

# axin @ AxindeMacBook-Pro in /usr/local/flutter on git:stable x [17:07:06] C:1
$ flutter channel
Flutter channels:
beta
dev
master
* stable

没毛病,开FQ(科学上网) try again

# axin @ AxindeMacBook-Pro in /usr/local/flutter on git:stable x [17:05:12] C:141
$ flutter upgrade
Your flutter checkout has local changes that would be erased by upgrading. If
you want to keep these changes, it is recommended that you stash them via "git
stash" or else commit the changes to a local branch. If it is okay to remove
local changes, then re-run this command with --force.

说我本地有改动,试试强制升级

flutter upgrade --force

再试试

flutter upgrade --force
Upgrading Flutter from /usr/local/flutter...
fatal: unable to access 'https://github.com/flutter/flutter.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

FQ酸酸撸 切全局再次执行

$ flutter upgrade --force
Upgrading Flutter from /usr/local/flutter...
From https://github.com/flutter/flutter
+ 0b8abb4724...f4abaa0735 stable -> origin/stable (forced update)
* [new branch] CaseyHillers-patch-1 -> origin/CaseyHillers-patch-1
* [new branch] Hixie-patch-1 -> origin/Hixie-patch-1
* [new branch] Hixie-patch-2 -> origin/Hixie-patch-2
...
很多内容...
...
Flutter 2.2.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f4abaa0735 (7 days ago) • 2021-07-01 12:46:11 -0700
Engine • revision 241c87ad80
Tools • Dart 2.13.4

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.14.5 18F203 darwin-x64, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.1)
[✓] VS Code (version 1.57.1)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

╔════════════════════════════════════════════════════════════════════════════╗
║ Welcome to Flutter! - https://flutter.dev ║
║ ║
║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
║ statistics and basic crash reports. This data is used to help improve ║
║ Flutter tools over time. ║
║ ║
║ Flutter tool analytics are not sent on the very first run. To disable ║
║ reporting, type 'flutter config --no-analytics'. To display the current ║
║ setting, type 'flutter config'. If you opt out of analytics, an opt-out ║
║ event will be sent, and then no further information will be sent by the ║
║ Flutter tool. ║
║ ║
║ By downloading the Flutter SDK, you agree to the Google Terms of Service. ║
║ Note: The Google Privacy Policy describes how data is handled in this ║
║ service. ║
║ ║
║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and ║
║ crash reports to Google. ║
║ ║
║ Read about data we send with crash reports: ║
║ https://flutter.dev/docs/reference/crash-reporting ║
║ ║
║ See Google's privacy policy: ║
║ https://policies.google.com/privacy ║
╚════════════════════════════════════════════════════════════════════════════╝

额,终于成功。

参考文献

Upgrading Flutter

Flutter SDK releases

升级你的 Flutter 版本