Tips on using Android Studio to develop Flutter apps

There is an interesting technology by Google called Flutter. It is a framework where you can create mobile apps on iOS and Android at the same time, like React Native but with a programming language called Dart. I tried it out and I fell in love with it. One of the reasons that I love it is because to create a complete app by using and creating Widgets in a very short amount of time. Other than that, I am very happy with the Flutter development tools that made creating Flutter apps such a joy. Hot reload for the fast development cycle, ready-to-use Material components are one of the many plus points for me.

Here are a few shortcuts that I use all the time to boost my productivity and happiness when creating Flutter apps. Most of the shortcuts are already available in Android Studio/IntelliJ or any JetBrains based IDE for quite some time.

Alt + Enter on a widget

As you nest more widgets under widgets. The open and close parentheses of the widgets will get longer and longer. It is very tricky if we want to insert a widget such as a Column, Row, Padding, Center, or custom widget between two widgets. It is also a very tedious process if what we want is to remove a widget in between a parent and a child widget.

By using the Alt-Enter shortcut, the aforementioned actions seem trivial.

Alt Enter on a widget to bring up an interactive tool menu
Example 1: removed a Center column
Example 2: Added a padding to nest the Center widget

Flutter Outline

This sidebar tab allows you to see the hierarchy of widgets in our app. Besides that, we can remove or nest the selected widget inside a new widget such as Column, Row, a Padding, or Center.

Format your code, Ctrl + Alt + L

This function is to format your code to be more tidy and uniform.

Before code format
After code format: much better!

Shift-Shift

Search for everything! Class, Widget, Files, Methods, Functions, even every Android Studio’s actions can be found by typing in your search in the dialog box that appears after tapping the Shift key on your keyboard twice.

Version Control

Where do I start? I believe Android Studio/JetBrains IDE has the best Version Control tool for Git repositories. It supports merges, conflict resolutions, reword commit message with just a click, partial git commit, and many more. Perhaps I will write about it in another post.

Furthermore, before we initialize our project with Git, Android Studio has already saved our code into its own repository automatically. You can access it via VCS -> Local History. So the chances of hours of code loss to the abyss is lowered considerably as you can restore them anytime.

VCS > Local History

Shift-F6

Lastly, Shift-F6 is a shortcut that I use almost every day. It is too useful not to be mentioned. It allows you to refactor and rename anything from files, classes, functions, fields, and variables.

Android Studio is a treasure trove of a tool and the Android Studio’s Flutter plugin is already so good. I am looking forward to more new features to be released in the future.