官方開(kāi)發(fā)文檔地址
Flutter下載包地址
配置FlutterSDK
1:解壓壓縮包,以我個(gè)人配置為例盹舞,放到文稿
中,并且創(chuàng)建一個(gè)文件夾flutterSDK
,且把解壓后的文件放入該文件夾中。
配置FlutterSDK.png
2:配置環(huán)境變量
以zsh
為例(iTerm2)
以`zsh`為例.png
配置環(huán)境變量代碼如下
配置環(huán)境變量代碼.png
#flutter 鏡像地址
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
#flutter 環(huán)境變量
export FLUTTER_PATH=/Users/zzg/Documents/flutterSDK
export PATH=$PATH:$FLUTTER_PATH/bin
export PATH=$PATH:$FLUTTER_PATH/bin/cache/dart-sdk/bin
執(zhí)行生效
命令:
source ~/.zshrc
這個(gè)時(shí)候應(yīng)該能運(yùn)行flutter命令了缕贡,我們運(yùn)行命令行:
flutter -h
執(zhí)行完命令后出現(xiàn)如下日志
Manage your Flutter app development.
Common commands:
flutter create <output directory>
Create a new Flutter project in the specified directory.
flutter run [options]
Run your Flutter application on an attached device or in an emulator.
Usage: flutter <command> [arguments]
Global options:
-h, --help Print this usage information.
-v, --verbose Noisy logging, including all shell commands
executed.
If used with --help, shows hidden options.
-d, --device-id Target device id or name (prefixes allowed).
--version Reports the version of this tool.
--suppress-analytics Suppress analytics reporting when this command runs.
--bug-report Captures a bug report file to submit to the Flutter
team.
Contains local paths, device identifiers, and log
snippets.
--packages Path to your ".packages" file.
(required, since the current directory does not
contain a ".packages" file)
Available commands:
analyze Analyze the project's Dart code.
attach Attach to a running application.
bash-completion Output command line shell completion setup scripts.
build Flutter build commands.
channel List or switch flutter channels.
clean Delete the build/ directory.
config Configure Flutter settings.
create Create a new Flutter project.
devices List all connected devices.
doctor Show information about the installed tooling.
drive Runs Flutter Driver tests for the current project.
emulators List, launch and create emulators.
format Format one or more dart files.
help Display help information for flutter.
install Install a Flutter app on an attached device.
logs Show log output for running Flutter apps.
make-host-app-editable Moves host apps from generated directories to
non-generated directories so that they can be edited
by developers.
packages Commands for managing Flutter packages.
precache Populates the Flutter tool's cache of binary
artifacts.
run Run your Flutter app on an attached device.
screenshot Take a screenshot from a connected device.
stop Stop your Flutter app on an attached device.
test Run Flutter unit tests for the current project.
trace Start and stop tracing for a running Flutter app.
upgrade Upgrade your copy of Flutter.
Run "flutter help <command>" for more information about a command.
Run "flutter help -v" for verbose help output, including less commonly used
options.
檢查環(huán)境
flutter doctor
出現(xiàn)日志如下

Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.1 17B1003, locale
zh-Hans-CN)
[?] Android toolchain - develop for Android devices
? Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.io/setup/#android-setup for detailed
instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME
to that location.
You may also want to add it to your PATH environment variable.
[!] iOS toolchain - develop for iOS devices (Xcode 9.2)
? libimobiledevice and ideviceinstaller are not installed. To install with
Brew, run:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
? ios-deploy not installed. To install with Brew:
brew install ios-deploy
[!] Android Studio (not installed)
[?] VS Code (version 1.31.1)
[?] Connected device (1 available)
! Doctor found issues in 3 categories.
3:配置VSCode
1:安裝flutter
安裝flutter.png
2:安裝dart
安裝dart.png
到這里就可以創(chuàng)建flutter程序了