What does flutter pub get do?

Why Interviewers Ask This

This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Flutter topics. It also reveals how well you can explain technical ideas to non-experts.

Answer

flutter pub get reads the pubspec.yaml file and downloads all declared dependencies (and their transitive dependencies) from pub.dev, placing them in the local pub cache. It also generates the pubspec.lock file, which pins the exact versions used, ensuring consistent builds across machines and over time. You run this command after adding a new package to pubspec.yaml or after cloning a project for the first time.

Common Mistake

Rushing to answer is a common mistake. Take two seconds to structure your response: definition → example → trade-off. This structure makes complex Flutter answers easy to follow.