搭建Flutter开发环境需要注意的几个小Tips

下载SDK

放到指定目录,配置环境变量
具体步骤结合自己电脑参考flutter中文网

安装

Android Stdio + SDK + tool SDK + 创建模拟器 + 插件(flutter和dart)

下载Android Stdio网上很多资源,我推荐这个网站,资源比较集中

~/.zshrc或者~/.bash_profile配置环境变量

# android sdk
export ANDROID_HOME="/Users/wangguibin/Library/Android/sdk" 
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools

由于大陆有墙,可在/etc/hosts文件中加入以下镜像或者代理,下载Android SDK顺畅无比
(PS. 当前时间2020年2月19日,亲测可用!)

# Android Start
119.28.87.227	android.com

119.28.87.227	www.android.com

119.28.87.227	a.android.com

119.28.87.227	connectivitycheck.android.com

119.28.87.227	d.android.com

119.28.87.227	dev.android.com

119.28.87.227	developer.android.com

119.28.87.227	market.android.com

119.28.87.227	r.android.com

119.28.87.227	source.android.com

119.28.87.227	android-china.l.google.com

119.28.87.227	android.clients.google.com

119.28.87.227	android-market.l.google.com

119.28.87.227	android.l.google.com

119.28.87.227	android.googleblog.com

119.28.87.227	androidstudio.googleblog.com

119.28.87.227	android-developers.googleblog.com

119.28.87.227	android-developers.blogspot.com

119.28.87.227	android-developers.blogspot.hk

119.28.87.227	officialandroid.blogspot.com

119.28.87.227	android.googlecode.com

119.28.87.227	android.googlesource.com

119.28.87.227	android-review.googlesource.com

119.28.87.227	androidmarket.googleusercontent.com

119.28.87.227	android.googleapis.com

119.28.87.227	jmoore-dot-android-experiments.appspot.com

119.28.87.227	b.android.com

64.233.188.121	m.android.com

64.233.188.121	tools.android.com

64.233.191.121	jmoore-dot-android-experiments.appspot.com

64.233.191.121	maven.google.com
# Android End

Xcode + cocoapods

XcodeApp Store或者开发者中心下载即可

Cocoapods安装

sudo gem install cocoapods

flutter doctor 检测环境是否可行
flutter doctor --android-licenses 安卓验证SDK

VSCode + Flutter开发必备辅助插件

  • Flutter语法及调试插件
  • Dart 语法插件
  • Awesome Flutter Snippets 代码块
  • Flutter Widget Snippets 组件代码块
  • Bracket Pair Colorizer 彩虹🌈括号
  • Flutter Stylizer API使用提示
  • Material Icon Theme 图标主题
  • TODO-HIGHLIGHT代码标记注释
  • TODO-tree方便查找标记的代码
  • Better Comments划重点的注释
  • dart-import自动导入目录(建议自己写相对目录好些)
  • Image preview图片图标预览

VSCode自定义的一些配置

{
    "[dart]": {
        "editor.formatOnSave": true,
        "editor.formatOnType": true,
        "editor.rulers": [
            180
        ],
        "editor.selectionHighlight": false,
        "editor.suggest.snippetsPreventQuickSuggestions": false,
        "editor.suggestSelection": "first",
        "editor.tabCompletion": "onlySnippets",
        "editor.wordBasedSuggestions": false
    },
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "editor.snippetSuggestions": "top",
    "editor.fontSize": 18,
    "workbench.iconTheme": "material-icon-theme",
    "dart.debugExternalLibraries": false,
    "dart.debugSdkLibraries": false,
    "dart.enableCompletionCommitCharacters": true,
    "dart.flutterHotRestartOnSave": true,
    "dart.lineLength": 80,
    "dart.previewFlutterUiGuides": true,
    "dart.triggerSignatureHelpAutomatically": true,
    "terminal.integrated.shell.osx": "/bin/zsh",
    "editor.formatOnSave": true,
    "editor.wordWrap": "on",
    "window.newWindowDimensions": "inherit",
    "window.openFilesInNewWindow": "default",
    "todo-tree.tree.showScanModeButton": false,
    "C_Cpp.updateChannel": "Insiders",
    "workbench.editor.enablePreview": false,
}
posted @ 2020-03-06 13:38  CoderWGB  阅读(842)  评论(0编辑  收藏  举报