Skip to content

Instantly share code, notes, and snippets.

@dileepadev
Last active December 30, 2023 22:37
Show Gist options
  • Star 58 You must be signed in to star a gist
  • Fork 18 You must be signed in to fork a gist
  • Save dileepadev/43f37affb84650a7e59ff04204c44aa8 to your computer and use it in GitHub Desktop.
Save dileepadev/43f37affb84650a7e59ff04204c44aa8 to your computer and use it in GitHub Desktop.
.gitignore for Flutter projects
### ------------------------- Flutter.gitignore ------------------------ ###
# Miscellaneous
*.class
#*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# Visual Studio Code related
.classpath
.project
.settings/
.vscode/
# Flutter repo-specific
/bin/cache/
/bin/internal/bootstrap.bat
/bin/internal/bootstrap.sh
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/devicelab/ABresults*.json
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
analysis_benchmark.json
# packages file containing multi-root paths
.packages.generated
# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
**/generated_plugin_registrant.dart
.packages
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds
# Android related
**/android/**/gradle-wrapper.jar
.gradle/
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
# *.jks
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
# Coverage
coverage/
# Symbols
app.*.symbols
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
## Related .gitignores ##
# Firebase configuration files / Google Services (e.g. APIs or Firebase)
ios/Runner/GoogleService-Info.plist
android/app/google-services.json
# Google Maps API
google_maps_api.xml
# Web related
lib/generated_plugin_registrant.dart
# Obfuscation related
app.*.map.json
### --------------------------- Dart.gitignore ------------------------- ###
# See https://www.dartlang.org/guides/libraries/private-files
# Files and directories created by pub
#.dart_tool/
#.packages
#build/
# If you're building an application, you may want to check-in your pubspec.lock
#pubspec.lock
# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/
# dotenv environment variables file
.env*
# Avoid committing generated Javascript files:
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
#.flutter-plugins
#.flutter-plugins-dependencies
### -------------------------- Swift.gitignore ------------------------ ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
#xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
#*.xcscmblueprint
#*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
#build/
#DerivedData/
#*.moved-aside
#*.pbxuser
#!default.pbxuser
#*.mode1v3
#!default.mode1v3
#*.mode2v3
#!default.mode2v3
#*.perspectivev3
#!default.perspectivev3
## Obj-C/Swift specific
*.hmap
## App packaging
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
Packages/
Package.pins
Package.resolved
*.xcodeproj
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
.swiftpm
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build/
# Accio dependency management
Dependencies/
.accio/
# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output
# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
### -------------------------- Java.gitignore -------------------------- ###
# Compiled class file
#*.class
# Log file
#*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
#*.jar
*.war
*.nar
*.ear
#*.zip
*.tar.gz
#*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### -------------------------- Kotlin.gitignore ------------------------ ###
#.DS_Store
.idea/shelf
/confluence/target
/dependencies/repo
/android.tests.dependencies
/dependencies/android.tests.dependencies
/dist
/local
/gh-pages
/ideaSDK
/clionSDK
/android-studio/sdk
#out/
/tmp
/intellij
workspace.xml
*.versionsBackup
/idea/testData/debugger/tinyApp/classes*
/jps-plugin/testData/kannotator
/js/js.translator/testData/out/
/js/js.translator/testData/out-min/
/js/js.translator/testData/out-pir/
#.gradle/
#build/
!**/src/**/build
!**/test/**/build
#*.iml
!**/testData/**/*.iml
.idea/remote-targets.xml
.idea/libraries/Gradle*.xml
.idea/libraries/Maven*.xml
.idea/artifacts/PILL_*.xml
.idea/artifacts/KotlinPlugin.xml
#.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/runConfigurations/PILL_*.xml
.idea/runConfigurations/_FP_*.xml
.idea/runConfigurations/_MT_*.xml
#.idea/libraries
#.idea/modules.xml
#.idea/gradle.xml
#.idea/compiler.xml
.idea/inspectionProfiles/profiles_settings.xml
.idea/.name
.idea/artifacts/dist_auto_*
.idea/artifacts/dist.xml
.idea/artifacts/ideaPlugin.xml
.idea/artifacts/kotlinc.xml
.idea/artifacts/kotlin_compiler_jar.xml
.idea/artifacts/kotlin_plugin_jar.xml
.idea/artifacts/kotlin_jps_plugin_jar.xml
.idea/artifacts/kotlin_daemon_client_jar.xml
.idea/artifacts/kotlin_imports_dumper_compiler_plugin_jar.xml
.idea/artifacts/kotlin_main_kts_jar.xml
.idea/artifacts/kotlin_compiler_client_embeddable_jar.xml
.idea/artifacts/kotlin_reflect_jar.xml
.idea/artifacts/kotlin_stdlib_js_ir_*
.idea/artifacts/kotlin_test_js_ir_*
.idea/artifacts/kotlin_stdlib_wasm_*
.idea/artifacts/kotlinx_atomicfu_runtime_*
#.idea/jarRepositories.xml
.idea/csv-plugin.xml
.idea/libraries-with-intellij-classes.xml
.idea/misc.xml
node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
#local.properties
buildSrcTmp/
distTmp/
outTmp/
/test.output
/kotlin-native/dist
kotlin-ide/
### ------------------------- Android.gitignore ------------------------ ###
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Generated files
bin/
gen/
out/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
#fastlane/report.xml
#fastlane/Preview.html
fastlane/screenshots
#fastlane/test_output
fastlane/readme.md
# Keystore files
*.jks
*.keystore
### ------------------------- Gradle.gitignore ------------------------- ###
.gradle
**/build/
!src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# Eclipse Gradle plugin generated files
# Eclipse Core
#.project
# JDT-specific (Eclipse Java Development Tools)
#.classpath
### ------------------------- Maven.gitignore -------------------------- ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
# Eclipse m2e generated files
# Eclipse Core
#.project
# JDT-specific (Eclipse Java Development Tools)
#.classpath
### ------------------------ JetBrains.gitignore ----------------------- ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
.idea/artifacts
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
#*.iws
# IntelliJ
#out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### ------------------------- Xcode.gitignore -------------------------- ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
#build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Gcc Patch
/*.gcno
### -------------------- VisualStudioCode.gitignore ------------------- ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### ----------------------- SublimeText.gitignore ---------------------- ###
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# Workspace files are user-specific
*.sublime-workspace
# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project
# SFTP configuration file
sftp-config.json
sftp-config-alt*.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
### -------------------------- Emacs.gitignore ------------------------- ###
# -*- mode: gitignore; -*-
#*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data
### -------------------------- Vim.gitignore -------------------------- ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
#*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
### ------------------------ Windows.gitignore ------------------------ ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### ------------------------- macOS.gitignore -------------------------- ###
# General
#.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### -------------------------- Linux.gitignore ------------------------- ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### ------------------------ Archives.gitignore ------------------------ ###
# It's better to unpack these files and commit the raw source because
# git has its own built in compression methods.
*.7z
*.jar
*.rar
*.zip
*.gz
*.gzip
*.tgz
*.bzip
*.bzip2
*.bz2
*.xz
*.lzma
#*.cab
*.xar
# Packing-only formats
*.iso
*.tar
# Package management formats
*.dmg
*.xpi
*.gem
*.egg
*.deb
*.rpm
#*.msi
#*.msm
#*.msp
*.txz
### ------------------------- Backup.gitignore ------------------------- ###
*.bak
*.gho
*.ori
*.orig
*.tmp
### -------------------------- JEnv.gitignore -------------------------- ###
# JEnv local Java version configuration file
.java-version
# Used by previous versions of JEnv
.jenv-version
### ------------------------- Project Specific ------------------------- ###
# Include any specific files here.
### ---------------------------- References ---------------------------- ###
# Flutter - https://github.com/flutter/flutter/blob/master/.gitignore
# Dart - https://github.com/github/gitignore/blob/main/Dart.gitignore
# Swift - https://github.com/github/gitignore/blob/main/Swift.gitignore
# Java - https://github.com/github/gitignore/blob/main/Java.gitignore
# Kotlin - https://github.com/JetBrains/kotlin/blob/master/.gitignore
# Android - https://github.com/github/gitignore/blob/main/Android.gitignore
# Gradle - https://github.com/github/gitignore/blob/main/Gradle.gitignore
# Maven - https://github.com/github/gitignore/blob/main/Maven.gitignore
# JetBrains - https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# Xcode - https://github.com/github/gitignore/blob/main/Global/Xcode.gitignore
# VisualStudioCode - https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# SublimeText - https://github.com/github/gitignore/blob/main/Global/SublimeText.gitignore
# Emacs - https://github.com/github/gitignore/blob/main/Global/Emacs.gitignore
# Vim - https://github.com/github/gitignore/blob/main/Global/Vim.gitignore
# Windows - https://github.com/github/gitignore/blob/main/Global/Windows.gitignore
# macOS - https://github.com/github/gitignore/blob/main/Global/macOS.gitignore
# Linux - https://github.com/github/gitignore/blob/main/Global/Linux.gitignore
# Archives - https://github.com/github/gitignore/blob/main/Global/Archives.gitignore
# Backup - https://github.com/github/gitignore/blob/main/Global/Backup.gitignore
# JEnv - https://github.com/github/gitignore/blob/main/Global/JEnv.gitignore
@dileepadev
Copy link
Author

⚠️ SPECIAL NOTICE

Hello, Flutter developers! This gitignore is designed to cover an area commonly used for flutter projects. If you are going to follow this file, please make sure to remove unnecessary files and directories. Also, be sure to edit the file as your project requires. So if you find a mistake or anything that needs to be changed, please let me know.

Remember, this file can be edited with the latest changes, so please be sure to keep up to date with the latest updates. 🔔

@sahan-senvar
Copy link

thank youu

@amir-arad
Copy link

missing:
windows/flutter/generated_plugin_registrant.cc
windows/flutter/generated_plugins.cmake

@MinHyuckYoon
Copy link

very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment