Must-Have Flutter Packages with Alternatives

So you're working with Flutter, and you're staring down the barrel of 33,000+ packages on Pub.dev. The eternal question: which ones are worth your time? Choice paralysis is real, so let's cut through the noise. This post is about the packages that we, developers at Anadea, actually find useful in our day-to-day work. We've sorted them into essential categories and also offer up an alternative for each!

Which Flutter Packages Can Be Considered as Good?

What are our criteria? After all, 'best' is subjective. Here's what we evaluate:

  • Compatibility with the latest stable version of Flutter;
  • AndroidX support (yeah, it still matters);
  • Multi-platform versatility (web, iOS, Android, you name it);
  • Test coverage: both integration and unit;
  • Well-maintained documentation (because who has time to decipher crappy docs?);
  • Active maintenance: frequent updates and responsive maintainers are the name of the game.

There you have it. Let's get to it!

State Management

Flutter_bloc

Flutter Bloc is a predictable state management library for Dart that is Simple, Lightweight & Highly Testable.

The library enables you to:

  • Make sure the current state of your application at any given moment. Conduct comprehensive tests to ensure your application responds as expected.
  • Document each user interaction within your application for data-driven decision-making.
  • Optimize efficiency through component reusability within and across various applications.
  • Facilitate smooth collaboration among multiple developers by adhering to consistent patterns and conventions.
  • Accelerate the development of fast, responsive applications.

Alternative

Riverpod: Flutter state management library to simplify accessing state while being robust and testable.

Networking

Chopper

Chopper is an HTTP client generator for Dart and Flutter using source_gen. It focuses on making API calls more straightforward and cleaner by using code generation.

Chopper is built on top of the HTTP package, which means it supports all of the same HTTP methods (GET, POST, PUT, DELETE, etc.) and options as the HTTP package. However, Chopper makes it easier to write clean, organized code for making API calls in Flutter apps.

Alternative

Retrofit: type conversion dio client generator using source_gen and inspired by Chopper.

Code Generator & Build Tools

Freezed & Json Serializable

Json Serializable provides builders for the Dart Build System to generate code that converts to and from JSON by annotating Dart classes. To mark a class as serializable, you must annotate it with @JsonSerializable().

Freezed enables you to define immutable classes in Dart cleanly and easily. When annotated on a class, Freezed generates all the required boilerplate to transform the class into a data class with fromJson, toJson, and all other necessary methods. Although Freezed is useful, it should be used intentionally as it can cause long build times in larger projects.

Dependency Injection

GetIt & Injectable

GetIt is a simple ServiceLocator for Flutter that aids you with Accessing service objects like REST API clients or databases so that they easily can be mocked; Accessing BLoCs from Flutter Views. With its simple setup and independence from code generation, Get_it has become an appropriate option for developers seeking an easy and lightweight approach to dependency management.

And then Injectable is a convenient code generator for Get_it.

Storage Libraries

ObjectBox

ObjectBox Flutter database is a great option for storing Dart objects in your cross-platform apps. Designed for high performance. ObjectBox uses minimal CPU, memory, and battery, making your app not only effective but also sustainable. By storing data locally on a device, ObjectBox helps you cut your cloud costs down and make an app that doesn't depend on connection.

Alternative

Drift: Drift is a powerful and flexible SQLite library for Dart and Flutter development. It enables developers to work with databases in a type-safe and intuitive manner. With Drift, developers can create and interact with databases using Dart's expressive language features, such as async/await and streams.

Navigation

AutoRouter

It's a Flutter navigation package that allows for strongly typed arguments passing, and effortless deep-linking and it uses code generation to simplify route setup, with that being said it requires a minimal amount of code to generate everything needed for navigation inside of your App.

Alternative

go_router: A declarative routing package for Flutter that uses the Router API to provide a convenient, URL-based API for navigating between different screens. You can define URL patterns, navigate using a URL, handle deep links, and a number of other navigation-related scenarios.

Localization

Slang

Slang is a library characterized by its minimal setup requirements. It facilitates the creation of JSON files for translation purposes, requiring no intricate configuration. Notably, this tool excels in preventing bugs through compile-time checking, ensuring that typos and missing arguments are virtually impossible, thereby enhancing code reliability. It permits the segmentation of large translation files into more manageable components using namespaces, promoting code clarity and maintainability.

Alternative

Easy_localization: Not only helps with localization but also has support for plural, gender, nesting, and RTL locales. It supports extension methods on both Text and BuildContext widgets for easy translation. It is also reactive to locale changes.

Conclusion

Flutter's package ecosystem is expansive and ever-changing, thanks to a committed developer community. The list here is by no means definitive; it's based on our experience and the requirements we've encountered in our Flutter app development projects. Your own project might call for different solutions, and that's perfectly fine. Feel free to explore and find what's best for you!

Hire Flutter Developers

Frequently Asked Questions

Why is it important to choose the right Flutter packages?

Choosing the right Flutter packages is crucial because it directly affects the quality, maintainability, and efficiency of your application. The right packages ensure compatibility with the latest Flutter versions, support across different platforms (like Android, iOS, and web), and offer robust functionality with good test coverage. They also come with well-maintained documentation and active maintenance, which are essential for troubleshooting and ensuring long-term viability.

How do packages enhance Flutter app development?

Flutter packages enhance app development by providing pre-built, tested, and reliable code for various functionalities. This saves developers time and effort in writing code from scratch. Packages like Flutter_bloc for state management, Chopper for networking, and ObjectBox for storage streamline specific aspects of app development. They allow developers to focus on building unique features of their app, rather than reinventing the wheel for standard functionalities.

How to navigate the Flutter package ecosystem effectively?

When navigating the Flutter package ecosystem, consider the following tips:

  • Research: Look into each package's compatibility, maintenance history, and community feedback.
  • Test for suitability: Experiment with a few packages in a test project to see how well they integrate with your app and meet your specific needs.
  • Stay updated: The Flutter ecosystem evolves rapidly, so it's important to stay informed about new and updated packages.
  • Consider alternatives: Always look for alternative packages that might better suit your project’s needs, as one package does not fit all solutions.