下载FlutterSDK:
https://flutter.dev/docs/get-started/install/macos
配置环境变量:vim ~/.zshrc
flutter
1.export FLUTTER_STORAGE_BASE_URL=http://flutter-storage.alibaba-inc.com/taobao
2.#export PUB_HOSTED_URL=http://pub.alibaba-inc.com
3.export FLUTER_HOME=/Users/pangzhi/flutter/flutter
4.export PATH=PATH
dart
1.export DART_HOME=$FLUTER_HOME/bin/cache/dart-sdk/bin
2.export PATH=PATH
几个环境变量文件的关系
https://www.cnblogs.com/jiaxiaoai/archive/2011/05/22/2053738.html
先系统目录(所有用户):/etc/profile,后用户目录,顺序为:/.bash_profile(启动时执行一次)、/.bash_login、~/.profile
执行顺序为:/etc/profile -> (~/.bash_profile | ~/.bash_login | ~/.profile) -> ~/.bashrc -> /etc/bashrc -> ~/.bash_logout
一般我们会在~/.bash_profile中设置环境变量,重启shell后生效
如果装了zsh的shell,要查看/.zshrc以及/.zsh_profile
现在都配置在了~/.zshrc 这个文件里了,重启后生效
查看环境变量:echo $PATH
更新环境变量source ~/.bash_profile
通过VSCode编写dart
这个文章不错:https://www.jianshu.com/p/60dcb6e0c2ce
环境变量必须在/.bash_profile中设置,之前在/.zshrc中设置,结果VSCode找不到,一直不通过
更新环境变量source ~/.bash_profile
安装四个插件Dart、dart-import、Dart (Syntax Highlighting Only)、Flutter
万能窗口:shift+command+p