è¿æ³å ±åã«ãªãããå»å¹´æ«ããæ¬æ¥ä»äºã§IoTç³»ããã¸ã§ã¯ãã«é¢ãã£ã¦ããããæè¿ãããä¸æ®µè½ããããã®ä»äºã®ã¿ã¼ã²ããæ©ã¯ESP32ãæè¼ãã¦ããããå°çã¯ãã®ãã¡ã¼ã ã¦ã§ã¢ã®éçºãè¡ã£ããã¾ããAWSä¸ã§ç¨¼åããNestJSãã¼ã¹ã®Webã¢ããªã»ãµã¼ãã¼ããã°ã©ã ã®æ¹é ãæä¼ã£ããããããã¡ãã§å¾ãæè¡ç¥è¦ãããã°è¨äºã«æ¸ãã¦ãããã¨æã£ã¦ããã
æ¬æ¥ã«å¾©å¸°ããåã®ä¸æ¨å¹´ããå»å¹´ååã¾ã§ï¼ã³ããç¦ã®æçæï¼ã¯ITéçºã¯å¯æ¥ã¨ãã¦ãã£ã¦ãããã主ã«é¢ãã£ã¦ããã®ã¯ã¹ããã¢ããªéçºã§ãã¬ã¼ã ã¯ã¼ã¯ï¼ããã°ã©ãã³ã°è¨èªï¼ã¯Flutterï¼Dartï¼ã使ã£ã¦ãããFlutterã好ãã§ä½¿ã£ã¦ããã®ã¯ãä¸ã¤ã®ããã°ã©ã ã³ã¼ãã§ãã¹ã¯ããããWebãã¹ããã¢ããªã®å
¨é¨ã«å¯¾å¿ã§ããããã ãã¢ãã³ãªãªãã¸ã§ã¯ãæåï¼å®£è¨åã®è¨èªãã©ãã¤ã ãç解ãæãã¦ï¼å°çã®å ´åã使ãããªãã¦ããèªä¿¡ã¬ãã«ã®ç¿å¾ã«ï¼ã¶æã ã£ãï¼ããã¾ã§ãã¹ããã¢ããªéçºç¨ã®ãã¬ã¼ã ã¯ã¼ã¯ã»è¨èªã¨ãã¦Flutter/Dartããã¹ãã®é¸æã ã¨æã£ã¦ããã
ä¸å¹´è¿ããã©ã³ã¯ãã§ãã¦ãã¾ã£ãã®ã§ãåã¹ã¿ã¼ãã®ã¤ããã§æ¹ãã¦ã¹ããã¢ããªéçºã«åãçµã¿ãããã¯ãªã¼ã³ã¤ã³ã¹ãã¼ã«æ°èª¿ããMacã¨Ubuntuæ©ã«Flutterã«ããã¹ããã¢ããªéçºç°å¢ãæ§ç¯ããã®ã§ããã®ä½æ¥å
容ãè¨äºã«æ¸ãã¦ããã
å°çãFlutterã使ãå§ããã®é ã¯ãã§ã«SDKãã¼ã¸ã§ã³3.xã¯ãªãªã¼ã¹ããã¦ããããã¾ã 2.xã主æµã ã£ãããã¾ã¯3.xã主æµã«ãªã£ã¦ãããè²ã
ã¨å¤ãã£ã¦ãã¾ã£ã¦ããç¹ãããããã ã
Flutterã®ã¤ã³ã¹ãã¼ã«
Flutterï¼Flutter SDKï¼ã¯ç´ ã®ã¾ã¾ç´æ¥ã¤ã³ã¹ãã¼ã«ãããã¨ãã§ããããè¨èªãã¼ã¸ã§ã³ç®¡çãã¼ã«ãå©ç¨ããæ¹ãããã°ã©ã æ¯ã®ããã¸ã§ã¯ã管çãããæããªãã
Flutterç¨ã®ãã¼ã¸ã§ã³ç®¡çãã¼ã«ã¨ãã¦ãFVMï¼Flutter Version Managementï¼ã¾ãã¯asdfãåºã使ããã¦ããããã ã
fvm.app
asdf-vm.com
FVMã«ããFlutterã®ã¤ã³ã¹ãã¼ã«
FVMã®ã¤ã³ã¹ãã¼ã«
% brew tap leoafarias/fvm
% brew install fvm
$ curl -fsSL https://fvm.app/install.sh | bash
Flutterãã¼ã¸ã§ã³ã®ã¤ã³ã¹ãã¼ã«
% fvm releases
% fvm install 3.19.6
% fvm list
Cache directory: /Users/LOGNAME/fvm/versions
Directory Size: 73.02 MB
âââââââââââ¬ââââââââââ¬ââââââââââââââââââ¬âââââââââââââââ¬âââââââââââââââ¬âââââââââ
â Version â Channel â Flutter Version â Dart Version â Release Date â Global â
âââââââââââ¼ââââââââââ¼ââââââââââââââââââ¼âââââââââââââââ¼âââââââââââââââ¼âââââââââ¤
â 3.19.6 â â Need setup â â â â
âââââââââââ´ââââââââââ´ââââââââââââââââââ´âââââââââââââââ´âââââââââââââââ´âââââââââ
æ¬è¨äºå·çæç¹ã®Flutter SDKã®ææ°Stableçã¯3.19.6-stableãªã®ã§ãããã¤ã³ã¹ãã¼ã«ãã¦ããããä»»æã®ãã¼ã¸ã§ã³ãæå®ãã¦ã¤ã³ã¹ãã¼ã«ãããã¨ãã§ããã
ã°ãã¼ãã«ãªFlutterãã¼ã¸ã§ã³ã®è¨å®
ããã¸ã§ã¯ããã£ã¬ã¯ããªå¤ã§ãFlutter SDKã®ã³ãã³ããå©ç¨ã§ããããã«ãã°ãã¼ãã«ãªFlutterã®ãã¼ã¸ã§ã³ãè¨å®ãã¦ãããã¨ãè¦ããã
% fvm global 3.19.6
% cd
% fvm flutter --version
Flutter 3.19.6 ⢠channel stable ⢠https://github.com/flutter/flutter.git
Framework ⢠revision 54e66469a9 (2 weeks ago) ⢠2024-04-17 13:08:03 -0700
Engine ⢠revision c4cd48e186
Tools ⢠Dart 3.3.4 ⢠DevTools 2.31.1
asdfã«ããFlutterã®ã¤ã³ã¹ãã¼ã«
asdfã®ã¤ã³ã¹ãã¼ã«æé ã«ã¤ãã¦ã¯ä¸ã®è¨äºãåç
§ãã¦ã»ããã
blog.ketus-ix.work
Flutterãã¼ã¸ã§ã³ã®ã¤ã³ã¹ãã¼ã«
% asdf plugin add flutter
% asdf list all flutter
% asdf install flutter latest
% asdf reshim
% asdf list flutter
3.19.6-stable
ã³ãã³ã "asdf install flutter latest
" ã¯Fluter SDKã®ææ°Stableçãã¤ã³ã¹ãã¼ã«ããå ´åã ããä¸ã®ãããªã³ãã³ãã«ãã£ã¦æå®ãããã¼ã¸ã§ã³ãã¤ã³ã¹ãã¼ã«ãããã¨ãã§ããã
% asdf install flutter 3.16.8-stable
è£è¶³æ
å ±
Homebrewç°å¢ã®asdfã§Flutter 3.0以éãã¤ã³ã¹ãã¼ã«ãããããã¨ãä¸ã®ãããªã¨ã©ã¼ã«ãªããã¨ãããã
% asdf install flutter latest
/Users/LOGNAME/.asdf/plugins/flutter/bin/install: line 25: jq: command not found
/Users/LOGNAME/.asdf/plugins/flutter/bin/install: line 26: jq: command not found
/Users/LOGNAME/.asdf/plugins/flutter/bin/install: line 27: [: -gt: unary operator expected
Cannot find the download url for the version: 3.19.6-stable
ãã®å ´åã¯ãjq
ã¨ããããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããã¨è§£æ±ºã§ããã
% brew install jq
ã°ãã¼ãã«ãªFlutterãã¼ã¸ã§ã³ã®è¨å®
ããã¸ã§ã¯ããã£ã¬ã¯ããªå¤ã§ãFlutter SDKã®ã³ãã³ããå©ç¨ã§ããããã«ãã°ãã¼ãã«ãªFlutterã®ãã¼ã¸ã§ã³ãè¨å®ãã¦ãããã¨ãè¦ããã
% asdf global flutter 3.19.6-stable
% cd
% flutter --version
Flutter 3.19.6 ⢠channel stable ⢠https://github.com/flutter/flutter.git
Framework ⢠revision 54e66469a9 (2 weeks ago) ⢠2024-04-17 13:08:03 -0700
Engine ⢠revision c4cd48e186
Tools ⢠Dart 3.3.4 ⢠DevTools 2.31.1
å¿
è¦ãªãã¼ã«ã®ã¤ã³ã¹ãã¼ã«
Flutterã«ããWebã¢ããªã®åä½ç¢ºèªã«ä½¿ãããã®ã§ãGoogle Chromeãå¿
è¦ã¨ãªããGoogle Chromeã®å
¬å¼ãµã¤ãããå
¥æã§ããã
ä¸ã®ãããªã³ãã³ãã«ãã£ã¦ãHomebrewã使ã£ã¦Google Chromeãã¤ã³ã¹ãã¼ã«ãããã¨ãã§ããã
% brew install --cask google-chrome
ãªããChromeæ´¾çã®ä»ã®Webãã©ã¦ã¶ï¼Vivaldiãªã©ï¼ã使ã£ã¦ããå ´åã¯ãç°å¢å¤æ°CHROME_EXECUTABLE
ã«ãã®å®è¡ãã¡ã¤ã«ã®ãã¹ãæå®ãã¦ããã°ããã¡ãã使ãããã
Xcodeã®ã¤ã³ã¹ãã¼ã«
macOSãã¹ã¯ãããã»ã¢ããªã®éçºã¯Xcodeã使ããªãã¨ã§ããªããXcodeã¯iOSã¢ããªã«ã対å¿ãã¦ããã®ã§ãXcodeãã¤ã³ã¹ãã¼ã«ããã°ãã®ä¸¡æ¹ãéçºã§ããã
ææ°çã®Xcodeã¯App Storeããå
¥æã§ããããã ããææ°çXcodeã¯ã¤ã³ã¹ãã¼ã«å¯è½ãªmacOSã®ãã¼ã¸ã§ã³ããã®æç¹ã®ææ°çã«éå®ããã¦ããã
apps.apple.com
ææ°çããå¤ããã¼ã¸ã§ã³ã¯Apple Developerã®Xcodeå
¬å¼ãµã¤ãããå
¥æã§ããã
developer.apple.com
ãããã¯ãXcodesã¨ããã¦ã¼ãã£ãªãã£ã¢ããªã使ã£ã¦Xcodeãã¤ã³ã¹ãã¼ã«ãã¨ãã§ãããXcodesã«ã¤ãã¦ã¯ä¸ã®è¨äºãåç
§ãã¦ã»ããã
blog.ketus-ix.work
Xcodesã«ãã£ã¦Xcodeãã¤ã³ã¹ãã¼ã«ããå ´åã¯ãåã¢ããªã®ãã¡ã¤ã«å㯠/Applications/Xcode-VERSION.app
ã«ãªã£ã¦ãã¾ãã®ã§ã対象ãã¼ã¸ã§ã³ã®ã³ã³ããã¹ãã¡ãã¥ã¼ãã [Xcode.appã¨ãã¦ã·ã³ããªãã¯ãªã³ã¯ãä½æ] ãå®è¡ãã¦ããã¨è¯ãã ããã
Xcodeãã¤ã³ã¹ãã¼ã«ããããä¸ã®ã³ãã³ããå®è¡ãã¦ãããã¨ã
% sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Flutteréçºç°å¢ã®ç¶æ
確èª
Flutter SDKã«ã¯Flutteréçºç°å¢ã®ç¶æ
ã調ã¹ã¦ãããã³ãã³ãããããä¸ã®ã³ãã³ããããã ï¼FVMã使ã£ã¦ããå ´åã®ã³ãã³ã㯠"fvm flutter doctor
"ï¼ã
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[â] Flutter (Channel stable, 3.19.6, on macOS 12.7.4 21H1123 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 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.
[â] Chrome - develop for the web
[!] Android Studio (not installed)
[â] VS Code (version 1.89.0)
[â] Connected device (2 available)
[â] Network resources
! Doctor found issues in 3 categories.
ããã¾ã§ã®æé æä½ãæ¸ãã§ããã°ãå¤åä¸ã®ãããªè¡¨ç¤ºã«ãªãã ããã
åé¡ã¨ãã¦ææããã¦ãã "Android toolchain - Unable to locate Android SDK."ã"Android Studio (not installed)" ã¯Androidã¢ããªã®éçºã«å¿
è¦ãªã³ã³ãã¼ãã³ããªã®ã§ãFlutterã§Androidã¢ããªã®éçºãè¡ããªãå ´åã¯ç¡è¦ãã¦ãæ§ããªãã"Xcode - CocoaPods not installed." ã§ææããã¦ããCocoaPodsã¯iOSã¢ããªã®éçºã«å¿
è¦ãªãã®ã§ããã®ç¶æ
ã§ãmacOSãã¹ã¯ãããã»ã¢ããªã®éçºã¯è¡ãããFlutterã§iOSã¢ããªã®éçºãè¡ããªãå ´åã¯ãã®ææã¯ç¡è¦ãã¦ãæ§ããªãï¼ãããã®ã¤ã³ã¹ãã¼ã«æ¹æ³ã«ã¤ãã¦ã¯æ¬¡ã®è¨äºã§èª¬æããï¼ã
Flutterããã¸ã§ã¯ãã®ç°å¢æ§ç¯
æ°è¦ããã¸ã§ã¯ãã®ä½æ
FVMã使ã£ã¦ããå ´å
% mkdir flutter_project
% cd flutter_project
% fvm use 3.19.6
No pubspec.yaml detected in this directory
â Would you like to continue? · yes
[WARN] Project is not a git repository.
But will set .gitignore as IDEs may use it,to determine what to index and display on searches,
You should add the fvm version directory ".fvm/" to .gitignore.
â Would you like to do that now? · yes
â Added .fvm/ to .gitignore
â Could not resolve dependencies. (0.9s)
Expected to find project root in current working directory.
The error could indicate incompatible dependencies to the SDK.
â Would you like to continue pinning this version anyway? · yes
â Project now uses Flutter SDK : SDK Version : 3.19.6
% fvm flutter create .
Recreating project ....
pubspec.yaml (created)
README.md (created)
lib/main.dart (created)
test/widget_test.dart (created)
windows/runner/flutter_window.cpp (created)
windows/runner/utils.h (created)
windows/runner/utils.cpp (created)
windows/runner/runner.exe.manifest (created)
windows/runner/CMakeLists.txt (created)
windows/runner/win32_window.h (created)
windows/runner/Runner.rc (created)
windows/runner/win32_window.cpp (created)
windows/runner/resources/app_icon.ico (created)
windows/runner/main.cpp (created)
windows/runner/resource.h (created)
windows/runner/flutter_window.h (created)
windows/flutter/CMakeLists.txt (created)
windows/.gitignore (created)
windows/CMakeLists.txt (created)
ios/Runner.xcworkspace/contents.xcworkspacedata (created)
ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created)
ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (created)
ios/Runner/Info.plist (created)
ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected] (created)
ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md (created)
ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json (created)
ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected] (created)
ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected] (created)
ios/Runner/Base.lproj/LaunchScreen.storyboard (created)
ios/Runner/Base.lproj/Main.storyboard (created)
ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata (created)
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created)
ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings (created)
ios/Flutter/Debug.xcconfig (created)
ios/Flutter/Release.xcconfig (created)
ios/Flutter/AppFrameworkInfo.plist (created)
ios/.gitignore (created)
flutter_project.iml (created)
web/favicon.png (created)
web/index.html (created)
web/manifest.json (created)
web/icons/Icon-maskable-512.png (created)
web/icons/Icon-192.png (created)
web/icons/Icon-maskable-192.png (created)
web/icons/Icon-512.png (created)
macos/Runner.xcworkspace/contents.xcworkspacedata (created)
macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created)
macos/RunnerTests/RunnerTests.swift (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png (created)
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png (created)
macos/Runner/DebugProfile.entitlements (created)
macos/Runner/Base.lproj/MainMenu.xib (created)
macos/Runner/MainFlutterWindow.swift (created)
macos/Runner/Configs/Debug.xcconfig (created)
macos/Runner/Configs/Release.xcconfig (created)
macos/Runner/Configs/Warnings.xcconfig (created)
macos/Runner/Configs/AppInfo.xcconfig (created)
macos/Runner/AppDelegate.swift (created)
macos/Runner/Info.plist (created)
macos/Runner/Release.entitlements (created)
macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (created)
macos/Runner.xcodeproj/project.pbxproj (created)
macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme (created)
macos/Flutter/Flutter-Debug.xcconfig (created)
macos/Flutter/Flutter-Release.xcconfig (created)
macos/.gitignore (created)
android/app/src/profile/AndroidManifest.xml (created)
android/app/src/main/res/mipmap-mdpi/ic_launcher.png (created)
android/app/src/main/res/mipmap-hdpi/ic_launcher.png (created)
android/app/src/main/res/drawable/launch_background.xml (created)
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png (created)
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png (created)
android/app/src/main/res/values-night/styles.xml (created)
android/app/src/main/res/values/styles.xml (created)
android/app/src/main/res/drawable-v21/launch_background.xml (created)
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png (created)
android/app/src/main/AndroidManifest.xml (created)
android/app/src/debug/AndroidManifest.xml (created)
android/settings.gradle (created)
android/gradle/wrapper/gradle-wrapper.properties (created)
android/gradle.properties (created)
android/.gitignore (created)
android/app/build.gradle (created)
android/app/src/main/kotlin/com/example/flutter_project/MainActivity.kt (created)
android/build.gradle (created)
android/flutter_project_android.iml (created)
ios/RunnerTests/RunnerTests.swift (created)
ios/Runner/Runner-Bridging-Header.h (created)
ios/Runner/AppDelegate.swift (created)
ios/Runner.xcodeproj/project.pbxproj (created)
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme (created)
analysis_options.yaml (created)
.idea/runConfigurations/main_dart.xml (created)
.idea/libraries/Dart_SDK.xml (created)
.idea/libraries/KotlinJavaRuntime.xml (created)
.idea/modules.xml (created)
.idea/workspace.xml (created)
linux/main.cc (created)
linux/my_application.h (created)
linux/my_application.cc (created)
linux/flutter/CMakeLists.txt (created)
linux/.gitignore (created)
linux/CMakeLists.txt (created)
Resolving dependencies... (1.4s)
Got dependencies.
Wrote 128 files.
All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev
In order to run your application, type:
$ cd .
$ flutter run
Your application code is in ./lib/main.dart.
ã³ãã³ã "fvm use 3.19.6
" ã«ãã£ã¦ãæå®ãã¼ã¸ã§ã³ã®Flutter SDKãããã¸ã§ã¯ããã£ã¬ã¯ããªå
ã®.fvm
ãã£ã¬ã¯ããªã¸ã¤ã³ã¹ãã¼ã«ããããã¾ããã³ãã³ã "fvm flutter create .
" ã«ãã£ã¦ããã¸ã§ã¯ããã£ã¬ã¯ããªå
ã«pubspec.yaml
ãã¡ã¤ã«ãä½æãããããã¸ã§ã¯ãã®åºæ¬æ§æãã¡ã¤ã«ä¸å¼ï¼ãµã³ãã«ã½ã¼ã¹ããã«ãç¨ãã¡ã¤ã«ãªã©ï¼ã追å ãããã
è£è¶³æ
å ±
FVMã§ã¤ã³ã¹ãã¼ã«ããFlutterã使ç¨ããå ´åãFlutter SDKå´ã®ã³ãã³ãå®è¡ã¯ãã¹ã¦ "fvm flutter ...
" ã¨ããå½¢å¼ã«ãªã£ã¦ãã¾ãã
ä¸ã®ãããªè¨è¿°ã.bashrc
ã.zshrc
ã«è¿½å ãã¦ããã¨ã"fvm
" ãçç¥ã§ããã®ã§ä¾¿å©ã ããã
alias dart='fvm dart'
alias flutter='fvm flutter'
asdfã使ã£ã¦ããå ´å
% mkdir flutter_project
% cd flutter_project
% asdf local flutter 3.19.6-stable
% flutter --version
% flutter create .
æ¢åããã¸ã§ã¯ãã®ä½¿ç¨
æ¢åã®Flutterããã¸ã§ã¯ãã«ã¯pubspec.yaml
ã¨ãããã¡ã¤ã«ãå«ã¾ãã¦ãããããã«ããã¸ã§ã¯ããå©ç¨ãã¦ããFlutter SDKã®ããã±ã¼ã¸æ
å ±ãè¨è¼ããã¦ããã
FVMã使ã£ã¦ããå ´å
% cd FLUTTER_PROJECT_DIR
% fvm use 3.19.6
% fvm flutter --version
% fvm flutter pub get
asdfã使ã£ã¦ããå ´å
% cd FLUTTER_PROJECT_DIR
% asdf local flutter 3.19.6-stable
% flutter --version
% flutter pub get
"flutter pub get
" ã¯Flutterã®å
¬å¼ããã±ã¼ã¸é
å¸ãµã¤ãpub.devããããã±ã¼ã¸ãåå¾ããã³ãã³ãã§ããã®ã³ãã³ãã¯pubspec.yaml
ã®å
容ãåç
§ããªããããã¸ã§ã¯ãã®ãã¹ã¦ã®ä¾åããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããã
pub.dev
Flutterã«ããããã°ã©ã éçºãVisual Studio Codeã使ã£ã¦è¡ã£ã¦ãããiOS/Androidã¢ããªã®éçºã§ã¯XcodeãAndroid Studioãä½µç¨ãã¦ãããããããã¯ã¢ããªã®ãã«ãè¨å®ã®èª¿æ´ãã·ã¥ãã¬ã¼ã¿ãå®æ©ã¿ã¼ã²ããã§ã®ããã°ã©ã ã®ãããã°ã»åä½ç¢ºèªã®ç®çã«ãã使ã£ã¦ããªãã£ãã
VSCodeä¸ã§ã®Flutteréçºã®æºå
VSCodeã使ã£ã¦Flutterããã°ã©ã ã®éçºãè¡ãã«ããã£ã¦ã"Dart" 㨠"Flutter" ã¨ããï¼ã¤ã®æ¡å¼µæ©è½ãå
¥ãã¦ããã
ä»ã«ãFlutteréçºåãã®æ¡å¼µæ©è½ãå¨ãããæåã¯æä½éãã®ï¼ã¤ãå
¥ãã¦ããã°è¯ãã ããã
VSCodeã§ã®æ°è¦ããã¸ã§ã¯ãã®ä½æ
FVMã使ã£ã¦ããå ´å
VSCodeã®ã¡ãã¥ã¼ [Manage (管ç)]ï¼å·¦ä¸ã®æ¯è»ãã¼ã¯ï¼ > [Settings (è¨å®)] ã«ãã£ã¦è¨å®ç»é¢ãéããå·¦ä¸ã® [Open Settings (JSON)]ï¼æ¸é¡ãã¼ã¯ï¼ãã¿ã³ãæ¼ãã
ããã¨ãä¸ã®ãããªç»é¢ãéãã
ãã®ãã¡ã¤ã«ã®æ¢åã®å
容ã«ä¸ã®ãããªè¨è¿°ã追å ãã¦ãç·¨éå
容ãä¿åããã
/Users/LOGNAME/Application Support/Code/User/setttings.json
{
"workbench.colorCustomizations": {},
"telemetry.telemetryLevel": "off",
"editor.minimap.enabled": false,
- "workbench.startupEditor": "none"
+ "workbench.startupEditor": "none",
+ "dart.flutterSdkPath": "/Users/LOGNAME/fvm/versions/3.19.6"
}
â»"3.19.6
" ã®é¨åã¯ä½æããããã¸ã§ã¯ãã§ä½¿ç¨äºå®ã®ï¼FVMã§ã¤ã³ã¹ãã¼ã«æ¸ã¿ã®ï¼Flutter SDKã®ãã¼ã¸ã§ã³ã"LOGNAME
" ã¯ãã°ã¤ã³ã¦ã¼ã¶åã
ãã®å¾ãVSCodeãåèµ·åããããã³ãã³ããã¬ããã»ã¡ãã¥ã¼ "Developer: Reload Window" ãå®è¡ããã
VSCodeãåèµ·åããããã³ãã³ããã¬ããã«"Flutter
" ã¨å
¥åããã¡ãã¥ã¼ãã "Flutter: New Project" ãé¸æããã¨ãããã«ã¡ãã¥ã¼ã表示ãããã®ã§ããã®ã¡ãã¥ã¼ãã "Application"ãé¸ã¶ã
ããã¨ããã¡ã¤ã«é¸æãã¤ã¢ãã°ãéãã®ã§ãããã¸ã§ã¯ãã®ä¿åå ´æãé¸ãã§ãããæ°ããããã¸ã§ã¯ãã®ååãå
¥åããã
ä¸è¨ã®æé ã«å¾ã£ã¦VSCodeä¸ã§Flutterã®ããã¸ã§ã¯ããä½æããã¨ãããã¸ã§ã¯ããã£ã¬ã¯ããªãä½æããããã®ä¸ã«pubspec.yaml
ã¨ããã¸ã§ã¯ãã®åºæ¬æ§æãã¡ã¤ã«ä¸å¼ã追å ãããã
ç¶ãã¦ãã¡ãã¥ã¼ [Terminal (ã¿ã¼ããã«)] > [New Terminal (æ°ããã¿ã¼ããã«)] ã«ãã£ã¦ã¿ã¼ããã«ããã«ãéããä¸ã®ã³ãã³ããå®è¡ããã
% fvm use 3.19.6
â»"3.19.6
" ã®é¨åã¯æåã®settings.json
å
ã§æå®ãããã¼ã¸ã§ã³ã¨åä¸ã§ãããã¨ã
ããã«ãã£ã¦ãæå®ãã¼ã¸ã§ã³ã®Flutter SDKãããã¸ã§ã¯ããã£ã¬ã¯ããªå
ã®.fvm
ãã£ã¬ã¯ããªã¸ã¤ã³ã¹ãã¼ã«ãããåæã«ä¸ã®ãããªå
容㮠.vscode/settings.json
ãã¡ã¤ã«ãä½æãããã
{
"dart.flutterSdkPath": ".fvm/versions/3.19.6"
}
ãã®ãã¡ã¤ã«ã®å
容ãä¸ã®ããã«ç·¨éããä¸ã§ä¿åããã
{
- "dart.flutterSdkPath": ".fvm/versions/3.19.6"
+ "dart.flutterSdkPath": ".fvm/versions/3.19.6",
+ "search.exclude": {
+ "**/.fvm": true
+ },
+ "files.watcherExclude": {
+ "**/.fvm": true
+ }
}
ã¨ã¯ã¹ããã¼ã©ããã«å
ã®ãã¡ã¤ã« lib/main.dart
ãé¸æãã¦ããç¶æ
ã§å³ä¸ã¹ãã¼ã¿ã¹ãã¼ä¸ã® "{ }"ï¼"Dart" ã®å·¦æ¨ªï¼ãã¯ãªãã¯ãã¦ã表示ãããã¡ãã¥ã¼é
ç®ã« "3.19.6 - Flutter SDK"ï¼"3.19.6
" ã®é¨åã¯ä¸ã®ã³ãã³ã "fvm use VERSION
" ã®ãã¼ã¸ã§ã³æååã¨ä¸è´ï¼ãåå¨ãããã¨ã確èªãããåå¨ãã¦ããå ´åã¯ãåé
ç®å³æ¨ªã®ãã³ã»ãã¼ã¯ãæ¼ãã
ããã¨ãã¹ãã¼ã¿ã¹ãã¼ä¸ã«ãã®ãã¼ã¸ã§ã³çªå·ã表示ãããã
ãã®æå¾ã®æä½ã¯ãªãã·ã§ã³ã ããããã¸ã§ã¯ãã§ä½¿ç¨ãã¦ããFlutter SDKã®ãã¼ã¸ã§ã³ã常ã«è¡¨ç¤ºããã¦ããæ¹ãå¤ãæããªãã
asdfã使ã£ã¦ããå ´å
VSCodeã®ã¡ãã¥ã¼ [Manage (管ç)]ï¼å·¦ä¸ã®æ¯è»ãã¼ã¯ï¼ > [Settings (è¨å®)] ã«ãã£ã¦è¨å®ç»é¢ãéããå·¦ä¸ã® [Open Settings (JSON)]ï¼æ¸é¡ãã¼ã¯ï¼ãã¿ã³ãæ¼ããããã¨ã/Users/LOGNAME/Application Support/Code/User/setttings.json
ã¨ãããã¡ã¤ã«ãç»é¢ã«è¡¨ç¤ºãããã
ãã®ãã¡ã¤ã«ã®æ¢åã®å
容ã«ä¸ã®ãããªè¨è¿°ã追å ãã¦ãç·¨éå
容ãä¿åããã
/Users/LOGNAME/Application Support/Code/User/setttings.json
{
"workbench.colorCustomizations": {},
"telemetry.telemetryLevel": "off",
"editor.minimap.enabled": false,
- "workbench.startupEditor": "none"
+ "workbench.startupEditor": "none",
+ "dart.flutterSdkPath": "/Users/LOGNAME/.asdf/installs/flutter/3.19.6-stable"
}
â»"3.19.6-stable
" ã®é¨åã¯ä½æããããã¸ã§ã¯ãã§ä½¿ç¨äºå®ã®ï¼asdfã§ã¤ã³ã¹ãã¼ã«æ¸ã¿ã®ï¼Flutter SDKã®ãã¼ã¸ã§ã³ã"LOGNAME
" ã¯ãã°ã¤ã³ã¦ã¼ã¶åã
ãã®å¾ãVSCodeãåèµ·åããããã³ãã³ããã¬ããã»ã¡ãã¥ã¼ "Developer: Reload Window" ãå®è¡ããã
VSCodeãåèµ·åããããã³ãã³ããã¬ããã«"Flutter
" ã¨å
¥åããã¡ãã¥ã¼ãã "Flutter: New Project" ãé¸æããã¨ãããã«ã¡ãã¥ã¼ã表示ãããã®ã§ããã®ã¡ãã¥ã¼ãã "Application"ãé¸ã¶ã
ããã¨ããã¡ã¤ã«é¸æãã¤ã¢ãã°ãéãã®ã§ãããã¸ã§ã¯ãã®ä¿åå ´æãé¸ãã§ãããæ°ããããã¸ã§ã¯ãã®ååãå
¥åããã
ä¸è¨ã®æé ã«å¾ã£ã¦VSCodeä¸ã§Flutterã®ããã¸ã§ã¯ããä½æããã¨ãããã¸ã§ã¯ããã£ã¬ã¯ããªãä½æããããã®ä¸ã«pubspec.yaml
ã¨ããã¸ã§ã¯ãã®åºæ¬æ§æãã¡ã¤ã«ä¸å¼ã追å ãããã
ç¶ãã¦ãã¡ãã¥ã¼ [Terminal (ã¿ã¼ããã«)] > [New Terminal (æ°ããã¿ã¼ããã«)] ã«ãã£ã¦ã¿ã¼ããã«ããã«ãéããä¸ã®ã³ãã³ããå®è¡ããã
% asdf local flutter 3.19.6-stable
â»"3.19.6-stable
" ã®é¨åã¯æåã®settings.json
å
ã§æå®ãããã¼ã¸ã§ã³ã¨åä¸ã§ãããã¨ã
ããã«ãä¸ã®ãããªå
容㮠.vscode/settings.json
ãã¡ã¤ã«ãä½æããï¼æ¬ãã¡ã¤ã«ãåå¨ããªãå ´åã¯ãã³ãã³ããã¬ããã»ã¡ãã¥ã¼ "Prefereces: Open Workspace Settings (JSON)" ã«ãã£ã¦ä½æã§ããï¼ã
{
"dart.flutterSdkPath": "/Users/LOGNAME/.asdf/installs/flutter/3.19.6-stable"
}
â»"3.19.6-stable
" ã®é¨åã¯ããã¸ã§ã¯ãã§ä½¿ç¨ããFlutter SDKã®ãã¼ã¸ã§ã³ï¼ä¸ã®ã³ãã³ã "asdf local flutter VERSION
" ã§æå®ãããã¼ã¸ã§ã³æååï¼ã¨ä¸è´ãã¦ãããã¨ã"LOGNAME
" ã¯ãã°ã¤ã³ã¦ã¼ã¶åã
ã¨ã¯ã¹ããã¼ã©ããã«å
ã®ãã¡ã¤ã« lib/main.dart
ãé¸æãã¦ããç¶æ
ã§å³ä¸ã¹ãã¼ã¿ã¹ãã¼ä¸ã® "{ }"ï¼"Dart" ã®å·¦æ¨ªï¼ãã¯ãªãã¯ãã¦ã表示ãããã¡ãã¥ã¼é
ç®ã« "3.19.6 - Flutter SDK" ï¼"3.19.6
" ã®é¨åã¯ä¸ã®ã³ãã³ã "asdf local flutter VERSION
" ã®ãã¼ã¸ã§ã³çªå·ã¨ä¸è´ï¼ãåå¨ãããã¨ã確èªãããåå¨ãã¦ããå ´åã¯ãåé
ç®å³æ¨ªã®ãã³ã»ãã¼ã¯ãæ¼ããããã¨ãã¹ãã¼ã¿ã¹ãã¼ä¸ã«ãã®ãã¼ã¸ã§ã³çªå·ã表示ãããã
ãã®æå¾ã®æä½ã¯ãªãã·ã§ã³ã ããããã¸ã§ã¯ãã§ä½¿ç¨ãã¦ããFlutter SDKã®ãã¼ã¸ã§ã³ã常ã«è¡¨ç¤ºããã¦ããæ¹ãå¤ãæããªãã
VSCodeã§ã®æ¢åããã¸ã§ã¯ãã®ä½¿ç¨
FVMã使ã£ã¦ããå ´å
VSCodeãèµ·åãã¦ãæ¢åããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªãéãã
ã¡ãã¥ã¼ [Terminal (ã¿ã¼ããã«)] > [New Terminal (æ°ããã¿ã¼ããã«)] ã«ãã£ã¦ã¿ã¼ããã«ããã«ãéããä¸ã®ã³ãã³ããå®è¡ããã
% fvm use 3.19.6
â»"3.19.6
" ã®é¨åã¯ããã¸ã§ã¯ãã§ä½¿ç¨äºå®ã®ï¼FVMã§ã¤ã³ã¹ãã¼ã«æ¸ã¿ã®ï¼Flutter SDKã®ãã¼ã¸ã§ã³ã
ããã«ãã£ã¦ãæå®ãã¼ã¸ã§ã³ã®Flutter SDKãããã¸ã§ã¯ããã£ã¬ã¯ããªå
ã®.fvm
ãã£ã¬ã¯ããªã¸ã¤ã³ã¹ãã¼ã«ãããåæã«ä¸ã®ãããªå
容㮠.vscode/settings.json
ãã¡ã¤ã«ãä½æãããã
{
"dart.flutterSdkPath": ".fvm/versions/3.19.6"
}
.vscode/settings.json
ã®å
容ãä¸ã®ããã«ç·¨éããã
{
- "dart.flutterSdkPath": ".fvm/versions/3.19.6"
+ "dart.flutterSdkPath": ".fvm/versions/3.19.6",
+ "search.exclude": {
+ "**/.fvm": true
+ },
+ "files.watcherExclude": {
+ "**/.fvm": true
+ }
}
ã¨ã¯ã¹ããã¼ã©ããã«å
ã®ãã¡ã¤ã« lib/main.dart
ãé¸æãã¦ããç¶æ
ã§å³ä¸ã¹ãã¼ã¿ã¹ãã¼ä¸ã® "{ }"ï¼"Dart" ã®å·¦æ¨ªï¼ãã¯ãªãã¯ãã¦ã表示ãããã¡ãã¥ã¼é
ç®ã« "3.19.6 - Flutter SDK" ï¼"3.19.6
" ã¯ä¸ã®ã³ãã³ã "flutter use VERSION
" ã®ãã¼ã¸ã§ã³æååã¨ä¸è´ï¼ãåå¨ãããã¨ã確èªãããåå¨ãã¦ããå ´åã¯ãåé
ç®å³æ¨ªã®ãã³ã»ãã¼ã¯ãæ¼ããããã¨ãã¹ãã¼ã¿ã¹ãã¼ä¸ã«ãã®ãã¼ã¸ã§ã³çªå·ã表示ãããã
ãã®æä½ã¯ãªãã·ã§ã³ã ããããã¸ã§ã¯ãã§ä½¿ç¨ãã¦ããFlutter SDKã®ãã¼ã¸ã§ã³ã常ã«è¡¨ç¤ºããã¦ããæ¹ãå¤ãæããªãã
ã³ãã³ããã¬ããã§ã¡ãã¥ã¼ "Flutter: Get Packages" ãå®è¡ãããããã«ãã£ã¦ãããã¸ã§ã¯ãã®ãã¹ã¦ã®ä¾åããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãããã
asdfã使ã£ã¦ããå ´å
VSCodeãèµ·åãã¦ãæ¢åããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªãéãã
ã¡ãã¥ã¼ [Terminal (ã¿ã¼ããã«)] > [New Terminal (æ°ããã¿ã¼ããã«)] ã«ãã£ã¦ã¿ã¼ããã«ããã«ãéããä¸ã®ã³ãã³ããå®è¡ããã
% asdf local flutter 3.19.6-stable
â»"3.19.6-stable
" ã®é¨åã¯ããã¸ã§ã¯ãã§ä½¿ç¨äºå®ï¼asdfã§ã¤ã³ã¹ãã¼ã«æ¸ã¿ã®ï¼Flutter SDKã®ãã¼ã¸ã§ã³ã
ããã«ãä¸ã®ãããªå
容ã®ãã¡ã¤ã« .vscode/settings.json
ãä½æããï¼æ¬ãã¡ã¤ã«ãåå¨ããªãå ´åã¯ãã³ãã³ããã¬ããã»ã¡ãã¥ã¼ "Prefereces: Open Workspace Settings (JSON)" ã«ãã£ã¦ä½æã§ããï¼ã
{
"dart.flutterSdkPath": "/Users/LOGNAME/.asdf/installs/flutter/3.19.6-stable"
}
â»"3.19.6-stable
" ã®é¨åã¯ä¸ã®ã³ãã³ã "asdf local flutter VERSION
" ã§æå®ãããã¼ã¸ã§ã³æååã¨ä¸è´ãã¦ãããã¨ã"LOGNAME
" ã¯ãã°ã¤ã³ã¦ã¼ã¶åã
ã¨ã¯ã¹ããã¼ã©ããã«å
ã®ãã¡ã¤ã« lib/main.dart
ãé¸æãã¦ããç¶æ
ã§å³ä¸ã¹ãã¼ã¿ã¹ãã¼ä¸ã® "{ }"ï¼"Dart" ã®å·¦æ¨ªï¼ãã¯ãªãã¯ãã¦ã表示ãããã¡ãã¥ã¼é
ç®ã« "3.19.6 - Flutter SDK" ï¼"3.19.6
" ã®é¨åã¯ä¸ã®ã³ãã³ã "asdf local flutter VERSION
" ã®ãã¼ã¸ã§ã³çªå·ã¨ä¸è´ï¼ãåå¨ãããã¨ã確èªãããåå¨ãã¦ããå ´åã¯ãåé
ç®å³æ¨ªã®ãã³ã»ãã¼ã¯ãæ¼ããããã¨ãã¹ãã¼ã¿ã¹ãã¼ä¸ã«ãã®ãã¼ã¸ã§ã³çªå·ã表示ãããã
ãã®æä½ã¯ãªãã·ã§ã³ã ããããã¸ã§ã¯ãã§ä½¿ç¨ãã¦ããFlutter SDKã®ãã¼ã¸ã§ã³ã常ã«è¡¨ç¤ºããã¦ããæ¹ãå¤ãæããªãã
ã³ãã³ããã¬ããã§ã¡ãã¥ã¼ "Flutter: Get Packages" ãå®è¡ãããããã«ãã£ã¦ãããã¸ã§ã¯ãã®ãã¹ã¦ã®ä¾åããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãããã
Flutterããã¸ã§ã¯ãã®ãã«ãã¨åä½ç¢ºèª
VSCodeã§ã®Flutterããã¸ã§ã¯ãã®ãã«ãã¨èµ·åå®è¡ã¯ç°¡åã ã
æåã«ãFlutterããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªãéãã¦ããç¶æ
ã§ã¹ãã¼ã¿ã¹ãã¼ä¸ã®ã¿ã¼ã²ããããã¤ã¹è¡¨ç¤ºãæ¼ããããã¨ãä¸ã®ãããªã¡ãã¥ã¼ãéãã®ã§ãããã°ã©ã ã®å®è¡å¯¾è±¡ããã¤ã¹ãé¸æããã
æ¬è¨äºã®å
容ã«å¾ã£ã¦æé æä½ãè¡ã£ã¦ããã°ãFlutterã®ã¿ã¼ã²ããããã¤ã¹ã¨ãã¦ä¸ã®ããã« "Chrome" 㨠"macOS" ã®ï¼ã¤ãã表示ãããªãã¯ãã ã
ã¿ã¼ã²ããããã¤ã¹ãé¸æããã¨ããããã¹ãã¼ã¿ã¹ãã¼ä¸ã«è¡¨ç¤ºãããã
ãã®ç¶æ
ã§ã¡ãã¥ã¼ [Run (å®è¡)] > [Start Debugging (ãããã°ã®éå§)ãF5] ã¾ã㯠[Run Without Debugging (ãããã°ãªãã§å®è¡)ã^ F5] ãé¸ã¶ã¨ãããã¸ã§ã¯ãã®ãã«ããè¡ããããã«ããæåããã°ãããã°ã©ã ãèµ·åããã
ã
次ã®è¨äºã§ãFlutterã«ããiOSã¨Androidã¢ããªéçºç°å¢ã®è¿½å çãªæ§ç¯æé ã«ã¤ãã¦æ¸ãã¤ããã ã
ãåç
§ãªã³ã¯ã
zenn.dev
ãã