Flutter环境搭建

Mac (VS Code)

1.下载flutter SDK(推荐下载stable版)

https://flutter.cn/docs/development/tools/sdk/releases?tab=macos
解压安装

cd ~/development
unzip ~/Downloads//flutter-column-master.zip

2.配置环境变量

.zshrc 或者 .bash_profile中添加以下路径
export PATH="$PATH:pwd/flutter/bin"

export PATH="$PATH:/user/development/flutter/bin"
export PATH="$PATH:/user/development/flutter/bin/cache/dart-sdk/bin"
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

3.VS Code中下载相应的flutter插件

插件.png

4.在配置代码格式化每行字符为150(重要)

setting.png

5.检查环境,运行flutter doctor。

如下即成功


success.png

Windows

1. 下载flutter SDK(web版下载2.0以上版本)

https://flutter.cn/docs/development/tools/sdk/releases?tab=windows
解压后的bin目录设置在path环境变量中,如G:\flutterSDK\flutter\bin
并设置AS中flutter SDK路径,File -> setting -> Language & Framework -> flutter -> flutter SDK path

2. Android studio安装Flutter插件

3. 设置官方镜像地址环境变量

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

4. 运行Flutter环境检查命令flutter doctor,会等待比较长时间

5. 同意licenses命令:flutter doctor --android-licenses

你可能感兴趣的:(Flutter环境搭建)