Intimidated to start a new stack? Worry not, follow through this article to build an easy app. I’ve written this article for Linux systems. But I’ll update similar articles for other operating systems as well. So follow through and let's dive deep!
First here is the official documentation.
But this article would be easier than that, so here we go.
Flutter needs a few environment tools, so run the following commands, if not present install them by clicking ‘y’ for yes.
sudo apt-get update -y
sudo apt-get install bash
sudo apt-get install curl
sudo apt-get install file
sudo apt-get install git
sudo apt-get install unzip
sudo apt-get install xz-utils
sudo apt-get install -y libglu1-mesa
After this :
There are more Linux tools required, run the following command for it :
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
We need a package manager called Snap for making our installation process easier. And we can do that with the following commands.
sudo apt update
sudo apt install snapd
And restart.
After that let’s start installing Flutter, just a few more steps and we’ll have our app ready to use.
sudo snap install flutter --classic
flutter sdk-path
This installs and shows you where Flutter is installed in your system.
flutter doctor
This command shows if or not all dependencies required are installed in the system.
You’ll get something of this sort :
I have installed Chrome previously, so if you don’t have it, it is super easy. Follow this.
Now let’s download Android Studio code :
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386
Go to this link and click on Download. Either download it into this folder: /usr/local/ else, move it into this folder after downloading it using the following command.
sudo mv filename.tar.gz /usr/local/
cd /usr/local/
sudo tar –xvzf filename.tar.gz
cd android-studio/bin/
./studio.sh
After this a wizard would appear, click next until you reach Finish.
After this, if you run ‘flutter doctor’ you’ll still have two issues.
Do the following to get rid of the first one :
- Open Android Studio →Customize -> All Settings -> search for SDK → Check “Show Obsolete packages” → Download platform-tools, command-line tools
And for the second requirement, in the command line run the following command and press y for each question asked :
flutter doctor — android-licenses
Now check again with ‘flutter doctor’
AWESOME!!!!!
Now open Visual studio Code, if you don’t have it installed, worry not! It is only one command away :
sudo snap install code --classic
Install Flutter and Dart extensions from VScode extensions page. Other related extensions can be installed as well! They’ll come in handy.
After the installation View -> Command palette -> Type “flutter”, and select the Flutter: New Project (after select the parent folder and type as application)
And wait for the magic to happen!
.
.
After the code is auto-generated, look for devices in the bottom-right corner and choose an emulator for the app to show up on! And press F5 for it to run!
Wait for it load!!!!!!
.
.
.
If you think your system is getting slow, and you aren’t able to use an emulator, open it with chrome/linux as device. It’ll open like so :
Congrats on creating a Flutter application!!!!
Stay tuned for more, Happy Learning!
Shower some claps and follow as a token of encouragement! :))