Understanding different types of dependencies used in a Flutter project

Aman Khan Roohani
2 min readJan 6, 2022

Hi fellow curious problem solvers! I’m back with a new story and this time i’ll be talking about the different types of dependencies which are typically used in a flutter project.

There are 3 types of dependencies used in a flutter project. Those are:-

  1. Direct dependencies
  2. Dev Dependencies
  3. Transitive dependencies

Direct Dependencies:- These are the dependencies which directly impact and contribute to the functionality of your project and are used as an external package/plugin. Features provided by these dependencies can be directly used in our app.

Examples of direct dependencies are http, cached network image and any other package/plugin you install from pub.dev ;)

Direct dependencies pubspec.yaml representation

Dev Dependencies:- These are the dependencies that are not available for code in the resulting application, but only for tests, examples, tools, to add linter rules or to add executable tools to your project. flutter_test and flutter_lints are active examples of developer dependencies. ;)

Dev dependencies pubspec.yaml representation

Transitive Dependencies:- These are the dependencies which your package indirectly uses because one of its dependencies requires it. If your package depends on A, which in turn depends on B which depends on C, then A is an immediate dependency and B and C are transitive ones.

Package -> A………. A -> B…………… B -> C

Here package A is a transitive dependency as it depends on package B which eventually depends on package C. Firebase, html, args and clock are some examples of Transitive dependencies.

Transitive dependencies pubspec.yaml representation

I hope you have got a clear idea of what actually these dependency types are and their purpose of use. Will keep coming with more insights related to flutter. Until then, bbye ;)

Please don’t forget to clap if you understood the concept and do subscribe to my newsletter. This way you’ll get to know when i post something new. ;)

--

--

Aman Khan Roohani

Cross Platform Developer (Flutter) | Google Groups Contributor