👻

Flutterでありますまいか

2021/01/11に公開

なんでこんなことやってるのかは2021年、業務アプリ開発歴17年が初めてFlutter Firebase Dartを触りたくなった話 参照、Win10 の私の庭でその後の進捗報告。

Flutterに入門してクソアプリを作るまで
https://flutter.dev/docs/get-started/install/windows に倣い落としてきたものを設定。

set path=%path%;C:\src\flutter\bin;
flutter doctor がともかく色々チェックするコマンドらしい

C:\src>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19041.450], locale ja-JP)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio (version 4.1.0)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.1)
    X Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

すると何やら怒られた。プラグインが入れられないようなので予め入れられていたAndroid studioの画面の方から入れることにする。
Windows の場合は、File > Settings > Plugins

image.png

Android studioを再起動。
image.png

flutter plugin not installed this adds flutter specific functionality.
android studio 4.1 windows
https://stackoverflow.com/questions/64369971/android-studio-dart-and-flutter-plugin-is-not-installed

Flutter create command was unsuccessful と言われてしまったが、コマンドライン上から
flutter create my_app で成功。

Android Studio から my_app を開く。
image.png

さらにNo devices available 等と言われる…

C:\src>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, 1.26.0-1.0.pre, on Microsoft Windows [Version 10.0.19041.450], locale ja-JP)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.52.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

C:\src>flutter devices
No devices detected.

Run "flutter emulators" to list and start any available device emulators.

If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try
increasing the time to wait for connected devices with the --device-timeout flag. Visit https://flutter.dev/setup/ for
troubleshooting tips.

emulatorは入ってるんだけどなと思いつつ対応...たしかにここまでStackoverflowが色々頼りだ。

C:\src>flutter emulators
1 available emulator:

Pixel_3a_API_30_x86 • Pixel_3a_API_30_x86 • Google • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager

C:\src>flutter emulators --launch Pixel_3a_API_30_x86

多少外見を書き換えて、emulatorをローンチ。

image.png

my_app階層で flutter run をしたところようやくボタン押下回数をカウントするだけのプログラムにたどり着いた!

Discussion