How to Add a dependency in pubspec.yaml

Vivek Yadav
1 min readSep 30, 2019

--

We will see how we can add a dependency in pubspec.yaml

YAML:- Yet Another Markup Language.

dependencies: 
In this section, you list each package that your package needs in order to work.

Dependencies fall into one of two types. Regular dependencies are listed under dependencies:—these are packages that anyone using your package will also need. Dependencies that are only needed in the development phase of the package itself are listed under dev_dependencies.

Let’s see an example.

We will add path_provider in pubspec.yaml

Before

dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2

After

dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
path_provider: ^1.3.0

This file is indent sensitive. So give indention in the right amount.

Let me know if you find difficult to do this. I would love to solve your problems.

Connect with me on: Github Twitter LinkedIn Instagram Youtube Patreon

#HappyCoding #flutter

**Subscribe for upcoming posts. Thanks for reading. Let me know what you think about this post.

--

--

Vivek Yadav
Vivek Yadav

Written by Vivek Yadav

Writer , Speaker, Instructor and Flutter Dev

No responses yet