gitignore git files in flutter and dart project

.gitignore file contains a file or folder path that is considered not to commit in a flutter project.

Some different files or folders adds to the gitignore file in the flutter project

It creates files and folders while generating a flutter project for Android and IOS build

flutter gitignore build folder

build folder in the flutter project contains outputs of a compiled flutter build application.

This folder is generated by flutter. It is not required to commit to the repository.

build/

flutter gitignore pubspec.lock

pubspec.lock is a file generated by the build.

You can add library packages pubspec.lock in gitignore file.

Application-related pubspec.lock not required to add git ignore file.

.dart_tool/
.packages
pubspec.lock # library relate lock files

Flutter Dart/Pub git ignore

dartdoc tool generates API documentation(/doc/API/) which can be added to gitignore.

pub package manager generates a cache folder and pub folder that is not eligible to commit to the repository.

pub tool generates files and folders such as dart_tool, and packages.

**/doc/API/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/

Flutter gitignore IntelliJ

If your application opens Intelli Editor, It generates some Intelli-related files.

You can add these files.

*.iml
*.ipr
*.iws
.idea/

flutter vscode gitignore

Visual studio code generates the following files for the flutter project.

.classpath
.project
.settings/
.vscode/

Flutter Android gitignore

flutter project has an android folder containing code for android-related generated and native code.

It is generated by flutter SDK which can not be modified by the developer frequently.

**/android/**/gradle-wrapper.jar
.gradle/
**/android/captures/
**/android/gradlew.bat
**/android/gradlew
**/android/local.properties
**/android/key.properties
*.jks

Flutter gitignore IOS

flutter contains an ios folder that contains code generated for flutter SDK.

**/ios/Flutter/.last_build_id
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig

Flutter gitignore sample example

Here is a complete example

**/android/**/gradle-wrapper.jar
.gradle/
**/android/captures/
**/android/gradlew.bat
**/android/gradlew
**/android/local.properties \*_/android/key.properties
_.jks

.DS_Store
.idea/
**/ios/Flutter/.last_build_id
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/**/\*.pbxuser
**/ios/**/\*.perspectivev3
**/ios/**/\*sync/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
\*\*/ios/Flutter/Generated.xcconfig

/bin/cache/