先下载FlutterSDK:
下载地址: https://flutter.dev/docs/get-started/install/macos
简单步骤如下:
1、进入到根目录下;
cd ~
2、找到.bash_profile文件,此命令会显示全部文件
ls -al
3、显示隐藏文件,通常情况下.bash_profile是隐藏的
shift+command+.
找到.bash_profile
4、编辑.bash_profile文件
Vim .bash_profile
5、选择E进行编辑,添加以下配置,其中/Users/wululu/Documents/flutter代表Flutter的SDK的路径
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/wululu/Documents/flutter/bin:$PATH
export PATH=/Users/wululu/Documents/flutter/bin/cache/dart-sdk/bin:$PATH
添加环境变量和开发环境
6、编辑后:wq退出,然后执行source ~/.bash_profile
完成
补充:
执行命令:flutter channel 显示当前flutter所在的分支
Flutter channels:
master
dev
beta
- stable
运行flutter channel dev可以切换至开发版,此时再运行flutter upgrade或者flutter upgrade --force即可进行更新
网友评论