Flutter - IDE Shortcuts For Faster Development
Flutter - IDE Shortcuts For Faster Development
Getting Started
About
See All Stories
Flutter Community Featured
Wall of Thanks
GitHub
Pooja Bhaumik
Feb 4 · 8 min read
If you’re new to Flutter development then you must be cribbing about the nested
structures, how hard it is to add or remove widgets from the middle of the code or how
hard it is to find where one widget ends and another begins. Then, you spend your
whole day matching opening brackets to their closing ones, or at least trying to. You’re
not alone, we’ve all been there. It took time for us to figure out the shortcuts, but maybe
you won’t have to go through that because I’m at your service; and I’ve curated all
those shortcuts that allow for faster and smoother development in Flutter.
PS. All of these shortcuts work for Android Studio and IntelliJ in Windows. Are you
coming from iOS? Maybe this article will help.
What if you already created a Stateless Widget and added lots of children, but then
realized you’re going to need a State after all? Should you make a new
StatefulWidgetand then manually transfer all of your code over to it? You don’t have
to!
You can just place your cursor on the StatelessWidget, press Alt + Enter and click
on Convert to StatefulWidget . All the boilerplate code will be created for you,
automatically.
Yay!
Center a Widget
This isn’t anything too extraordinary. It just centers your widget in the available space.
This does not work inside a Column or Row.
Ctrl+X
Ctrl+C
Just click on the widget you want to extract and press Ctrl+W. The entire Widget is
selected for you without your cursor moving an inch.
Fix the Code Structure
Sometimes your code will just be a mess. Kind of like this:
For people like me who get a little of OCD looking at code that doesn’t have proper
indentation, this can be a nightmare.
Now, most IDEs have this feature, (though may not be the same key combination). Just
press Ctrl+Alt+L to fix your indentation and reformat code.
Smooth
You can find Flutter Outline on the extreme right of your IDE; it’s one of the
vertical tabs and is located just above the Flutter Inspector. When you open it up, it
looks like this:
Now, you can clearly see which Widget is where, how they’re arranged within the UI
and which widgets have other children widgets. Easy peasy!
If you feel like you’re writing a Widget that’s getting too long and should probably be a
custom Widget, then instead of manually shifting the code into a metho, you can just
use this tool to do the magic for you!
Refactor Renaming
This is a pretty basic tool that most IDE’s have. This lets you rename a method, Widget,
class or file name and it makes sure that references to it are renamed as well. Just use
Shift + F6 and type in the new name:
Remove Unused Imports
So you’re working on a project and you imported lots of files, but over time your code
gets optimized more and more. Eventually, you might not need a lot of those imports
anymore. Now you are ready to push your code to production, but you need to clean it
up and remove all those unused imports. Maybe you normally remove them manually,
but since I’m here to make your life easier, here’s a pretty-pretty keyboard
combination:Ctrl+Alt+O
For everyone looking for the VSCode version of this article, here’s one by Ganesh .s.p.
medium.com
My articles are free, but you know you can press the clap� button 50 times? The higher
you go, the more it motivates me to write more stuff for you!
Hello World, I am Pooja Bhaumik. A creative developer and a logical designer. You
can find me on Linkedin or stalk me on GitHub or maybe follow me on Twitter? If
that’s too social for you, just drop a mail to [email protected] if you wish to talk
tech with me.
twitter.com
Flutter Community
Flutter
iOS
Android
Intellij
Mobile
Written by
Pooja Bhaumik
Google Developer Expert @Flutter, Mobile Developer, Public Speaker, Technical
Blogger, Mentor @MentorCruise
Flutter Community
Articles and Stories from the Flutter Community
2.3K
208
1.1K
Discover Medium
Welcome to a place where words matter. On Medium, smart voices and original ideas
take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your
homepage and inbox. Explore
Become a member
Get unlimited access to the best stories on Medium — and support writers while you’re
at it. Just $5/month. Upgrade
AboutHelpLegal