Complete Guide: How to Install Flutter on Windows | Step-by-Step Tutorial

Learn how to install Flutter on Windows with this comprehensive step-by-step tutorial. Follow the instructions to set up your development environment and get started with Flutter app development on your Windows machine. Ensure a smooth installation process with detailed guidance and tips.

Complete Guide: How to Install Flutter on Windows | Step-by-Step Tutorial


Guide to Installing Flutter on Windows

If you're interested in installing Flutter on your Windows machine, follow these steps to set up your development environment properly:

System Requirements

Before installing and running Flutter, ensure that your development environment meets the following minimum requirements:

Operating System:

Windows 10 or later (64-bit), x86-64 based.

Disk Space:

1.64 GB (excluding space for IDE/tools).

Tools:

Flutter relies on specific tools being available in your environment.

    - Windows PowerShell 5.0 or newer (pre-installed with Windows 10).

    - Git for Windows 2.x, with the "Use Git from the Windows Command Prompt" option.


If you already have Git for Windows installed, make sure you can execute Git commands from the command prompt or PowerShell.

Obtain the Flutter SDK

Download the installation bundle for the latest stable release of the Flutter SDK using the following link:

[Link: https://storage.googleapis.com/flutter_infra_release/releases/stable/windows/flutter_windows_3.10.6-stable.zip]

If you're looking for other release channels or older builds, you can check the SDK archive.

After downloading, extract the contents of the zip file and place the "flutter" folder in your desired installation location (e.g., C:\src\flutter).

You're now ready to execute Flutter commands in the Flutter Console.

Update your PATH

To run Flutter commands in the regular Windows console, follow these steps to add Flutter to the PATH environment variable:

1. Open the Start search bar and enter "env," then select "Edit environment variables for your account."

2. Under User variables, check if there's an entry named "Path."

   - If it exists, append the full path to "flutter\bin" using ";" as a separator from the existing values.

   - If it doesn't exist, create a new user variable named "Path" with the full path to "flutter\bin" as its value.

3. Close any open console windows and reopen them for the changes to take effect.


Verify the PATH variable by checking if the following paths are accessible:

- C:\dev\src\flutter\bin\flutter

- C:\dev\src\flutter\bin\flutter.bat

- C:\dev\src\flutter\bin\dart

- C:\dev\src\flutter\bin\dart.bat

- C:\dev\src\dart-sdk\bin\dart.exe


Run Flutter Doctor

Open a console window that has the Flutter directory in the path (as set in the previous step) and execute the following command to check for any platform dependencies needed to complete the setup:

C:\src\flutter>flutter doctor

This command will examine your environment and provide a report on the status of your Flutter installation. Pay close attention to any bold text in the output, as it may indicate additional software to install or further tasks to perform.

For example:

[-] Android toolchain - develop for Android devices

    • Android SDK at D:\Android\sdk

    ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ

    • Try re-installing or updating your Android SDK,

      visit https://docs.flutter.dev/setup/#android-setup for detailed instructions.


The following sections will guide you through performing these tasks and completing the setup process. Once you've installed any missing dependencies, run the "flutter doctor" command again to verify that everything is properly set up.

Install Android Studio

Download and install Android Studio from the official website [Link: https://developer.android.com/studio].

Launch Android Studio and go through the "Android Studio Setup Wizard." This will install the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are necessary for Flutter development on Android.

Run "flutter doctor" to confirm that Flutter has detected your Android Studio installation. If Flutter is unable to locate it, run "flutter config --android-studio-dir=<directory>" to specify the installation directory of Android Studio.

Set up your Android Device

To prepare your Android device for running and testing Flutter apps, follow these steps:

1. Enable Developer options and USB debugging on your device. Refer to the Android documentation for detailed instructions.

2. [Optional] If you want to use wireless debugging, enable Wireless debugging on your device. Refer to the Android documentation for detailed instructions.

3. Windows-only: Install the Google USB Driver.

4. Connect your phone to your computer using a USB cable. If prompted on your device, authorize your computer to access your device.

5. In the terminal, run the command "flutter devices" to verify that Flutter recognizes your connected Android device. By default, Flutter will use the version of the Android SDK associated with your adb tool. If you want to use a different Android SDK installation, set the environment variable "ANDROID_SDK_ROOT" to the appropriate directory.


Set up the Android Emulator

To prepare the Android emulator for running and testing your Flutter app, follow these steps:

1. Enable VM acceleration on your machine.

2. Launch Android Studio, click the Device Manager icon, and select "Create Device" under the Virtual tab.

   - In older versions of Android Studio, go to Android Studio > Tools > Android > AVD Manager and select "Create Virtual Device..." (The Android submenu only appears when inside an Android project).

   - If you don't have a project open, you can also access the Virtual Device Manager by selecting 3-Dot Menu / More Actions > Virtual Device Manager and choosing "Create Device..."

3. Choose a device definition and click "Next."

4. Select one or more system images for the Android versions you want to emulate, and click "Next." It's recommended to use an x86 or x86_64 image.

5. Under Emulated Performance, select "Hardware - GLES 2.0" to enable hardware acceleration.

6. Verify the AVD configuration and click "Finish."


Refer to the Managing AVDs documentation for more detailed instructions on the above steps.

In the Android Virtual Device Manager, click "Run" in the toolbar. The emulator will start up and display the default canvas for your selected OS version and device.


Agree to Android Licenses

Before using Flutter, you need to agree to the licenses of the Android SDK platform. Follow these steps after installing the above tools:

1. Open an elevated console window and execute the following command to initiate the license signing process:

   flutter doctor --android-licenses

2. Carefully review the terms of each license and agree to them.

3. After agreeing to the licenses, run "flutter doctor" again to confirm that you're ready to use Flutter.


Windows Setup

Additional Requirements for Windows Desktop Development

For Windows desktop development with Flutter, you need the following in addition to the Flutter SDK:


- Visual Studio 2022 or Visual Studio Build Tools 2022: When installing Visual Studio or only the Build Tools, make sure to include the "Desktop development with C++" workload, including all its default components.


Install the Flutter and Dart Plugins

To integrate Flutter and Dart with your development environment, follow these steps:

1. Open the plugin preferences (File > Settings > Plugins).

2. In the Marketplace, search for the Flutter plugin and click "Install."


Please ensure you follow the instructions carefully, and don't hesitate to refer to official Flutter documentation for more details on the setup process.



No comments:

Post a Comment