How to exclude files from pub publish for Dart packages? How to exclude files from pub publish for Dart packages? dart dart

How to exclude files from pub publish for Dart packages?


You can now create a .pubignore file to do this. See this PR for more details on how this works.


You can add them in .gitignore while publishing to pub.dev and later remove from .gitignore before pushing to GitHub.

Referenced from dart documentation.

What files are published? All files in your package are included in the published package, with the following exceptions: Any packages directories. Your package’s lockfile. If you aren’t using Git, all hidden files (that is, files whose names begin with .). If you’re using Git, any files ignored by your .gitignore file. Be sure to delete any files you don’t want to include (or add them to .gitignore). pub publish lists all files that it’s going to publish before uploading your package, so examine the list carefully before completing your upload.