You can build flutter apps using flutter command line tools with any text editor. However, if you want to get other development helpers like syntax highlighter, widget editing, auto completion, debugging etc., you should consider using one of the editor plugin that is provided by Google for Android studio, VS Code and Intellij-Idea.
In this post, I will show you how you can build your first flutter app on Android Studio.
If you don’t have android studio, download and install it from here(https://developer.android.com/studio).
- Start it.
- Go to the ‘Preferences’ tab. (File -> Settings on windows , Android Studio -> Preferences on mac)
- Search for ‘plugin’ and click on the plugin tab on left side.
- Under the Marketplace tab, search for flutter.
- Install it. If it prompt to install dart, install that as well.
- Restart android studio when prompted.
- Open your Android Studio and click on Start a new flutter project.
- Check Flutter application and click on Next.
- Add your project location and project name. Make sure that flutter sdk is installed and its sdk path is correct. If not, you can install it using the button Install SDK.
- Click next and add one package name for your application. This package name is unique for each application. Don’t worry about that now. You can change it later before releasing it on play store. Click on Finish and done. It will start creating your flutter app.
You need to connect your mobile to your pc or start one new android virtual device from tools -> AVD. Select your phone or emulator, select the configuration as main.dart, and click on the play button to start the app :
It will start the app on your emulator or your phone :
Click on the plus button to increment the value of the number.
Flutter provides hot reloading. That means, you can change a part of your code and reload the app quickly without rebuild and install it again. Open your lib/main.dart, change primarySwatch: Colors.blue, to primarySwatch: Colors.red, and click on the hot reload button :
It will reload the app quickly and change its color.
That’t it for now. You have learned how to setup android studio and how to create one simple flutter application using predefined template. Try to change different text and colors in lib/main.dart and see how it looks.