Why and how to choose the right Flutter package
For every new developer, it is important to follow the core principles of software engineering:
DRY (Don’t Repeat Yourself)
KISS (Keep It Simple, Stupid)
YAGNI (You Ain’t Gonna Need It)
But in this blog, we’ll focus on the fourth principle, the one that predates software engineering; Don’t Reinvent The Wheel.
A quick note: This blog has been written with an eye that solely focuses on using Flutter packages for greater productivity. If you are new at Flutter, read our previous blog for a thorough understanding.
Coming back to the fourth principle; it simply implies that one should avoid spending time and effort solving problems that others have already solved. For a developer who is using Flutter for cross-platform app development, a simple way of putting this principle into practice is by using packages that are supported by the Flutter ecosystem.
How do third-party packages work?
Before diving in further, let’s first understand what third-party packages are and how they help you in becoming a more productive and effective programmer.
A package, just like a library, helps reduce development time. It is a reusable software component developed to be either freely distributed or sold by an entity other than the original vendor of the development platform.
Using these packages, you do not need to develop the functionality that it provides,
instead, you can focus on the core business logic of your app; the features that matter.
To develop an understanding of integrating a package, you are required to spend some time reading the documentation, but this is just a fraction of time compared to developing the functionality from scratch.
Flutter packages - Don’t reinvent the wheel :
With ample other features that Flutter offers, another best part of Flutter is that it supports plenty of shared packages contributed by other developers to be used in the Flutter and Dart ecosystems. This ingenuity leads to quick app development since developers don’t have to build things from scratch. Because of the rich package ecosystem, it’s a more likely scenario that there is already an existing Flutter package that you could use to make your job easier. When chosen methodically and intelligently, these packages are great time-saving sources.
Searching for Flutter packages:
All Flutter packages are published at pub.dev. Its landing page displays the top packages that are compatible with Flutter. The ‘Flutter Favourite’ page on pub.dev lists all the plugins and packages that demonstrate the highest levels of quality, selected by the Flutter Ecosystem Committee. You can also browse platform-specific packages by filtering Android plugins, iOS plugins, web plugins or any other combination.
Choosing the right Flutter package:
Similar to how Github has different metrics to evaluate a particular library, pub.dev also has a way where you can check the quality of the package under consideration.
Below are some of the metrics that can help you choose the right Flutter package:
Likes: A measure of how many developers have liked a package. This provides a raw measure of the overall sentiment of a package from peer developers.
Pub Points: A new measure of quality. This includes several dimensions of quality such as code style, platform support, and maintainability.
Popularity: A measure of how many developers use a package, providing insight into what other developers are using.
Author Credibility: Other than these parameters, you can also run a background check on authors. Are they active on Github? How often do they respond to the issues, solve bugs and accept pull requests? Have they released multiple libraries/packages? Generally, it is considered that if the package is actively supported by its author, it’s a good sign that in the long run, it will remain stable through platform and framework updates.
Hopefully, this blog helped you expand your knowledge regarding the advantages of third-party packages which are compatible with the Flutter ecosystem and also with the framework to filter through them; weeding out unsuitable or unreliable ones. Although there are other frameworks as well which support various third-party packages but given our experience in Mobile App Development, there is no doubt that using Flutter is an ideal option.
Google has announced Flutter 2.2, its latest release of the open-source toolkit for building beautiful apps for any device from a single platform. Read more about it: https://medium.com/flutter/announcing-flutter-2-2-at-google-i-o-2021-92f0fcbd7ef9