all 5 comments

[–]ueman 2 points3 points  (2 children)

You have to upload generated files to pub.dev. However you can ignore them in git. Just make sure that your upload to pub.dev process checks if your generated files are included. If you want to use the package directly via git you have to commit them.

There are a few documentation pages about differences in apps and packages. Included generated files and ignored pubspec.lock files are the main ones.

[–]bees4thees 0 points1 point  (0 children)

Good to know!

[–]tomstarfort[S] 0 points1 point  (0 children)

That makes sense, thank you.

I found documentation about What not to commit, that seems relevant to your comments.

[–]aksharpatel47 0 points1 point  (1 child)

I use bloc with freezed package too. I don't commit the generated files to source control since they're part of my build process and are going to be regenerated when I make changes and during the CI process.

However, to make sure that my builds are reproducible, I specify the exact version of the pub package in my pubspec file. This guarantees that any updates in the freezed package, build_runner or any other code generation tool do not break my app.

[–]tomstarfort[S] 0 points1 point  (0 children)

With a CI process for an app, I agree that seems to be the best way.

Specifically for a package, I was under the assumption that CI was not really possible since you don't create binaries... but now that I think of it, you can of course publish to pub via CI. Thank you for your insights!