Flutter —The perfects packages to start your application development

Maxime F.
4 min readNov 12, 2022

Developing an application demands to structure it in different parts that respect some specifications of the architecture or design patterns we want to apply.

Some parts are common to every applications and for each part nowadays there’s a package that is perfect for the use cases required.

These parts are:

  • Routing
  • State management
  • Dependency Injection / Service Locator
  • Components / Services / Use cases
  • Communication/connection between components aka Messaging
  • I/O Operations
  • Data handling

All these parts are widely used and depending on the developer or the architect of the solution, they are grouped in the same layer.

The development of your application should have each part and in the Flutter environment, there’s already powerful and popular packages that suit well. For each part, i’ll give you two packages.

Routing

Flutter comes with an integrated routing through its Navigator APIs but this API is really large and could be complex to integrate with some specific use cases. To simplify all that, there are

AutoRoute

AutoRoute is one of the first powerful flutter package that simplifies navigation. It allows you to create your routes as class which is good for arguments types safety. It has others functionnalities like guards, support Navigator 2 with declarative routing and widget navigation and many others APIs like its TabsRouter for routing through tabs.

GoRouter

It is the package provided by the Flutter team to ease the use of the Navigator APIs. This package currently (version 5.1.5) will mostly only simplifies the routes declarations and adds a redirection feature that could be used as guard so it has less APIs or features compared to AutoRoute where you are using a completely different APIs that used the Navigator APIs under the hood.

State management

Flutter being a framework in reactive programming in mind, state management is one of the main part to take in account. For that there’s two packages that stand out from the rest.

Provider

The first one and the older of both, Provider is the recommended package for state management by the Flutter team. It used the InheritedWidget of Flutter under the hood and simplifies its use. It allows to read, watch and select a value from the widget/element tree. It is simple to integrate and has others powerful APIs.

Riverpod

It is state management package created one of the creator of Provider package and for the purpose to fix issues of Provider like the impossibility to have several instances of the same class accessible through widget tree. But it has the inconvenient currently (version 2.1.1) that you need to have access to the WidgetRef so through a ConsumerWidget or through the instanciation of your provided value when with Provider you only needs the BuildContext that you can have access anywhere in your widget tree.

I don’t use it in my productions project at this time cause i work with many developers and riverpod also being a service locator (or can be used like that), you could easily be tempted to use it for any others services/components location which could lead to have access to your Viewmodel inside a service in the Data Layer just because the developer “needs to call a specific method”. And there’s a big issue doing that.

Dependency Injection / Service Locator

The injection of dependencies and the location of services are some majors concepts in OOP and ease the implementations of the SOLID principles alongside Clean Architecture. With them you could make your classe easily testable allowing you to have TDD in mind.

GetIt

This package is pretty useful as Service Locator allowing you to have access to service anywhere in your application after the instantiation. It has many features like lasy instantiation or singleton. You can use it with the package injectable to support Dependency Injection through annotations and cpde generation.

Get

This package is more like a mini framework inside the Flutter framework. It simplifies many thing and can be used as Service Locator, Database, State management, navigator and many others.

Messaging

Messaging allows you to connect your components without making dependent from each others. This is perfect for maintainability and tests. It is also known as Event sourcing with some concepts like Hub, Event Bus etc. There’s two packages in mind for that.

EventBusPlus

As its name described, this package allows you to instantiate a bus of events with publish/subscribe features called here fire and listen . It uses the Stream API of event under the hood allows you to publish/subscribe events that are classes.

Messaging

As the previous one, it implements the messaging concept with publish/subscribe features. It adds more features to that with the Observe pattern, Guards, Store to save your events that are messages here and allows a high level of customization. Rather than a Stream of messages/events, it uses a principle of Queue with Priority queue pattern implemented.

I/O Operations

By I/O (Input/Ouput) i include HTTP requests, File manipulations and any others.

Dio

It is probably the most popular Flutter package for HTTP Requests. It allows you to make all HTTP requests (GET, PUT, PATCH, POST, DELET, HEAD, OPTIONS, etc…) and has APIs to download resources and features like interceptors, transformers.

FilePicker

It allows to access to file and save them. It is very basic package. Simple to integrate and to use with many features like picking files from cloud.

Data Handling

By data handling i consider everything related to serialization and CRUD/CQRS operations. And for that i have two package in mind.

JsonSerializable

It is probably the most popular for data serialization in Flutter. It is lite, simple and comes with annotation through the json_annotation package.

Hive

It is package allowing to have to powerful key-value based database with the principle of “box” where data are CRUD.

I end here. Hope you found your happiness in this list…

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Maxime F.
Maxime F.

Responses (1)

Write a response