Google’s Dart and Flutter have become one of the best technologies for web and mobile development. Therefore, a lot of people want to get into Flutter programming to create their own apps. Thus, this article will teach you how to install Dart with Flutter in addition to the Android Studio IDE. However, you can also use Visual Studio Code for Flutter development afterward.
Table of contents:
Step #1: Download the Flutter SDK
First, you need to download the latest Flutter SDK (Software-Development-Kit) from the official download page. After you have downloaded the latest release, you will have a new ZIP file in your downloads folder that is called something like flutter_windows_x.x.x-stable.zip. If so, simply unzip the file.
Now, you will have a folder that has the same name as the zip file. Click on that folder and copy the one you find in it to the folder where you want flutter to be installed.
Do not copy the folder inside any other folder that requires elevated admin privileges like C:\Program Files\!
Instead, I suggest placing it inside your User folder: C:\Users\[YOUR USERNAME]
Step #2: Add Flutter to your path
The next thing you need to do is add the flutter directory to your system path. Therefore, type “env“ into your search on windows and open “Edit the system environment variables“.
In the window that just opened up, click on Environment variables and then search for “Path” under System variables or User variables and double click on it.
If you can’t find any Path entry, simply add one with the New… button.
Now, create a new entry with the path where you saved your flutter folder to the bin directory. After you’ve done that, you can click OK on every window to close it.
Step #3: Set up Flutter & install Android Studio
Next, you need to set up Flutter in the console. Therefore, close all your currently open CMD/PowerShell windows and then open a new one. You can do so by searching for CMD or PowerShell in the Windows search.
Now, you simply need to run the command flutter doctor, which checks whether the installation was successful and flutter is ready to run.
As you can see, flutter doctor found some issues. However, do not worry about that, as we are going to fix these errors together.
Install Android Studio
In my case, I already got Android Studio installed. Hence, my errors may look slightly different than yours. However, installing Android Studio should fix all major errors for you.
To do so, head to the official download page, download Android Studio and install it with all the recommended options in the setup wizard.
Now, just restart your console and run flutter doctor as you have done before.
If you still get the “cmdline-tools component is missing” error, follow the steps here and come back afterward.
Otherwise, you may need to accept the android licenses with the command flutter doctor –android-licenses.
If everything was successful, you shouldn’t get any major errors besides no device connected and VS code not found.
Before you start developing Flutter apps, there’s still one thing to do. That is installing the Flutter Android Studio plugin. To do so, open Android Studio, in the Menu click on File > Settings, and in the window that hopefully just opened, select plugins and search for Flutter.
Theoretically, you can now start to develop with Flutter. Nevertheless, you can also follow step #5 to create an Android virtual device to test your apps.
Step #4: Set up an Android Virtual Device (AVD)
To set up an Android Virtual Device, you need to start Android Studio and open the Virtual Device Manager.
From here, you simply need to click on create in the top left corner. The rest should be self-explanatory.
To start the virtual device, open the Virtual Device Manager again and click on the play symbol at your virtual device.
Fix "cmdline-tools component is missing" error
If you still encounter this error when running flutter doctor, you first need to open Android Studio and open the SDK Manager:
Next, go to Appearance & Behavior > System Settings > Android SDK and switch to the SDK tools tab. Here, check Android SDK Command-line Tools and Apply the settings.
That’s it! The error should be fixed now.
In conclusion, Flutter has become very important for the mobile and web app industry. However, it can be quite confusing how to install it. Therefore, I hope this article was helpful for you. If you have any questions, you contact me through the contact form on this site!
If you like this post, you can share it with your friends.
Thanks for reading!