flutter环境安装

1.VSCode
https://code.visualstudio.com/
设置中文
Command + Shift + P
Configure Display Language
选择 add 其他语言,选择中文插件。 安装完,再来一次Command + Shift + P ,Configure Display Language,选择ZN

2.安装Flutter

2.1下载最新安装包:
// ~/Documents/GitHub/Tool 替换你的安装目录
git clone -b stable https://github.com/flutter/flutter.git
2.2添加一下环境变量
由于在国内访问Flutter有时可能会受到限制,Flutter官方为中国开发者搭建了临时镜像:

open ~/.bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=~/Documents/GitHub/Tool/flutter/bin:$PATH //这里前面是自定义界面
source ~/.bash_profile

open -e ~/.zshrc
source ~/.bash_profile
source ~/.zshrc

2.3安装相关依赖
flutter doctor
2.3.1 android SDK 搞不定又不能翻墙。
请下载android studio。 可以下载SDK
2.3.2 androidstudio 设置plugin 安装flutter
https://developer.android.google.cn/studio/

✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
#and

参考:

https://flutterchina.club/

3.创建flutter工程
vscode
查看——命令面板,或者Ctrl + Shift + P
输入 Flutter: New Project

4.json 转model
https://caijinglong.github.io/json2dart/index.html
手工写model, 每个model 属性加上? 。然后再通过

序列化

json_serializable: ^6.0.1
json_annotation: ^4.3.0
build_runner: ^2.1.4
生成 model.g.dart文件

你可能感兴趣的:(flutter环境安装)