Flutter — IDE Shortcuts for Faster Development

Pooja Bhaumik
Feb 4, 2019 · 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.

Creating a new Stateless or Stateful widget

Guess what? You don’t have to manually write your widget classes and override the build functions. The IDE can do it for you!

Just type to create a Stateless Widget like this:

Or to create Stateful widget:

What if you already created a and added lots of children, but then realized you’re going to need a after all? Should you make a new and then manually transfer all of your code over to it? You don’t have to!

You can just place your cursor on the , press and click on . All the boilerplate code will be created for you, automatically.


More magical things you can do with Alt+Enter

is the magic wand you use for faster development in Flutter. You can click on any , press and see what options you have for that particular . I.E.:

Add a Padding Around a Widget

Let’s say you have a widget that’s not a so it doesn’t have a property. You want to give some padding but you’re afraid of messing up your widget structure. With our magic wand, you can add your without messing anything up:

Just press on the widget that needs a padding around it, and click on And now you can modify the default padding to be whatever you want.

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.

Wrap with a Container, Column, Row or any other Widget

You can use the same approach to wrap your widget with a . So now, the new becomes your Widget’s parent.

Or, you can even wrap multiple widgets with a or in just one click!

Or wrap them with any other widget:

You can even wrap them with a if you have the latest version of the Flutter plugin. Thanks Bhavik Makwana for telling me about it.

Don’t like a widget? Remove it with the Magic Wand.

Yes, removing a widget is just as easy as adding a new one.

Easily copy-paste or cut-paste a line of code

You can easily cut/copy a line of code, just by keeping your cursor at the end of the line, and pressing or and paste it like you normally do ( )


Thanks to Sanal Kv who taught me this in the comments. :)

See the Source Code for Your Widget

That’s the best thing about an open source framework. If you want to know what’s going on behind the scenes of an amazing widget or a class, then you can just put your cursor on it and press . It will act as a link, taking you straight to your Widget’s source code where you can read everything about it. Flutter also uses comments to explain a lot of its code, making for great documentation.

Check Your Widget’s Properties Without Leaving the File or Tab

If you want to check what amazing things your widget can do without leaving your file and digging into the docs, just press to get a quick look at the Widget’s constructor.

Quickly Select an Entire Widget

A lot of times we need to extract/remove an entire widget and we try to manually select them:

If it is a really large widget, then figuring out which closing bracket belongs to which Widget can be pretty confusing and we don’t want to mess up our entire structure.

At times like these, I like to use this super helpful shortcut.

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 to fix your indentation and reformat code.


See an Outline of Your UI

Most of our Widgets don’t have just one child in their tree. They have trees of children that have their own children and plenty more. If your Widget has children nested as little as four deep, then it can get pretty hard to understand the structure of the code just by scrolling through it. Thankfully, we have to come to our rescue!

You can find on the extreme right of your IDE; it’s one of the vertical tabs and is located just above the . 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!

Extract code into a method

is a pretty useful tool. You can do most of the things you did with like wrap with a Column and Center a Widget, but there are even more awesome things available under the tab! One of them is the button.

Fourth button here

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!

Move Widget Up and Down

Another crazy thing you can do with is if you have multiple children in a widget, you can easily rearrange their order:

You can also move just one line up or down by pressing /
Thanks to Filip Hracek for this tip.

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 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:

I can’t remember anything, Pooja

And if you are like Filip Hracek here who sometimes forgets his shortcuts, we have this important magic spell for you. Just and type in the shortcut you need.

That’s all the shortcuts I know for now. Be sure to check back often for more tips, tricks, and other great stuff!

For everyone looking for the VSCode version of this article, here’s one by Ganesh .s.p.

For the Spanish readers, translation by CarlosMillan

Did I miss a fabulous life-saving shortcut? Comment below!

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!

Feeling super generous? Buy me a cupcake. 😋

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 pbhaumik26@gmail.com if you wish to talk tech with me.

Have a nice fluttery day!

Flutter Community

Articles and Stories from the Flutter Community

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store