I created a new app and the Dart Editor (M4) created a slew of files and folders. Now I\'m not sure which I can safely put in the gitignore. Here\'s the tree:
Dart default
.packages # mapping file from package names to local path
packages # until `--no-package-symlinks` is the default
build/ # contains the output of `pub build`
.pubspec.lock # controversial - Dart guideline is to only commit
# for applications but not for packages
.pub/ # cache files generated by `pub`
# .pub was moved to .dart_tool/.pub
build The new https://github.com/dart-lang/build package introduces a
.dart_tool/
directory which should be excluded.
When it comes to generated files it is generally best to not submit them to source control, but a specific Builder may provide a recommendation otherwise.
IDE
.idea # IntelliJ, WebStorm
bazel
/bazel-*
.bazelify
packages.bzl
BUILD
WORKSPACE
See also
Don’t commit the following files and directories created by pub, Dart Editor, and dart2js:
packages/
pubspec.lock // Except for application packages
.project
.buildlog
*.js_
*.js.deps
*.js.map
Don’t commit files and directories dropped by other development environments. For example:
.project // Eclipse
*.iml // IntelliJ
*.ipr // IntelliJ
*.iws // IntelliJ
.idea/ // IntelliJ
.DS_Store // Mac
Avoid committing generated JavaScript files:
*.dart.js
For more details, read https://www.dartlang.org/tools/private-files.html.
From What Not to Commit on dartlang.org:
# files and directories created by pub
.dart_tool/
.packages
.pub/
build/
pubspec.lock # Except for application packages
# API documentation directory created by dartdoc
doc/api/
# files and directories created by other development environments
*.iml # IntelliJ
*.ipr # IntelliJ
*.iws # IntelliJ
.idea/ # IntelliJ
.DS_Store # Mac
# generated JavaScript files
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
An up to date sample Dart .gitignore is available in the gitignore repo on Github:
https://github.com/github/gitignore/blob/master/Dart.gitignore
Note that this does not contain IDE or editor files, just Dart files. You can find IDE and editor .gitignores in the same repo.
I include doc/api
in my .gitignore. I tend to write substantial documentation comments and I like to use dartdoc
to generate the documentation for review.