A closer look at the top five packages on Pub.Dev

Are you a beginner starting on Flutter or just need some package recommendations? Today we have compiled a list of the top 5 packages on Pub.Dev which will give you key insights. Let’s dive right in to it.

Provider Package:

The provider package is the simplest of all the provider widget types. It’s a wrapper that envelopes InheritedWidget to make them simpler to use and even more reusable. The Provider has features of simplicity and flexibility, which is why Google made Provider the optimal Package for state management.

The Provider can provide value anywhere in the widget tree, but it doesn’t allow you to update the widget tree when the original value changes. The provider widget does not look for changes in the actual value.

You can create and store any state object in the widget tree, and it will be accessible to all sub- widgets. The Provider is also used to implement BLoC components, or it can be used for dependency injection. The Provider comes with seven specialized classes.

shared_preferences Package:

Using key: value pair in Android and iOS devices does reading and storing data very simple. This method is being used in the majority of apps on the store. Flutter has a package called shared_preferences, which helps us manage key: value data easily.

Shared_preferences can be used to store a small value, such as a flag that you need to reference in the future. For example, if you want to refer something when a user launches your app, you can use shared_preferences. Using SQLite for storing small data is not a good strategy as you’ll need to write an extended code. Please don’t use it for storing any critical data.

url_launcher Package:

This Package does precisely what the name suggests. You can implement this on your Android or iOS applications to launch a specific URL. You can redirect the user to a webpage, a website, or even a YouTube video.

By default, Android applications open up a new browser when redirected to a URL. You also have the freedom to open a web view within the app. On iOS, every URL redirect is opened.

flutter_bloc Package:

The flutter_bloc Package is used to implement a BLoC pattern. BLoC stands for business logic components. This pattern is used in Flutter to divide the business logic from the presentation layer. You write all the business logic in a separate bloc file. A BLoC takes a stream of events as input and converts that into a stream of states as an output. You don’t have to keep any local state in your app if you’re using BLoC.

google_fonts Package:

Another simple yet powerful package. Google_fonts does precisely what the name suggests. This Flutter package allows you to effortlessly use any of the total 977 fonts directly in your application. These fonts reside in http://fonts.google.com. This Package is cached and dynamic for Flutter applications.

You don’t need to store .otf or .ttf files in your Flutter project when using google_fonts. This Package is retrieved in the application at run time through HTTP and stored in the cache memory, which is ideal for reducing app bundle size.

1 year ago