プログラミング教務部

MacOSでFlutterを使ってデスクトップアプリを作成します。最終目標は時間割ソフトの作成。

FlutterSDKをインストール

初めまして、SAWAYAKAと申します。

このブログはFlutterの学習とデスクトップアプリの作成です。

モバイルアプリは一応考えていません。

 

では早速、開発環境のインストールを行います。

その前にSAWAYAKAの環境を紹介します。

macOS Catalina 10.15.7

MackBookAir2012

で開発しています。

 

まずはFlutterのダウンロードからです。リンクを貼ります。

Flutter - Build apps for any screen

もちろんmacOSを選択してダウンロードしました。

下のスクリーンショットを参考に、ホームに解凍しました。

 

f:id:sawayaka_e1:20220403164159j:plain

$ flutter --version

と入力すると以下のように出力されたはずです。

Flutter 2.10.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c860cba910 (9 days ago) • 2022-03-25 00:23:12 -0500
Engine • revision 57d3bac3dd
Tools • Dart 2.16.2 • DevTools 2.9.2

 

サイトを読み進み、次のコマンドを実行して、セットアップを完了するためにインストールする必要のある依存関係があるかどうかを確認します。

 

$ flutter doctor

 

Running "flutter pub get" in flutter_tools...                      10.5s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on Mac OS X 10.15.7 19H524 darwin-x64,
    locale ja-JP)
[✗] 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.dev/docs/get-started/install/macos#android-setup
      for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[!] Xcode - develop for iOS and macOS (Xcode 12.4)
    ! Flutter recommends a minimum Xcode version of 13.
      Download the latest version or update via the Mac App Store.
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with
        is different from the one being used to invoke it.
        This can usually be fixed by re-installing CocoaPods.
      To re-install see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at
    /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2019.1.1)
[✓] VS Code (version 1.65.2)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

! Doctor found issues in 4 categories.

 

Xcodeのバージョンが古いようなのですが、デスクトップアプリしか作らない予定なので今回はXcodeを入れずにプログラムを作成していきます。

以下のようにコマンドを入力してプロジェクトを作成します。

 

$ flutter create .

 

そして、ひとまず実行

 

$ flutter run

 

f:id:sawayaka_e1:20220403185646j:plain

ひとまず、実行できました。動作も問題なくFlutterの凄さを実感できました。

ソースコードはこれから研究しようと思います。