juniorFlutter
What is the pubspec.yaml file?
Updated Apr 28, 2026
Short answer
It is the configuration file for a Flutter/Dart project, defining metadata, dependencies, and assets.
Deep explanation
The pubspec.yaml file is written in YAML. It manages the package dependencies downloaded from pub.dev, sets version constraints, declares project assets like images and custom fonts, and specifies the Flutter SDK version requirements.
Real-world example
Adding an external library like 'http' to make network calls, or adding a company logo image to the project.
Common mistakes
- Incorrect YAML indentation, which causes parsing errors and prevents packages from fetching.
Follow-up questions
- What does the caret (^) mean in versioning?
- What is pubspec.lock?