Igor's corner

Hiding generated flutter files in Android Studio

Last updated on

Say you are following Flutter best practices using immutable models, and historically the best way of doing it have been the freezed package.

If you do - you are likely annoyed with all the files generated by it where you end up with 3 files instead of 1. Excluding these files from IDE altogether is not practical since you may want to pick into the generated code to see what it actually looks like, especially in case of providers. So is there a way to make these files less annoying when you don’t need them? Yes! You can hide them from the project file tree while keeping them accessible when needed, it looks like so:

collapsable_files

It is very easy to enable this. Go to Project settings -> Appearance -> File nesting

file_nesting_menu

And add file extensions of generated files. .freezed.dart and .g.dart in our case.

file_nesting_extensions_add

That’s it. Simple.