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

2,162

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)

Share:
2,162
Khader Murtaja
Author by

Khader Murtaja

Junior Node.js Developer with one-year work experience worked on medium, and small projects. Core experiences include Node.js, Express.js, and PostgreSQL. Have a small experience in Flutter.

Updated on December 18, 2022

Comments

  • Khader Murtaja
    Khader Murtaja over 1 year

    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?

  • Julio Henrique Bitencourt
    Julio Henrique Bitencourt almost 4 years
    If you're working on a application (not a library), you should definitely version control pubspec.lock. This way other developers will make sure they're using the same lib versions.