美文网首页
mac配置flutter

mac配置flutter

作者: guoguojianshu | 来源:发表于2021-08-25 22:24 被阅读0次

1.先下载flutter的sdk

git clone -b stable https://github.com/flutter/flutter.git

或者直接下载zip包,然后接压缩
2.配置环境变量

  • 打开** ~/.bash_profile**,时候报错

The file /Users/ruicong/.bash_profile does not exist.

  • 创建这个文件
sudo vi ~/.bash_profile

3.编辑~/.bash_profile这个文件,

export PATH=你文件所在目录的路径/flutter/bin:$PATH
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PUB_HOSTED_URL=https://pub.flutter-io.cn

4.更新环境变量

source ~/.bash_profile

5.执行flutter

flutter doctor

如果你终端是zsh,你还需要多一步

open ~/.zshrc
source ~/.bash_profile

在zshrc中添加,xxx代表你的电脑的用户名,这个路径就是flutter的文件存储位置

 #dart
export DART_HOME=/Users/xxx/flutter/bin/cache/dart-sdk/bin
export PATH="${DART_HOME}:${PATH}"

#flutter
export FLUTTER_HOME=/Users/xxxx/flutter/bin
export PATH="${FLUTTER_HOME}:${PATH}"

相关文章

网友评论

      本文标题:mac配置flutter

      本文链接:https://www.haomeiwen.com/subject/hkweiltx.html