built_value
generates .g.dart
code, but the docs don't give any hints if we should add them to our git repository or not.
I think we should, so devs cloning our repo could be up and running, without having to regenerate the code...But some people say generated code should never be committed, so, what's the recommendation for built_value
?
If you are building a library package that you want to reuse by other packages and applications, then you should commit it.
Code generation can not generate code in dependencies and pub publish
ignores .gitignore
d files. You would publish invalid packages. Also git-dependencies would not work in such cases.
There are packages that generate code only in the application project, also for code imported from dependencies, like reflectable
does. In this case you wouldn't need to commit the generated code.
I always commit such generated code even in application projects. These files have specific extentions like .g.dart
that can be excluded from code review to not cause noise or similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With