In this Flutter tutorial, I will teach you how to create a new Flutter project using Android Studio like professionals.
For developing Flutter applications I highly recommend using Android Studio because of its following features.
- The robust and flexible build system
- User-friendly interface
- Designed for teams
- Optimized for all Android devices
- Firebase and Cloud integration
- Layout Editor
- Vector Asset Studio
No doubt that these features are awesome and really great when you are developing your application.
In this tutorial, I will teach you how to create a new Flutter project using Android Studio as professionals do.
Prerequisites For Flutter Project In Android Studio:
To create a new Flutter project in Android Studio follows the below steps.
- Open the Android Studio and locate preferences ->plugin.
- Search for Flutter and Dart plugins and install them.
- Now restart your Android Studio.
After you, Android Studio relaunches you will an option to create a new Flutter project. Click on this option.
Now select Flutter Application and click the next button.
Now write the project name and verify the Flutter SDK path. You should choose where you want your Flutter project to be saved.
The last step is to give a company domain name to your project and click Finish.
Congratulations! You have successfully created your new Flutter project in Android Studio without any errors.
You can test your default Flutter app by running the main.dart file using the physical device or Android Emulator.
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.
Run The Flutter App In Android Studio
To run your newly created Flutter application in Android Studio you should locate the toolbar located at the top of the Android Studio.
Now you have to select your device in the Target selector to run your code.
If you have seen no device in the Target selector then go to Tools> Android > AVD Manager and create one there.
To see a detailed tutorial on how to setup up your Flutter check out this how to set up Flutter Tutorial.
Now click the run icon on the toolbar to start your Flutter application. 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 Android Studio without any error.