一,查看当前flutter和dart的版本:
说明:我们当前的channel是master,所以可以看到flutter和dart版本均为pre或dev版本:liuhongdi@liuhongdideMacBook-Pro ~ % flutter --version Flutter 3.7.0-27.0.pre.25 • channel master • https://github.com/flutter/flutter.git Framework • revision c9affdba9d (7 hours ago) • 2023-01-25 21:25:02 -0800 Engine • revision 8f1e5dc1b1 Tools • Dart 3.0.0 (build 3.0.0-157.0.dev) • DevTools 2.20.1
liuhongdi@liuhongdideMacBook-Pro ~ % dart --version Dart SDK version: 3.0.0-157.0.dev (dev) (Mon Jan 23 20:06:50 2023 -0800) on “macos_x64"
说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
或: https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: [email protected]
二,查看flutter当前的channel
liuhongdi@liuhongdideMacBook-Pro ~ % flutter channel Flutter channels: * master main beta stable
可以看到当前的channel是master,我们把它切换为stable,
这样可以保障库的稳定性
三,设置当前channel,切换到stable
liuhongdi@liuhongdideMacBook-Pro ~ % flutter channel stable Switching to flutter channel 'stable'... git: Switched to a new branch 'stable' git: Branch 'stable' set up to track remote branch 'stable' from 'origin'. Successfully switched to flutter channel 'stable'. To ensure that you're on the latest build from this channel, run 'flutter upgrade’
四,再次使用flutter channel命令时,会开始下载
1,查看当前的channelliuhongdi@liuhongdideMacBook-Pro ~ % flutter channel Downloading Darwin x64 Dart SDK from Flutter engine b24591ed328a2d4ce6505819e2f5898a78132f7f… … Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source! Downloading package sky_engine... 1,206ms Downloading flutter_patched_sdk tools... 1,096ms Downloading flutter_patched_sdk_product tools... 1,232ms Downloading darwin-x64 tools... 8.5s Downloading darwin-x64/font-subset tools... 618ms Flutter channels: master main beta * stable再次更新flutter
liuhongdi@liuhongdideMacBook-Pro ~ % flutter upgrade Flutter is already up to date on channel stable Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision b06b8b2710 (3 days ago) • 2023-01-23 16:55:55 -0800 Engine • revision b24591ed32 Tools • Dart 2.19.0 • DevTools 2.20.1
可以看到flutter并未进行下载操作,因为执行flutter channel时就已做了更新,
更新是为把版本切换到stable channel下的新版本
五,查看切换channel后的版本
liuhongdi@liuhongdideMacBook-Pro ~ % flutter --version Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision b06b8b2710 (3 days ago) • 2023-01-23 16:55:55 -0800 Engine • revision b24591ed32 Tools • Dart 2.19.0 • DevTools 2.20.1 liuhongdi@liuhongdideMacBook-Pro ~ % dart --version Dart SDK version: 2.19.0 (stable) (Mon Jan 23 11:29:09 2023 -0800) on "macos_x64"
可以看到在stable channel,不管是dart还是flutter都已切换至稳定的版本,不再是pre或dev版本
标签:liuhongdi,Pro,master,stable,liuhongdideMacBook,flutter,channel From: https://www.cnblogs.com/architectforest/p/17070837.html