In this Flutter tutorial, I will teach you how to create a new Flutter project in the Visual Studio Code.
There are many IDEs to develop mobile applications but I recommend you choose anyone from below.
- Visual Studio Code
- Android Studio
The reason for recommending these two IDEs is their high performance and rich functionality.
This Flutter tutorial teaches you how to create a new Flutter project using Visual Studio Code.
Create A New Flutter Project In Visual Studio Code
To download and install the Visual Studio Code check the link
After you have successfully installed the Visual Studio Code into your computer. Now follow the steps as mentioned below.
- Open the Visual Studio Code.
- On the left sidebar locate option number 4 which is named as extensions. Click on it.
- In the search bar, you have to download three extensions. Flutter, Dart and Material Icon Theme.
- Another extension name is “Awesome Flutter Snippets” that you should download and install as well.
After you have done all the above steps now you are ready to create your new Flutter project in Visual Studio Code.
Now I will teach you how to create your Flutter project in VS Code.
- Click on the View tab in the menu bar and select Command Palette. Shortcut Ctrl + Shift + p.
- Now type Flutter you will see many different options.
- Select the option as Flutter: New Project. Give your project any valid name just as MyApp and press enter.
- Choose the parent directory where you want your app to be stored in your machine.
- Now, wait for a few moments to the VS Code to create your new Flutter project with all the default files and codes.
- The file in which you work most of the time is the main.dart file.
Note: When you create a new Flutter application your IDE requires you to enter a company domain name in reverse order. Reverse order use to maintain the uniqueness of your app on the Google App Store. This company domain name can’t change once it is set.
How To Run Your New Flutter App In VS Code
To run your newly created Flutter project follow the steps below.
On your VS Code and locate the status bar with blue color at the very bottom.
After selecting your emulator to run your app open your main.dart file in the lib folder.
Click on the Debug -> Start Debugging or press F5.
Your app will be launch after a few moments.
The the debugging is complete your app will look like this.
Hot Reload In Flutter Flutter
Hot Reload is a great feature of Flutter. It makes the development cycle much faster. With Hot Reload if you make any changes in your code you can see the results almost instantly.
Let’s have a look at Hot Reload.
Change the piece of string
'You have pushed the button this many times'
with this one
'You have clicked the button this many times'
now save your code and you can see the changes in not time on your simulator or device.
Congratulations! Now you are ready to create and run your Flutter Application in the Visual Studio Code without any error.