Flutter常用指令

查看flutter安装目录:
which flutter

查看当前Flutter版本:
flutter --version

检测Flutter安装信息:
flutter doctor

更新Flutter到最新的兼容版本:
flutter upgrade

查看你当前使用的哪个渠道:
flutter channel

注:Flutter 有 3 个发布渠道,分别是 stable、beta 和 master,我们推荐使用 stable 渠道。

切换到指定的发布渠道(如stable),然后再升级【下载 Flutter SDK 和依赖的 packages】:
flutter channel stable
flutter upgrade

判断那些过时了的 package 依赖以及获取更新建议:
flutter pub outdated

将pubspec.yaml 文件里列出的所有依赖更新到最新的兼容版本:
flutter pub upgrade

升级到指定版本:
flutter upgrade v2.2.3

回退到指定版本:
flutter downgrade v2.0.3

构建命令:
flutter build

删除构建/目录,重新创建flutter项目:
flutter clean
flutter create .

在设备上运行Flutter应用程序:
flutter run 

=========================================================================

安装fvm:
brew tap leoafarias/fvm
brew install fvm

执行指令的过程中可能会报的异常:

1、It looks like pub.dartlang.org is having some trouble...

解决方案:一般是网络问题,想办法文明上网即可【参考:Android关于VPN上网那点事】。

2、Deletion failed, path = '/private/tmp/pub_bjKlKe' (OS Error: Too many open files, errno = 24)

解决方案:执行如下指令后,再重新执行原指令即可:

ulimit -n 2048
 

你可能感兴趣的:(Flutter,flutter,android,ios)