1.VSCode
https://code.visualstudio.com/
設(shè)置中文
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添加一下環(huán)境變量
由于在國內(nèi)訪問Flutter有時(shí)可能會(huì)受到限制蛙奖,F(xiàn)lutter官方為中國開發(fā)者搭建了臨時(shí)鏡像:
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安裝相關(guān)依賴
flutter doctor
2.3.1 android SDK 搞不定又不能翻墻。
請(qǐng)下載android studio杆兵。 可以下載SDK
2.3.2 androidstudio 設(shè)置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
參考:
3.創(chuàng)建flutter工程
vscode
查看——命令面板雁仲,或者Ctrl + Shift + P
輸入 Flutter: New Project
4.json 轉(zhuǎn)model
https://caijinglong.github.io/json2dart/index.html
手工寫model, 每個(gè)model 屬性加上琐脏? 攒砖。然后再通過
序列化
json_serializable: ^6.0.1
json_annotation: ^4.3.0
build_runner: ^2.1.4
生成 model.g.dart文件