【Flutter 學習筆記一】Mac OS 安裝 Flutter

前言

以前看了 Google 發佈的 Flutter ,一直沒有機會嘗試,最近須要作一個 App,因此讓我有機會嘗試一下。
React-Native 我用的比較熟,若是選擇用 RN ,個人工做很快就能完成,可是我仍是決定選擇 Flutter。android

在專欄中,我會記錄從零開始,開發出一個完整 App 的一些過程和筆記。
學習文檔我會參考 Flutter 官方文檔ios

若是中途棄坑,各位勿怪~git

好了,轉入正題,這篇記錄一下在 Mac OS 上安裝 Flutter 的一些過程github

安裝

安裝很是簡單,就是把代碼 clone 下來,加入環境變量便可segmentfault

git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH

中國鏡像

因爲 flutter 有些命令須要聯網,因此爲了速度咱們須要加一個鏡像ide

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

環境檢查

在安裝完成以後,咱們運行 doctor 來檢查一下學習

flutter doctor

運行以後,咱們電腦輸入內容以下this

[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[!] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    ✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
        For more info, see https://flutter.io/platform-plugins
      To install:
        brew install cocoapods
        pod setup
[✓] Android Studio (version 3.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] Connected devices
    ! No devices available

! Doctor found issues in 3 categories.

[!] 這個符號的,都是須要咱們去解決的,解決方法也特別簡單,按照提示運行命令便可code

好比:orm

[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

咱們按照提示運行 flutter doctor --android-licenses 便可

好了,安裝仍是比較簡單的,固然你的電腦環境可能比較曲折😭

關於 Android SDK 和 Android Studio 等配置,可參考我發佈的另外一篇文章 https://segmentfault.com/a/11...

固然你們也能夠加羣一塊兒學習~ (826912082)

學習資源

1.官方文檔

2.中文文檔

相關文章
相關標籤/搜索