发布 package 的时候避免提交的内容
When you put Dart source code in a repository—using the pub tool, GitHub, or another source code management system—don’t include most of the files that your IDE or code editor, the pub tool, and other tools generate.
Don’t commit the following files and directories created by pub:
.dart_tool/ build/ pubspec.lock # Except for application packages
Don’t commit the API documentation directory
Don’t commit files and directories created by other development environments. For example, if your development environment creates any of the following files, consider putting them in a global ignore file:
# IntelliJ *.iml *.ipr *.iws .idea/ # Mac .DS_Store
For more details, read on.
As a rule, commit only the files that people need to use your package or source code repository. Including additional files is unnecessary, could be counterproductive, and might have security implications if you expose details about your machine’s setup. In many source code repositories, the common practice is not to commit generated files, at all.
To avoid committing files that are
specific to your personal workflow or setup,
consider using a global ignore file
When you use pub from within a Git repo,
pub ignores the same files that Git does.
For example, if you run
pub publish from a Git repo
that has a
.gitignore file containing
then your published package won’t contain the
For more information on
see the GitHub help page
.dart_tool/ directory contains files used by
various Dart tools.
pubspec.lock file is a special case,
similar to Ruby’s
For library packages, don’t commit the
pubspec.lock file lets you test your package
against the latest compatible versions of its dependencies.
For application packages,
we recommend that you commit the
ensures changes to transitive dependencies are explicit.
Each time the dependencies change due to
dart pub upgrade
or a change in
the difference will be apparent in the lock file.