Flutter .gitignore template
The Flutter template covers the Dart tool directory plus the generated plugin manifests and the per platform build artefacts on both mobile targets.
At a glance
- Category
- Framework
- Patterns in this template
- 16 rules
- Directories ignored
- 5 of the 16 rules end in a slash, so they match directories only
- Also needs an OS template
- macOS in particular, since iOS builds leave file manager artefacts through the project.
- Typical companions
- Dart is largely included already. Add an IDE template and an OS template.
In detail
.flutter-plugins and .flutter-plugins-dependencies are generated manifests listing which plugins the project uses and where their packages live on this machine. They contain absolute paths into the package cache in your home directory, which is exactly why they are regenerated rather than shared, and a committed copy points at a directory that does not exist for anyone else.
The Android rules cover /android/app/debug, /android/app/profile and /android/app/release. Those are the three build modes, and each produces a full set of compiled output. The framework's own scaffolding creates them lazily, so a fresh clone will not have them until the first build for that mode runs.
The iOS rules are more interesting. /ios/Pods holds the dependency manager's installed sources, restored from a manifest, and /ios/.symlinks holds generated symbolic links pointing back into the plugin packages. /ios/Flutter/Flutter.framework and Flutter.podspec are the engine binary and its specification, copied in by the tooling during a build rather than authored.
pubspec.lock is ignored, and for an application that is the wrong default. The lockfile pins every dependency to an exact version, and an app is exactly the case where you want a build in CI to resolve the same packages a developer tested against. Most teams remove that line. Only a published package has a real argument for leaving it out.
.metadata records which framework version created the project and which platform scaffolds have been migrated. It is genuinely used by the upgrade tooling, so ignoring it is another line worth reviewing rather than accepting: without it, a migration command has to guess where the project started. Between that line and the lockfile line, this is a template where two of the defaults are worth changing before the first commit rather than after.
Examples
.dart_tool/
.packages
build/
.flutter-plugins
.flutter-plugins-dependencies
*.iml
.idea/
.metadata
pubspec.lock
/android/app/debug
/android/app/profile
/android/app/release
/ios/Flutter/Flutter.framework
/ios/Flutter/Flutter.podspec
/ios/.symlinks/
/ios/Pods/16 lines exactly as the tool writes them, before any common additions you tick.
Things that catch people out
- pubspec.lock is ignored by default. For an application, remove that line so CI and every developer resolve identical dependency versions.
- .metadata is used by the platform migration tooling. Ignoring it makes future upgrade commands less accurate, and most teams track it.
- The template ignores .idea and *.iml, which duplicates the IntelliJ template. Adding both is harmless but means the same rules appear twice in the output.
Try it: .gitignore Generator
Pick one or more templates, tick the common additions you want, and copy or download the combined .gitignore.
.gitignore Generator
LOCAL · Browser-OnlyGenerate comprehensive .gitignore files by combining templates for languages, frameworks, IDEs, and operating systems
Language
Framework
IDE
OS
Build Tool
Infrastructure
Common Additions
Preview
Select templates or common additions to generate a .gitignore file.
Related .gitignore templates
All .gitignore templates →Dart .gitignore template
The Dart template ignores the tool directory, generated docs and compiled JavaScript output, and ignores pubspec.lock, which an application should commit.
Android Studio .gitignore template
The Android Studio template ignores local.properties, which names the SDK path on one machine, along with build output, captures and native build directories.
Xcode .gitignore template
The Xcode template ignores the project bundle's contents while keeping the project file and shared data, the only way to share schemes but not sessions.
Unity .gitignore template
The Unity template ignores the import cache, temporary build state and the IDE project files the editor regenerates, using bracket classes for case safety.
Unreal Engine .gitignore template
The Unreal template ignores compiled binaries, the intermediate build tree, the derived data cache and the saved directory, plus generated project files.
VS Code .gitignore template
This template ignores the .vscode folder's contents but keeps five files back on purpose, which is the clearest statement of the commit or ignore argument.
Tools for this
- .gitignore Generator Generate .gitignore files for any project - 50+ templates for languages, frameworks, IDEs, and OS