Flutter 环境搭建
1.操作系统
- macOS
2.安装Homebrew
-
终端执行以下命令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3.安装Flutter SDK
- Flutter SDK地址:https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
- 配置flutter 的环境变量 和镜像
# Android Configuration export ANDROID_HOME=/Users/qxw7463/Library/Android/sdk PATH=$PATH:$ANDROID_HOME/build-tools PATH=$PATH:$ANDROID_HOME/platform-tools PATH=$PATH:$ANDROID_HOME/tools PATH=$PATH:$ANDROID_HOME/tools/bin/ # Flutter export FLUTTER_HOME=/Users/qxw7463/flutter PATH=$PATH:$FLUTTER_HOME/bin:$PATH # Flutter mirror pub export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # Dart (as part of Flutter) export DART_HOME=/Users/qxw7463/flutter/bin/cache/dart-sdk PATH=$PATH:$DART_HOME/bin:$PATH PATH=$PATH:/Users/qxw7463/.pub-cache/bin:$PATH
4.配置iOS 环境
- Appstore 下载 Xcode 11.2
- Mac self service -> Develop -> Xcode 11.2
- 下载链接: https://download.developer.apple.com/Developer_Tools/Xcode_11.2.1/Xcode_11.2.1.xip
5.配置Android 环境
- 下载安装
官网地址: https://developer.android.google.cn/studio - 命令行安装
- step1 安装 Java8
- step2 brew cask install android-studio
- step3 brew cask install android-sdk
6.VS code 安装
- 下载安装
官网地址:https://code.visualstudio.com/ - 命令行
brew cask install visual-studio
7.执行 flutter doctor 检测安装是否完成
➜ mobile-docs git:(onboarding) ✗ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.9.6, on Mac OS X 10.13.6 17G65, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices
[✓] Android Studio (version 3.3)
[✓] VS Code (version 1.30.2)
[!] Connected device
8.开发工具的选择
在学习Dart语言的时候、可选择 VSCode 比较轻量级
在学习flutter过程中、可选择Android Studio、因为各种集成使用起来比较方便,尤其是做插件开发
VS code 插件
- Awesome Flutter Snippets
- bloc
- Bloc Code Generator
- Bracket Pair Colorizer
- vscode-icons
- Rainbow Brackets
- Dart
- Flutter
- Chinese (Simplified) Language Pack for Visual Studio Code
Android studio
- Bloc Code Generator
- Dart
- Flutter
9.Windows 安装
参考:https://flutterchina.club/setup-windows/
10.其它学习资料链接
flutter: https://flutter.dev/docs
flutter china: https://flutterchina.club/setup-macos/
flutter API reference : https://api.flutter.dev/objcdoc/index.html
bloc: https://bloclibrary.dev/#/gettingstarted
tool: https://javiercbk.github.io/json_to_dart/
pub: https://pub.dev/
dart reference: https://api.dartlang.org/stable/2.0.0/dart-core/List-class.html
flutter go: https://github.com/alibaba/flutter-go