Igor's corner

Hiding generated flutter files in Android Studio

Published 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 alltogather is not practical since you may need to reference the generated code, especially in case of providers, how else can you make them less annoying? You can at least 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.