What a Flutter Repo Should Track
A fresh Flutter project already has dozens of files, and running it creates hundreds more. Commit them all and every clone is bloated and full of conflicts; commit too few and a teammate's copy will not build. The rule for choosing is short.
The rule
Track what you write, ignore what the tools rebuild, never commit secrets.
Track (the project is made of these):
lib/,test/andassets/: your code, tests and bundled files.pubspec.yaml: the app's name, dependencies, assets and fonts.pubspec.lock: the exact package versions resolved. For an app, commit it so every machine builds with the same versions.- Platform folders such as
android/,ios/andweb/: they hold settings like app icons and permissions that you edit. analysis_options.yaml,README.md, and the FVM config if you pinned a version.
Ignore (the tools recreate these):
build/: compiled output..dart_tool/: package and tool caches, rebuilt byflutter pub get.- Editor and machine files, and FVM's local
.fvmfolder.
The .gitignore that flutter create writes already lists most generated paths:
/build/
.dart_tool/
.flutter-plugins-dependenciesNever commit secrets such as API keys or signing keystores. Git keeps every version forever, so a key committed once and deleted later is still in the history.