Skip to the workspace
Pebellslearn by building
Version Control with Git and GitHub  ›  Lesson

What a Flutter Repo Should Track

Git 12 minA Flutter repository tracks source, configuration and the pubspec lock file, while generated folders like build and .dart_tool and any secrets are kept out with .gitignore.

flutter / What a Flutter Repo Should Track

Explore each scene at your own pace.

01 · The rule

The rule

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/ and assets/: 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/ and web/: 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 by flutter pub get.
  • Editor and machine files, and FVM's local .fvm folder.

The .gitignore that flutter create writes already lists most generated paths:

/build/
.dart_tool/
.flutter-plugins-dependencies

Never 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.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.