Mac上搭建Flutter环境

安装FlutterSDK

//我使用git的方式克隆flutterSDK 方便以后更新
flutter sdk git 地址:
https://github.com/flutter/flutter.git
//切换到稳定版分支
git checkout stable

将flutter工具添加到环境变量

export PATH="$PATH:/Users/yinshuai/Work/DevelopLibrary/flutter/bin"

设置永久生效
//打开环境变量配置文件
sudo open ~/.bash_profile
//在文件中添加
export PATH="$PATH:/Users/yinshuai/Work/DevelopLibrary/flutter/bin"
//刷新当前窗口环境
source ~/.bash_profile

预下载开发二进制文件(可选)

flutter precache

查看环境依赖是否已经全部安装

flutter doctor

使用国内镜像源

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

//最新地址访问:
https://flutter.dev/community/china

IDEA 或者 AndroidStudio 安装插件

  • flutter插件
  • dart插件
  • json2Dart插件

Copyright: 采用 知识共享署名4.0 国际许可协议进行许可

Links: https://blog.ooimi.com/archives/mac上搭建flutter环境