Clean up your Dart & Flutter projects with this one awesome IntelliJ feature!

Modestas Valauskas
Oct 23 · 2 min read

Did you know that you can easily hide project files that you don’t want to see behind your pubspec.yaml?

Today I’ll show you how!

First, you’ll need a Dart project. I’ll use extra_pedantic for this demonstration. I wrote about extra_pedantic in my last post here. You should definitely check it out, but this trick works on any Dart or Flutter package or project with a pubspec.yaml.

Ugh! let’s clean that up!

This is what your Dart project might look like. To clean it up you’ll have to access the ‘File Nesting’ options by clicking on the cogwheel and opening ‘File Nesting…’

The following window will pop up

You’ll need to add a new entry. Tap on the ‘+’ sign at the bottom of the window. Use ‘pubspec.yaml’ as the ‘Parent file suffix’ (left cell) and the following text as the ‘Child file suffix’ (right cell):

.env.json; .flutter-plugins; .gitignore; .iml; .json; .metadata; .packages; .travis.yml;; LICENSE;; analysis_options.yaml; mono_pkg.yaml; pubspec.lock

Press OK and you’re done!

Now every file that ends with one of the provided suffixes will be hidden behind the projects pubspec.yaml.

Feel free to share this trick with other friendly neighbourhood Dart Developers!

Any questions? You can find me on Twitter!

Modestas Valauskas

Written by

Student · Developer · Aspiring Storyteller

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
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade