Publishing a Dart Package

pub publish and .gitignore

pub publish is used to publish Dart packages to, and the --dry-run option shows the files it will upload without doing it. The documentation states that files and directories that are ignored by .gitignore should not be uploaded, yet I was seeing them in the output of pub publish --dry-run, even after explicitly adding them to .gitignore. Why? They were checked in. It took me way too long to work that one out. The easy fix is to remove the files, publish, then git reset --hard. It’s not very CI friendly, though.