Check out example codes for "git ignore for dart". It will help you in understanding the concepts better.

Code Example 1

.dart_tool/
.packages
build/
pubspec.lock  # Except for application packages
# IntelliJ
*.iml
*.ipr
*.iws
.idea/

# Mac
.DS_Store

Code Example 2

.dart_tool/
.packages
build/
pubspec.lock # Except for application packages

Learn ReactJs, React Native from akashmittal.com