I'm using too many packages in my flutter application, isn't a good thing to do so? do many packages harm the application's performance?
Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch.
dev has a growing ecosystem of over 24,000 packages to help you add functionality to your Flutter application and leverage solutions created by the community.
Of course, you can also create your own components, and for this, Flutter is truly excellent. Creating good looking custom UI elements is very easy, and you will have them working on both Android and iOS. This makes Flutter a perfect choice for mobile apps with advanced, custom UI designs.
Packages, according to Flutterdocs, can be explained as “shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows developers to quickly build an app without having to develop everything from scratch.”
With Flutter Packages, Flutter becomes more preferable for writing easy-to-use and customizable codes for building applications running well on iOS, Android, Windows, Linux, etc. Even many of the developers praise the ingenuity of these packages as while developing an application, they need not think about STARTING FROM THE SCRATCH.
Flutter supports using shared packages contributed by other developers to the Flutter and Dart ecosystems. This allows quickly building an app without having to develop everything from scratch. What is the difference between a package and a plugin?
To upgrade to a new version of the package, for example to use new features in that package, run flutter pub upgrade ( Upgrade dependencies in IntelliJ or Android Studio) to retrieve the highest available version of the package that is allowed by the version constraint specified in pubspec.yaml .
A plugin package is a special kind of package that makes platform functionality available to the app. Plugin packages can be written for Android (using Kotlin or Java), iOS (using Swift or Objective-C), web, macOS, Windows, Linux, or any combination thereof. For example, a plugin might provide Flutter apps with the ability to use a device’s camera.
After looking over the web I couldn't find a single article that talks about this issue, not even the flutter documentation.
But on their section about optimizing the app, the flutter team says about reducing app size(which can also affect performance obviously):
Some of the other things you can do to make your app smaller are:
Remove unused resources
Minimize resource imported from libraries
Support a limited number of screen densities
Compress PNG and JPEG files
looking at :
Remove unused resources
Minimize resource imported from libraries
You can conclude that inclding packages does not mainly hurt performance, but importing alot of resources from these packages into your file and not using them effeciently can hurt it (look at @jamesdlin 's comment:to understand why is that (its about tree shaking process)
If the packages you import have a lot of code that can't be tree-shaken away (e.g. code in the package is very interconnected), then it can impact the size of your binary.
And as a final note, from my usage of flutter and often usage of alot of packages in my apps (to save alot of boilerplate), I can't say that I notice any performance issues due to many packages being present in my app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With