How to get started with Flutter?
Roses are Red, Violets are Blue. I love Flutter, Why don’t you?
Content:
1.What is Flutter?
2. How to Install Flutter?
3. Connect Android Studio
4. Common Errors
So let’s get started!
What is Flutter?
Flutter is a free, open-source cross-platform development tool for building android, ios, web and embedded device apps using a single code base with great designs, smooth animations, and high performance.
Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, desktop, and embedded devices from a single codebase.
-flutter.devThe first version of Flutter was known as codename “Sky” and ran on the Android operating system. It was unveiled at the 2015 Dart developer summit
-wikipedia
At the time of writing this article, Flutter 2.2 is released with some amazing changes compared to the previous versions. A few of the examples are null safety and stable web support.
Applications developed in flutter are eBay, Reflectly, Google Ads, Dream11 and many more.
-flutter.dev/showcase
You can always read about Flutter and changelog from its official website. flutter.dev.
Let’s move on to how to install flutter.
Quick note: If you face any error while installing any of the below applications, please look at the Common Errors section at the end of blog.
How to install Flutter?
First, go to this link and select your operating system. For this blog, I’ll cover Windows OS installation.
Please make sure to see the system requirements before proceeding to install.
Download the zip file and extract it on C:\src\
Warning: Do not install Flutter in a directory like
C:\Program Files\
that requires elevated privileges.
Now it’s time to update the path.
Click on the search icon on the taskbar, type ‘env’, and open ‘Edit the system environment variables.
Open ‘Environment Variables’
Add path flutter\bin to the path variables
Well done. You’ve installed flutter successfully.
To check whether Flutter is installed correctly run the following command in the command prompt.
C:\src\flutter>flutter doctor
You will see the “unable to android sdk” error and to solve that, we need to install android studio.
Let’s download and install Android Studio now.
Connect Android Studio
Download Android Studio from this link.
Install the android-studio.exe file with the default configuration.
It’ll take some time to launch for the first time. You’ll see the screen attached below. Go to “Configure”.
Click on “Plugins”.
Search for flutter, install the plugin and restart IDE.
After restarting, you’ll see the “Create New Flutter Project” option as well.
Agree to Android Licenses
Before you can use Flutter, you must agree to the licenses of the Android SDK platform. This step should be done after you have installed the tools listed above.
Make sure that you have a version of Java 8 installed and that your
JAVA_HOME
environment variable is set to the JDK’s folder.Android Studio versions 2.2 and higher come with a JDK, so this should already be done.
Open an elevated console window and run the following command to begin signing licenses.
flutter doctor --android-licenses
Review the terms of each license carefully before agreeing to them. Once you are done agreeing with licenses, run
flutter doctor
again to confirm that you are ready to use Flutter.
Run “flutter doctor” for the last time and you probably won’t see any errors. If incase you still get any errors refer the Common Errors section.
Now let’s start with out first flutter project. 😄
Click on “Create New Flutter Project”
Add your Flutter SDK path.
Next, name your project, select project location and give description to the project
Clicking on finish will create your first flutter project.🥳
Common Errors
Error 1:
Android Studio is installed but is not showing connected after running
flutter doctor
Solution:
Run
flutter doctor
to confirm that Flutter has located your installation of Android Studio. If Flutter cannot locate it, runflutter config --android-studio-dir <directory>
to set the directory that Android Studio is installed to.
Make sure to paste the directory path in “double quotes”.
C:\src\flutter>flutter config --android-studio-dir “C:\Program Files\Android\Android Studio”
Error 2:
No JDK found.
Solution:
Download the Java SE Development Kit from this link and add the path to system variables.
Error 3:
Error while accepting android licenses.
Solution:
Goto Android Studio/Settings/Android SDK/SDK Tools and install Android SDK Command-line Tools.
I hope this blog helped you to get started with flutter. Next, I’ll be writing more about Flutter and Dart in detail i.e. explaining demo code in my upcoming blog.
If you liked my content and also want to be a part of a great developer community, you can join my discord server. 😇
Link to Discord server: https://discord.gg/CX3HJZNPeU 🚀🚀🚀