How to Add a dependency in pubspec.yaml
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 underdev_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.
#HappyCoding #flutter