flutter-template
flutter-template copied to clipboard
Files which the `freezed` plugin generates should not be added to VCS
The following should be added to .gitignore :
**/*.freezed.dart
And the following command then ran :
git rm -r --cached .
git add .
And the result committed and merged.
I have a local branch with these changes if you will permit me to open a PR and create a remote branch.
Hi @diarmaidlindsay ✌️
It's controversial. On one of the projects we ignore all the generated files (*.g.dart, *.freezed.dart etc). And when you switch branches that contain schema changes you're forced to re-run the generator. Not convenient when you're testing the PRs during code reviews. It's ok if code generation takes around 30 seconds. But usually it takes more time.
I would love to hear your thoughts on that. Isn't it a trouble for you?
P.S. watching doesn't help in this case, unfortunately.
I have worked on 2 major Flutter projects so far in MonstarLab. Both used Freezed, and both excluded the generated files. It was accepted that when changing branches, it was always necessary to re-run the code generator as part of the build process. Honestly, it was never a burden, and it resulted in alot less noise in each PR because there was less changes generated.
I tend to use this handy script nowadays on our Flutter projects (rename to bootstrap.sh and place in your project's root, and run from the terminal) to run the code generator after changing branches :
@diarmaidlindsay personally I would not use that script as I prefer to control such things myself 😅
But that makes sense. PRs might be messy because of the generated code even if we ignore the corresponding files. And I would prefer to have "easier" PR reviews over not running code generation.
@johsoe what do you think?
I agree with @diarmaidlindsay, it's a bit inconvenient when switching branches, but overall advantages outweigh it.
Launch tasks in vs code already does this for you, same should be doable in AS (rather than the custom scripts.. :D)
@johsoe I hate those launch tasks 😛 Have it modified all the time.
Agree — let's add the generated files (*.g.dart as well) to the gitignore
If you guys will make the change then I'll close this issue. Otherwise please permit me to make a Branch + Pull Request.
@diarmaidlindsay you can fork the repo, create a new branch and then open a PR here using that branch.
@diarmaidlindsay I have opened a PR for it, #78