LoginSignup
1

More than 3 years have passed since last update.

今更ながらFlutter Desktopのexampleを動かす

Posted at

macOSで動かしたものを載せていますが、Linuxでも同様の手順で動かせると思います。

Flutter Desktopを使えるようにする環境変数を追加

環境変数ENABLE_FLUTTER_DESKTOPにtrueを設定する。

~/.bashrc
export ENABLE_FLUTTER_DESKTOP=true

再起動して反映。

$ exec $SHELL -l

デバイスにデスクトップが追加されたかの確認。

flutter devices

自分の場合は、下記のようにmacOSが表示されるようになりました。
flutter_devices.png

Flutter Desktopのexampleを取得

$ git clone https://github.com/google/flutter-desktop-embedding.git

デバイスを指定して実行

予めexample内に移動しておく。

$ cd flutter-desktop-embedding/example

各種依存ライブラリのインストール。

$ flutter pub get

デバイスを指定して実行。
* macOSの部分はOS毎に異なるのでmacOSでない方は変更が必要です。

$ flutter run -d macOS

flutter_desktop.gif

関連

参考

Flutter for Desktop: Create and Run a Desktop Application

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1