Flutterでアプリ開発 (Netflix風) その2

2024年8月8日

前回からの続きでXcodeのシミュレータを立ち上げた状態で開発したい

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.16.9, on macOS 12.7.1 21G920 darwin-x64, locale ja-JP)
    ! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/3.4.4/libexec/bin/dart, which
      is not inside your current Flutter SDK checkout at /Users/TeruyaShuta/flutter. Consider adding
      /Users/TeruyaShuta/flutter/bin to the front of your path.
⢿     �[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to
        your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.

CocoaPodsがインストールされていないようです..

$ brew install cocoapods
==> Auto-updating Homebrew...

完了

続いて以下を実施

$ pod setup
Setup completed
$ flutter doctor
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)

OK!

iOSのシミュレータで実施するために以下のコマンド

$ open -a Simulator

立ち上がった!

$ flutter devices
Found 3 connected devices:
  iPhone 14 Pro Max (mobile) • EB33A5**********0C643 • ios            •
  com.apple.CoreSimulator.SimRuntime.iOS-16-2 (simulator)
  macOS (desktop)            • macos                                • darwin-x64     • macOS 12.7.1
  21G920 darwin-x64
  Chrome (web)               • chrome                               • web-javascript • Google Chrome
  126.0.6478.127

お、、これはいい感じだ

$ fvm flutter run

Launching lib/main.dart on iPhone 14 Pro Max in debug mode...
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Running Xcode build...
 └─Compiling, linking and signing...                        82.5s
Xcode build done.                                           119.5s
Syncing files to device iPhone 14 Pro Max...                     1,180ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on iPhone 14 Pro Max is available at: http://127.0.0.1:50643/0EmXenX7KBQ=/
The Flutter DevTools debugger and profiler on iPhone 14 Pro Max is available at:
http://127.0.0.1:9101?uri=http://127.0.0.1:50643/0EmXenX7KBQ=/

Performing hot reload...
Reloaded 0 libraries in 370ms (compile: 55 ms, reload: 3 ms, reassemble: 210 ms).