Creating a Flutter Project in Android Studio
Android Studio enables developers to create new Flutter projects using an easy-to-use wizard. Let’s get started!
Using the New Project Wizard
First, click on New Flutter Project
from the welcome screen or click on New
and then New Flutter Project
from the File menu. Android Studio will open the New Project dialog.
Android Studio then prompts you for the path to your Flutter SDK directory. Verify the path is correct and then hit the Next
button.
The next step is to enter your project name. In the New Project box, enter the project name. No other changes are required. Click on Create
.
Android Studio creates the project and prompts the user to open it.
Flutter Code
We write Flutter code in the Dart programming language. All Dart files end with the file name .dart
. Our generated Flutter app has a file called main.dart
in a folder called lib
. We can open this file by clicking on it.
Every Flutter app starts with a main()
function. We can find it in the main.dart
file.
Running our App in the Chrome Browser
Our first step in running the app is to select the Chrome (web) browser as the target. We will use this selection box when we choose other targets such as iOS Simulator or Android Emulator.
Next, we can start running the project by hitting the play button.
A new browser window will appear running our app! Give it a try!
We just ran our first Flutter App!
You can hit the stop button in Android Studio to stop the app from running.
Review
Congratulations! We used the Android Studio wizard to create and run our first app! Let’s review some of what we learned:
Android Studio includes a wizard allowing us to create a new Flutter project.
Once we create the project, a code editor opens, allowing us to see all the files and created code.
We can then run our Flutter app in the Chrome web browser with Android Studio.
We can use the stop button to finish running our app.
Author
'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'
Meet the full team