Dependency vs Dev Dependency in Flutter
Hi Coders,
My name is Amit and today i this article i am gonna talk about a very important topic in Flutter as you already read the topic name which is Dependency vs Dev Dependency
If you want to watch video in this topic then check my YouTube video 👉 YouTube
Before going to that answer i am gonna tell
What is Dependency?
Dependencies means depend which means we are depend upon something and what's that ,That thing is those packages which we keep in our pubspec.yaml file for example suppose you need to add QR Code scanner in your App so how you will do that
for that you have 2 ways:
- Create your own code scanner code which take long and and lots of codes which will increase the size of app
- Use someone else QR Code scanner package because that person already write a long code and make it very simple to use that code just by using that with some parameters describe for QR Code scanner.
Why developer should know about this topic?
- Mostly asked in interview questions
- Basic but Deep topic which every flutter developer who wants to grow as Flutter developer should know about this
- Curiosity
Now Let's talk about the differences between our above topic
Dependency :
Here you will keep those packages which will we used in production app such that suppose you need to show maps in your app and you install and keep maps package in this dependency file because you want to show maps to user.
Dev Dependency:
Here you will keep those packages which you don't want to use to show in your production app
Let's make it more simpler
Here you will keep packages which you need while you working on app as developers i.e. In debug mode
for example when you first create an App you saw there is an already present package called Lints which used to show error while debugging or you saw error instantly when you declare String Value as Int datatype and this error show because of this package But do you need this package in your production app or final app .
answer is No because users not interested to see the code or how developer write code .So what is the need of this package in production app that's where this Dev Dependency play a magical role.
In final/production app this Dev Dependency never included or you can say it will eliminated