Flutter --> by myCODEnotein
Installing Flutter
Below the installation process for windows is given.(git is required)
For other os you can follow the link : flutter installation website
You can install without git as well but then you need to follow the documentation only.
For windows (only) | (git required)
You can either watch a video below which
is by TechWithTim
(or)
read the below post section.
I recommend you to watch the video but its your wish.
Just go to any folder where you want to install flutter .
Make sure the folder is normal and does not contains any special rights.
Also make sure that the folder does not contain any folder named "flutter"
And then open git bash in that folder and run the below command:
git clone https://github.com/flutter/flutter.git -b stable
// You can paste the link(after copying it , obviously) in git bash using insert key.
Adding flutter to path
Just go to the "flutter" folder (created above) and
find a folder named "bin" inside it.
Copy the path of bin folder .
In my case it looks like this:
E:\installed_flutter\flutter\bin
Just edit the environment variables as shown
in below video.
Now restart the git/cmd and run the command
flutter
(if you see any output then , you are good to go.)
Flutter doctor
Now run the below command:
flutter doctor
This will command will scan your system for
correct flutter dependencies , install
them automatically or will tell you to do
something.
Right now flutter is telling me to install java jdk
and android studio.
I will install android studio which will automatically
install java jdk as well.
So , let me do that.
If you also get any kind of message
you just follow it.
If you are unable to understand the message
then just google it and you will get the answer.
Click the image to go to android studio website and
download android studio from there:
After that flutter said me to run a command
for android licenses which i ran.
While the command was running , I was
asked to enter "y" which i did as shown
in image below:
Then i ran
flutter doctor
again and got the following output:
Creating an emulator
Now , you have two options:
either you connect a physical device
to your pc/laptop .
(or)
create a virtual device through an emulator.
Now to create an emulator i will recommend
you to watch the below video and follow it.
VSCode setup for flutter
Now you can use android studio or
Visual studio code for the development.
I am gonna use visual studio code.
Click the image to go to visual studio website
and download visual studio from there.
Just open visual studio code and install
flutter and dart extension by going to extension tab.
When you download flutter extension , the dart extension
gets downloaded automatically.
But still make sure that it is downloaded and installed.
Finally everything is done and now we can move on towards the coding process
Starting a new project
Now to start a new project you have three options.
You can do it in android studio , visual studio or
through terminal.
These notes cover visual studio and terminal method .
For android studio you can go to: Documentation
Creating a project through terminal (normal)
If in case you are having some problems you can visit:
Flutter documentation for terminal
flutter create app_name
// Run the command in command prompt.
// Run in that folder where you want to create the project in.
Rules for writing app_name : Documentation
When i ran this command i got an error.
The error told me to visit a link (specified above in rules).
When i went there i got to know that you can
use lowercase letters only in app_name.
Hence if you also got an error , i am sure you'll
be able to find answer to that.
cd app_name
// Now move to the created folder
Running the app (terminal method)
// Check that the android device is connected properly or not.
flutter devices
If you are not shown anything follow the device-specific instructions on the Install page for your OS.
// Run the app with following command
flutter run
Hot reload (through terminal)
To update the app without restarting or losing app state :
Just press 'r' in the terminal.
After the app build completes, you�ll see the starter app on your device.
Creating a project through VSCode (easier)
Firstly if you haven't install flutter extension and dart extension shown above in installation . Please do that.
Just open command palette in VSCode through (ctrl+shift+p) or directly
and write there flutter new application and select the shown command.
(also shown in below image)
Select the folder where you want to create the project in
and then write the project name you want.
The project name must follow the rules described at this link:
Flutter documentation