2023-Flutter環(huán)境配置

官方開(kāi)發(fā)文檔地址

官方開(kāi)發(fā)文檔地址

Flutter下載包地址

下載包git地址

配置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)日志如下

![環(huán)境檢查如下](https://upload-images.jianshu.io/upload_images/1416781-f1797dbb30e71ace.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

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程序了

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末弹砚,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子刹孔,更是在濱河造成了極大的恐慌,老刑警劉巖娜睛,帶你破解...
    沈念sama閱讀 221,820評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件髓霞,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡畦戒,警方通過(guò)查閱死者的電腦和手機(jī)方库,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,648評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門(mén),熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)障斋,“玉大人纵潦,你說(shuō)我怎么就攤上這事±罚” “怎么了邀层?”我有些...
    開(kāi)封第一講書(shū)人閱讀 168,324評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)遂庄。 經(jīng)常有香客問(wèn)我寥院,道長(zhǎng),這世上最難降的妖魔是什么涧团? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 59,714評(píng)論 1 297
  • 正文 為了忘掉前任只磷,我火速辦了婚禮,結(jié)果婚禮上泌绣,老公的妹妹穿的比我還像新娘钮追。我一直安慰自己,他們只是感情好阿迈,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,724評(píng)論 6 397
  • 文/花漫 我一把揭開(kāi)白布元媚。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪刊棕。 梳的紋絲不亂的頭發(fā)上炭晒,一...
    開(kāi)封第一講書(shū)人閱讀 52,328評(píng)論 1 310
  • 那天,我揣著相機(jī)與錄音甥角,去河邊找鬼网严。 笑死,一個(gè)胖子當(dāng)著我的面吹牛嗤无,可吹牛的內(nèi)容都是我干的震束。 我是一名探鬼主播,決...
    沈念sama閱讀 40,897評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼当犯,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼垢村!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起嚎卫,我...
    開(kāi)封第一講書(shū)人閱讀 39,804評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤嘉栓,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后拓诸,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體侵佃,經(jīng)...
    沈念sama閱讀 46,345評(píng)論 1 318
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,431評(píng)論 3 340
  • 正文 我和宋清朗相戀三年奠支,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了趣钱。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,561評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡胚宦,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出燕垃,到底是詐尸還是另有隱情枢劝,我是刑警寧澤,帶...
    沈念sama閱讀 36,238評(píng)論 5 350
  • 正文 年R本政府宣布卜壕,位于F島的核電站您旁,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏轴捎。R本人自食惡果不足惜鹤盒,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,928評(píng)論 3 334
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望侦副。 院中可真熱鬧侦锯,春花似錦、人聲如沸秦驯。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 32,417評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至亲桥,卻和暖如春洛心,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背题篷。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,528評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工词身, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人番枚。 一個(gè)月前我還...
    沈念sama閱讀 48,983評(píng)論 3 376
  • 正文 我出身青樓法严,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親户辫。 傳聞我的和親對(duì)象是個(gè)殘疾皇子渐夸,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,573評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容