Windows Development Environment Setup for Flutter Application

Ruqaiya Sattar (She | Her)
5 min readJul 17, 2023

--

If you have joined new company and they gave you new system/laptop[windows] and asks you to run and test flutter project on physical testing Device.

What will be the steps to setting up development environment to your system?

I will explain and enlist 6 steps which I did.

To set up a Windows development environment for Flutter application development, you need to install several tools and configure your system accordingly. Here’s a step-by-step guide:

Step 1: Enable developer mode

Open the “Developer options” settings directly in Windows

open cmd and type above command

Here’s how to execute the command:

  1. Press the Windows key on your keyboard.

2. Type “Command Prompt” or “cmd” in the search bar.

3. Right-click on “Command Prompt” in the search results.

4. Select “Run as administrator” to open an elevated command prompt.

5. Copy the command mentioned above and paste it into the command prompt window.

6. Press Enter to execute the command.

This will open the “Developer options” settings page in the Windows Settings app, where you can enable or disable Developer Mode and access other developer-related settings.

Step 2: Download Java/JDK

To run Flutter projects in Android Studio, you need to have Java Development Kit (JDK) installed on your system. Although Flutter itself doesn’t require Java knowledge, having the JDK installed is necessary for the development environment and tools to function correctly.

Why?

There are many reasons:

  1. Flutter SDK Dependency: Flutter is built with the Dart programming language, but it relies on the Java Virtual Machine (JVM) for running the Flutter tools and some of the underlying Android dependencies. Therefore, the Flutter SDK requires the presence of a JDK.
  2. Gradle Build System: Android Studio uses Gradle as the build system for Flutter projects. Gradle is written in Java and requires the JDK to function properly. It uses the JDK to compile and build your Flutter app, generate the APK, and perform various other tasks during the build process.
  3. Android Development: Flutter enables cross-platform mobile app development, which includes developing apps for Android. Android development, including building, running, and debugging apps, heavily relies on the Java programming language and the associated tooling provided by the JDK.

Lets go:

Visit the Oracle JDK download page (https://www.oracle.com/java/technologies/javase-jdk16-downloads.html).

  1. Accept the license agreement.
  2. Download the JDK appropriate for your operating system (e.g., Windows, macOS, Linux).
  3. Run the downloaded JDK installer.
  4. Follow the installation instructions provided by the installer.
  5. Choose the installation directory for the JDK.
  6. Complete the installation process.
  7. Open the Start menu and search for “Environment Variables.”
  8. Click on “Edit the system environment variables.”
  9. Click the “Environment Variables” button at the bottom.
  10. Under the “System Variables” section, click “New” to add a new variable.
  11. Set the variable name as JAVA_HOME.
  12. Set the variable value as the path to your JDK installation directory (e.g., C:\Program Files\Java\jdk-17\).
  13. Click “OK” to save the changes.

Verify JDK Installation

  1. Open a command prompt or PowerShell.
  2. Type java — version and press Enter.
  3. Verify that the installed JDK version is displayed without any errors.

After completing these steps, you have successfully downloaded and installed the Java Development Kit (JDK) on your system. Android Studio should now be able to locate and utilize the JDK for Flutter app development.

Step 3: Download Flutter SDK

Install Flutter SDK

  1. Download the Flutter SDK from the Flutter website (https://flutter.dev).
  2. Extract the downloaded file to a folder on your system (e.g., F:\flutter\).

Set up Flutter Environment Variables

  1. Open the Start menu and search for “Environment Variables.”
  2. Click on “Edit the system environment variables.”
  3. Click the “Environment Variables” button at the bottom.
  4. Under the “System Variables” section, click “New” and add a variable named Flutter with the value set to the path of your Flutter SDK folder (e.g., F:\flutter).
  5. Find the Path variable in the "System Variables" section and click "Edit."
  6. Add the following entries at the end of the “Variable Value” field: %Flutter%\bin %Flutter%\bin\cache\dart-sdk\bin
  7. Click “OK” to save the changes.

Step 4 (a): Install Visual Studio Code (recommended code editor)

  1. Download Visual Studio Code from the official website (https://code.visualstudio.com/).
  2. Run the downloaded installer and follow the installation instructions.

Install Flutter and Dart plugins for Visual Studio Code

  1. Open Visual Studio Code.
  2. Go to the Extensions view by clicking the square icon on the left sidebar or pressing Ctrl+Shift+X.
  3. Search for “Flutter” in the extensions search bar and click on the “Flutter” extension by Dart Code.
  4. Click the “Install” button to install the Flutter extension.
  5. Search for “Dart” in the extensions search bar and click on the “Dart” extension by Dart Code.
  6. Click the “Install” button to install the Dart extension.

Step 4(b): Install Android Studio (for Android development)

  1. Download Android Studio from the official website (https://developer.android.com/studio).
  2. Run the downloaded installer and follow the installation instructions.
  3. Launch Android Studio.
  4. Go through the setup wizard and install the necessary SDK components.
  5. Set up an Android Virtual Device (AVD) if you plan to test your app on an emulator. or if you want to test in physical device then on developer mode in your phone
  6. go to File -> Settings -> Plugins , search for Dart in right panel download that, also search for Flutter and download it.

Step 6: Set up Android licenses

It’s important to note that accepting the licenses is a one-time process, usually performed during the initial setup or when adding new SDK components. It helps ensure compliance and grants you the legal permissions to utilize the Android SDK for development purposes.

  1. Open a command prompt or PowerShell.
  2. Run the following command to accept the Android licenses:

flutter doctor — android-licenses

if any error comes, open Android studio, go to File->settings, drop down Appearence&Behavior then drop down Systems settings click on Android SDK and on right window, tap on SDK Tools, select Android SDK Command Line tools and download it. when downloaded, open terminal in Android studio/PowerShell and type above command again then accept packages licenses.

Step 7: Verify Flutter installation and configure your device

  1. Open a command prompt or PowerShell.
  2. Run the following command to verify that Flutter is installed correctly:

flutter doctor

  1. It should provide feedback on any missing dependencies or setup issues.
  2. Connect your Android device to your computer or start an emulator.

That’s it! You have set up your Windows development environment for Flutter application development. You can now create, run, and debug Flutter apps using Visual Studio Code/Android Studio or the command line tools provided by Flutter SDK.

--

--

Ruqaiya Sattar (She | Her)

Applications Engineer | Flutter Developer | Open Source Enthusiast