7

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?

Ojonugwa Jude Ochalifu
  • 26,627
  • 26
  • 120
  • 132
Khader Murtaja
  • 425
  • 1
  • 5
  • 15
  • 1
    See https://stackoverflow.com/questions/52286143/what-is-a-legit-gitignore-for-a-flutter-project-that-is-developed-in-android-st – Karol Lisiewicz Feb 28 '20 at 09:20
  • Unfortunately, it is not helpful! – Khader Murtaja Feb 28 '20 at 09:27
  • 1
    Does this answer your question? [What is a legit .gitignore for a Flutter project that is developed in Android Studio?](https://stackoverflow.com/questions/52286143/what-is-a-legit-gitignore-for-a-flutter-project-that-is-developed-in-android-st) – phd Feb 28 '20 at 13:20

1 Answers1

12

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)

Lucas Gras
  • 961
  • 1
  • 7
  • 22
  • 6
    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. – Julio Henrique Bitencourt Jul 19 '20 at 22:06