설치

- https://docs.flutter.dev/get-started/install/windows

 

Windows install

How to install on Windows.

docs.flutter.dev

 

1. System requirements

2. Get the Flutter SDK

- A. Download: flutter_windows_3.0.1-stable.zip

- B. Extract: E:\flutter

3. Update your path

- From the Start search bar, enter ‘env’ and select Edit environment variables for your account.

- Under User variables check if there is an entry called Path: E:\flutter\bin

  C:\>where flutter dart
  C:\path-to-flutter-sdk\bin\flutter
  C:\path-to-flutter-sdk\bin\flutter.bat
  C:\path-to-dart-sdk\bin\dart.exe        :: this should go after `C:\path-to-flutter-sdk\bin\` commands
  C:\path-to-flutter-sdk\bin\dart
  C:\path-to-flutter-sdk\bin\dart.bat

4. Run flutter doctor

C:\src\flutter>flutter doctor
Running "flutter pub get" in flutter_tools...                      11.8s
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.19043.1586], locale ko-KR)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 4.2)
[√] VS Code (version 1.67.2)
[√] Connected device (3 available)
[√] HTTP Host Availability

! Doctor found issues in 2 categories.

 

5. Android setup

- 안드로이드 스튜디오 최신 설치함

E:\flutter>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version
    10.0.19043.1586], locale ko-KR)
Checking Android licenses is taking an unexpectedly long time...[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.67.2)
[√] Connected device (3 available)
[√] HTTP Host Availability

! Doctor found issues in 2 categories.

E:\flutter>

 

6. Install the Flutter and Dart plugins

On Android Studio

Use the following instructions for Linux or Windows:

  1. Open plugin preferences (File > Settings > Plugins).
  2. Select Marketplace, select the Flutter plugin and click Install

On VS Code

1. Install the Flutter and Dart plugins

  1. Start VS Code.
  2. Invoke View > Command Palette….
  3. Type “install”, and select Extensions: Install Extensions.
  4. Type “flutter” in the extensions search field, select Flutter in the list, and click Install. This also installs the required Dart plugin.

2. Validate your setup with the Flutter Doctor

  1. Invoke View > Command Palette….
  2. Type “doctor”, and select the Flutter: Run Flutter Doctor.
  3. Review the output in the OUTPUT pane for any issues. Make sure to select Flutter from the dropdown in the different Output Options.

7. Test drive

   Create the app

1. Invoke View > Command Palette.
2. Type “flutter”, and select the Flutter: New Project.
3. Select Application.
4. Create or select the parent directory for the new project folder.
5. Enter a project name, such as my_app, and press Enter.
6. Wait for project creation to complete and the main.dart file to appear.

The above commands create a Flutter project directory called my_app
that contains a simple demo app that uses Material Components.

 

8. Run the app

 

   1. Locate the VS Code status bar (the blue bar at the bottom of the window):

   2. Select a device from the Device Selector area. For details, see Quickly switching between Flutter devices.

   3. Invoke Run > Start Debugging or press F5.

   4. Wait for the app to launch—progress is printed in the Debug Console view.

 

   After the app build completes, you’ll see the starter app on your device.

 

9. Try hot reload

 

 Flutter offers a fast development cycle with Stateful Hot Reload, the ability to reload the code of a live running app  without restarting or losing app state. Make a change to app source, tell your IDE or command-line tool that you want to hot reload, and see the change in your simulator, emulator, or device.

  1. Open lib/main.dart.

  2. Change the string

 

10. Profile or release runs

    Do not test the performance of your app with debug and hot reload enabled.

    If you’re concerned about the package size of your app, see Measuring your app’s size.

 

11. 문제해결

- 문제: flutter doctor 수행 시, Exception: Bad UTF-8 encoding (U+FFFD; ...  에러 발생

- 해결:

    1. 최신 버전 3.0.2의 vswhere.exe 파일 다운로드 ( https://github.com/microsoft/vswhere/releases )

    2. 다음 경로의 vswhere.exe 파일 교체   ( https://github.com/flutter/flutter/issues/102451 )

       

C:\Program Files (x86)\Microsoft Visual Studio\Installer

 - 참고

     1. https://stackoverflow.com/questions/72247285/flutter-the-doctor-check-crashed-because-of-visual-studio

     2. https://www.youtube.com/watch?v=tYHYIGinx2U&ab_channel=TheFlutterWay

 

Next: Write your first Flutter appWrite your first Flutter app

- Write your first Flutter app, part 1 | Flutter

 

Write your first Flutter app, part 1

How to write a web-based app in Flutter.

docs.flutter.dev