In this post you will learn how to install flutter on windows step by step and how to configure android studio and visual studio code to work with flutter.But before we dive into installing flutter, lets have an overview of flutter, the buzz word that is being heard in the app development market.
Note: The content of this post is completely referenced from flutter official website.
What is flutter?
Flutter is Google’s mobile UI framework for crafting high-quality native interfaces on web, mobile and desktop in record time. It is used to develop applications for web, desktop, Android and iOS.Using a single codebase, you can develop mobile apps for both Android and iOS in the same time without putting extra effort. Flutter works with existing code,and is used by developers and organisations around the world, and is free and open source.
Note : This guide is completely referred from the official flutter documentation.
How to install flutter on windows?
Minimum System Requirements
To install flutter on windows, your development environment must meet these minimum requirements.Lets see them below.
- Operating System: Windows 7 SP-1 or later(64 bit).
- Disk Space: 400 MB (does not include disk space for IDE/tools).
- Git for windows
Get the Flutter SDK
Update your path
To run flutter commands in command prompt/windows power shell we have to add flutter to PATH environment variable.To do that follow the steps mentioned below.
- From the Start search bar, enter ‘env’ and select Edit the system Environment variables.
- Click on Environment variables button located at the bottom of the window.
- Under User variables check if there is an entry called Path
- If the entry exists, append the full path C:\flutter\bin to the Path variable using ; as a separator from existing values. If the entry doesn’t exist, create a new user variable named path with the full path to C:\flutter\bin as its value.
- In windows 10 click on the path variable and click Edit.Click on New and paste the path to flutter bin directory which looks like C:\flutter\bin.
- Now click Ok button to save changes.
We have successfully installed flutter on windows.Now you can run flutter commands in command prompt.To start working with flutter we need to install Android Studio.
Run flutter doctor
From a console window that has the Flutter directory in the path ( C:\flutter\bin ), run the following command to see if there are any platform dependencies you need to complete the setup:
This command checks your environment and displays a report of the status of your Flutter installation. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).
[-] 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://flutter.dev/setup/#android-setup for detailed instructions.
Fix license issue in Android studio
C:\flutter\bin>flutter doctor --android-licenses
Once you have installed any missing dependencies, you can run the flutter doctor command again to verify that you’ve set everything up correctly.
Install Android Studio
Skip this step if you already have android studio installed.
- Download and install Android Studio.
- Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Platform-Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.
Set up your android device
To prepare to run and test your Flutter app on an Android device, you’ll need an Android device running Android 4.1 (API level 16) or higher.
- Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
- Windows-only: Install the Google USB Driver.
- Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
- In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
By default, Flutter uses the version of the Android SDK where your adb tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_HOME environment variable to that installation directory.
Set up the Android emulator
To prepare to run and test your Flutter app on the Android emulator, follow these steps
- Enable VM acceleration on your machine.
- Launch Android Studio > Tools > Android > AVD Manager and select Create Virtual Device. (The Android submenu is only present when inside an Android project.)
- Choose a device definition and select Next.
- Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
- Under Emulated Performance, select Hardware – GLES 2.0 to enable hardware acceleration.
- Verify the AVD configuration is correct, and select Finish.
For details on the above steps, see Managing AVDs.
- In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.
Install Flutter and Dart plugins
- Start Android Studio.
- Open plugin preferences ( Preferences > Plugins on macOS, File > Settings > Plugins on Windows ).
- Select Marketplace, select the Flutter plugin and click Install.
- Click Yes when prompted to install the Dart plugin.
- Click Restart when prompted.
That’s all about how to install flutter on windows and how to configure android studio to work with flutter.We will see other flutter concepts in next posts.
Do like and share if you find this post helpful.Thank you!!