Skip to content
language14 active rulesVerified 2026-09-30

Dart .gitignore Template

Dart SDK packages, pub cache, build outputs, and doc generation. Generated and merged deterministically with upstream GitHub repository patterns to keep your repository clean of package directories, temporary build artifacts, and local environment files.

Interactive Stack Generator

Open in Full Generator
Search for templates
Quick add:
Selected1
Dart
Selected Templates (1)
.gitignore
### Dart ###
# See https://www.dartlang.org/guides/libraries/private-files
# Files and directories created by pub
.dart_tool/
.packages
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/
# dotenv environment variables file
.env*
# Avoid committing generated Javascript files:
*.dart.js
# Produced by the --dump-info flag.
*.info.json
# When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js
*.js_
*.js.deps
*.js.map
.flutter-plugins
.flutter-plugins-dependencies
14 rules1 template31 lines
Deterministic

Raw Dart .gitignore

Crawlable upstream source template
dart.gitignore30 lines
# See https://www.dartlang.org/guides/libraries/private-files
# Files and directories created by pub
.dart_tool/
.packages
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock
# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/
# dotenv environment variables file
.env*
# Avoid committing generated Javascript files:
*.dart.js
# Produced by the --dump-info flag.
*.info.json
# When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js
*.js_
*.js.deps
*.js.map
.flutter-plugins
.flutter-plugins-dependencies

Key Pattern Breakdown

Dependencies & Packages

Excludes installed package directories and third-party vendor files that should be restored via package managers.

.packages

Build & Compilation Artifacts

Ignores compiled binaries, intermediate object files, and build output directories generated during development.

build/

Environment & Secrets

Prevents leaking sensitive local credentials, API keys, database URLs, and environment configuration files.

.env*

Source & Verification

License:: CC0-1.0

Place this file in the root directory of your project as .gitignore. Changes take effect on newly added or untracked files.