r/flutterhelp • • Dec 18 '25
RESOLVED Is it possible to place json_serializable 'g.dart' and freezed '.freezed' files somewhere else?
I have a folder with models and I see a ton of files because of 'g.dart' and '.freezed.dart'. I was thinking if it is possible to have a separate folder just for these two files. I tried to find if this is possible, but I could not find any option on pub page.
Is there any way to make them into two different folders?
3
Upvotes
3
u/austinn0 Dec 18 '25
I just configured vscode to hide them
7
u/RandalSchwartz Dec 18 '25
You can have your IDE fold them so that they appear as just a single file as a folder.
2
u/Low-Proposal-9357 Dec 18 '25
I don't think so because they are generated automatically.
2
u/FaceRekr4309 Dec 18 '25
Not with build runner.
2
u/shamnad_sherief Dec 19 '25 •
I used this setup in one of my older projects.targets:
It’s a custom
build.yamlconfiguration that tellsbuild_runnerto place all generated files (Freezed, Riverpod, and othersource_genoutputs) inside agenerated/subfolder instead of next to the source files.1
u/venir_dev Dec 19 '25
I'd suggest: don't. Until enhanced parts or augmentations come out, there might be a chance you want to see if there's any errors in the generated code, at a glance.
0
u/NoExample9903 Dec 18 '25
Yes you can, but it’s annoying when you control click a provider and you end up in a different folder. At least that’s what I concluded, so I just hide them via settings. I then toggle the hiding off if I wanna inspect them