Which files to upload to version control from a Flutter project?

I want to upload my Flutter projects to Github.

But, I don't know which files or folders should I upload and which I should add to the .gitignore file!

Here are the Folders:

  • .dart_tool
  • .idea
  • android
  • build
  • images
  • ios
  • lib

Here are the Files:

  • .gitignore
  • .metadata
  • .packages
  • i_am_rich.iml
  • pubspec.lock
  • pubspec.yaml
  • README.md

So, which Folders and Files?


Looking folder by folder

1) .dart_tool is generated, you don't need to push it

2) .idea, never push this folder, it's generated by your IDE

3) .package, it'll be generated when you install dependencies, no need to push it

4) i_am_ruch.iml, IML is a module file created by IntelliJ IDEA, no need to push it

5) pubspec.lock is generated by pub, you don't need to push it

6) build folder is generated during the project's build

So finally, you must push the android, lib, ios, images, .gitignore, pubspec.yaml and README.md

  • ios, android folder contains native code and configuration for each platform
  • lib contains you flutter code
  • images, I guess it's resources
  • pubspec.yaml contains dependencies to install during pub get, and some project configuration

If you want the perfect flutter' gitignore: here it is (from official Flutter Github Repository)