Deep Dive Into The Pubspec.yaml File

Gonçalo Palma
Flutter Community
Published in
7 min readOct 26, 2020

--

Photo by John Barkiple on Unsplash

Whether we are starting a new Flutter project for web, mobile or desktop, there are two thing that will be common in all projects: the pubspec.yaml and pubspec.lock files. In this article we will explore the pubspec.yaml file - what it is and what we can do with it.

The Pubspec.yaml File

When we create a new Flutter Project, we usually have the following file tree:

But what is exactly inside the pubspec.yaml file? Let's examine it:

As we can see, the pubspec.yaml file is divided into different sections, let's dive deep into each one.

General information — The Metadata

At the top of the file we see the name. This field dictates the package name, and also how we will import files inside this…

--

--

Gonçalo Palma
Flutter Community

Author, Flutter Lead Developer @Pvotal Tech. Organizer, Google Developer Expert for Flutter and Dart, Lead Flutter Developer. 🌍 https://gpalma.pt/