Clean up your Dart & Flutter projects with this one awesome IntelliJ feature!
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.
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; CHANGELOG.md; LICENSE; README.md; 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!