Open source packages play a huge role in software development, especially when it comes to building Flutter apps. Pub.dev has a growing ecosystem of over 33,000 packages to help you add functionality to your Flutter application.
This blog contains a curated list of Flutter and Dart packages that are useful to building apps at VGV, as well as those we use in our personal projects.
Table of Contents:
- How to decide which Flutter or Dart package to use in your project
- Top open source packages
- Top VGV packages
✨ denotes a package added in this update
How to decide which Flutter or Dart package to use in your project
With thousands of packages to choose from in the Flutter ecosystem, how do you choose which package to use in your project? Here at VGV, we take a few characteristics into account when selecting a package to include in our projects.
Packages that have example code, are well-documented, and have a clear README will be much easier to implement in your own code than packages without. On the more technical side, we recommend looking for the package's test coverage, a well documented changelog, lint rules, and if the package is up to date with the latest version of Flutter. The Flutter Ecosystem Committee also takes much of this into account when they give a package the Flutter Favorite badge. Here is a list of questions we use to assess packages:
- Does the package have a clearly defined scope/focus?
- Does it have an intuitive API?
- Does it have a permissive license (MIT, etc.)?
- Does it have an easy to read changelog?
- Does it have contributing guidelines?
- Is it widely used? We like to look at GitHub stars, dependents, and the popularity score on pub to approximate. Bonus points if it’s a Flutter Favorite!
- Does it have good test coverage?
- Does it have a good pana score?
- Does it have lint rules configured?
- Does it have continuous integration configured?
- Is it kept up-to-date with the latest stable versions of Flutter/Dart?
- Is it well-documented?
- Does it contain information on how to use the package (README, examples, docs site, etc.)?
- Does it have API documentation (dart doc)?
- Are the maintainers active?
- Are the maintainers friendly and collaborative?
Top open source packages
Alchemist is a package designed to enhance golden testing. This package, developed by Betterment x VGV, contains a declarative API and addresses some pain points of golden test support within the Flutter framework — such as fixing continuous integration test flakes and simplifying injecting a custom theme. Here’s a blog about how to use alchemist with your golden tests.
Auto_size_text is an enhanced text widget that automatically sizes the text within an area to fit the desired constraints. These constraints include max size, min size, max lines, or even a preset list of sizes.
Cached_network_image is a great way to load any images that are coming from the network. This library will load an image, as well as show placeholders and loading animations. It will also cache this image so you are not loading the same image twice.
This package from the Dart team is a must-have if you’re using collections in your codebase. Collection contains functions to help with equality within elements of a collection, as well as between collections, list operations, priority queue implementation, and wrappers.
We believe in the importance of 100% code coverage, which ensures that each line of code is tested and behaves as expected. Coverage is a great Dart package that allows users to collect, manipulate, and format coverage data.
With coverage, you can collect coverage from the Dart VM and format that coverage data into LCOV or pretty-printed format.
Cloud_firestore is a Flutter plugin that gives users access to the Firebase Cloud Firestore database, a NoSQL cloud database for mobile, web, and server development. This allows your application to read, write, and react to real-time changes in the Firestore database.
Be sure to check out the documentation on how you can start using the cloud_firestore package in your own projects.
Equatable is a small but helpful package for comparing Dart objects. This package overloads the == operator and allows you to compare objects without code generation.
We can’t recommend cloud_firestore without also mentioning firebase_auth. firebase_auth allows users to access the Firebase Authentication API, enabling authentication through passwords, telephone numbers, and service providers like Twitter, Facebook, and Google.
Visit the Authentication Usage documentation to learn more about integrating firebase_auth into your projects.
Flame is a must-have for game development in Flutter. It leverages the Flutter framework to provide everything you need to build performant games. With flame, your Flutter game is only a widget away. Get started with their detailed documentation.
If you’re using flame to build a game, you can also leverage the bloc library for managing game state. The flame_bloc package makes it easy to access and listen to blocs and cubits. For a tutorial on using flame_bloc, check out our blog.
We prefer to use the flutter_bloc package for state management. A Flutter Favorite, flutter_bloc is a simple, predictable, and easily testable solution to state management, which fits in perfectly with the development practices here at VGV. We even wrote an article that takes an in depth look at why we use flutter_bloc.
Flow_builder is a Flutter package that simplifies the use of navigation stacks following the new Navigator 2.0 API. Simply create a flow state and flow_builder will be able to generate a new navigation stack based on changes to the flow state. For more information be sure to check out our article on incorporating flow_builder into your project.
In Flutter, using a string to specify a path to an asset isn’t safe. For example, an assertion error can be thrown if you accidentally mistype the asset path. flutter_gen is a code generator for assets, fonts, colors, and more, effectively getting rid of string-based APIs.
With flutter_gen, you can use code generation to generate compile-safe asset references instead of using strings for asset paths. For more information on how to install and use flutter_gen, be sure to check out the documentation.
If you are looking to store sensitive data on a device, flutter_secure_storage may come in handy. This library provides a convenient way to access the platform specific encrypted storage: Keychain for iOS and AES encryption or EncryptedSharedPreferences for Android.
Freezed allows you to define immutable classes in Dart in a clean and easy way. When annotated on a class, freezed will generate all of the required boilerplate to make the class into a data class with fromJson, toJson, and all other necessary methods. Freezed can be a useful tool, but it should be used intentionally, as it can cause long build times when used in larger projects.
The googleapis Dart package provides auto-generated Dart libraries to access the APIs found in the Google API Client Libraries. Installing this one package gives you access to dozens of available Google APIs, including the Admin SDK, Calendar, Dialogflow, Drive, and more.
Be sure to read up on how you can use Google APIs with Flutter.
Hive is a Dart package that provides developers with an easily accessible NoSQL Database. It is simple, powerful, and intuitive — we appreciate how you can easily store primitives and Dart objects inside hive’s map-like database.
User feedback can be an integral part of the app development process, so we’re including the in_app_review Flutter package on our list. Developers can prompt users for an app store review within the app.
The mason Dart package is a key tool in increasing efficiency through automation. With mason, you can create and customize reusable code templates in the form of bricks. Here is an article with tutorials on how to use mason.
Membrane is a helpful package for generating code from Rust to Dart. With an emphasis on performance and strict typing, it’s a reliable way to port code over into Dart.
Automated testing is a key component of our development workflow to ensure that our applications perform as expected. One go-to package for writing automated tests is mocktail. Mocktail, inspired by mockito, allows users to stub and verify method behavior by creating mocks without relying on code generation in null safe codebases.
Mocktail also works in tandem with our new mockingjay package, which allows users to mock, test, and verify navigation behavior. Stay tuned for more about this new package!
Maintained by our teammate Jaime Blasco, modal_bottom_sheet makes it simple to implement a modal bottom sheet that is both performant and looks at home on any native mobile device. It includes support for scrolling, dragging, and other customizations.
Pana is a handy Dart package that lets you analyze the health and quality of other packages that you’re using in your application. It evaluates the packages across multiple categories:
- Follows Dart conventions
- Provides documentation
- Supports multiple platforms
- Passes static analysis
- Supports up-to-date dependencies
To get started, simply install pana from pub.dev and specify either a package or a local directory to analyze.
Plus Plugins ✨
The Plus Plugins are a collection of plugins that expose added functionality for things like accessing battery state, sensors, and more. Some of our favorite plugins from the bunch are connectivity_plus which tells you when you have internet access and share_plus which lets you share content using the platform's share dialog.
Purchases_flutter is a helpful package by RevenueCat for implementing in-app purchases with StoreKit and Google Play Billing in your Flutter apps. Get purchase tracking, in-app subscriptions, and analytics all in one place.
Recase is a small but mighty package to easily change the case of input text into snake_case, dot.case, path/case, PascalCase, and more.
True to its name, the url_launcher Flutter package is a convenient way to launch external URLs from your application with many URL schemes supported. Use this package when you want to rely on the underlying platform to handle opening the URL for you.
Top VGV packages
This package is a small, but mighty utility that comes in handy when building your own command-line interface. Easily add completion functionality to any Dart CLI.
Dart_frog is a fast, minimalistic backend framework written entirely in Dart. If you love Dart for frontend development and want to use the same language for backend development, you can try dart_frog. It only takes a few lines to get started, and it supports hot reload. Check out our full stack tutorial.
Flame_behaviors allows you to create games using entities and behaviors. It can also make it easier to scale and test your games. Check out our blog to learn how to create a Pong game with flame_behaviors.
At VGV, we use the formz package, which heavily simplifies form representation and validation in an easily understandable format. Simply extend FormzInput and provide the input and error type.
R13n makes it easy to implement regionalization in your app, allowing you to further personalize apps with a global audience. This package can and should be used in conjunction with l10n.
Linting tools are great for ensuring high-quality, consistent code by checking for stylistic errors. We created the very_good_analysis package to combine the rules from the (now deprecated) pedantic package, as well as some additional options that we use at VGV. Read more about very_good_analysis.
very_good_cli is a command line tool that can be used to generate a number of opinionated templates, including: Very Good Core, our opinionated Flutter starter application, Flutter package, Dart package, and federated plugin. We created Very Good CLI to make it easier to start new projects — whether a multi-platform application or Flutter package — and ensure our best practices are implemented out of the box.
GitHub workflows can help you standardize the steps that are run as part of your CI process — we typically use them on each PR before merging. We created very_good_workflows to open source the workflows we use to check for opinionated best practices at VGV. Learn more about customizing workflows in this blog.
While this list isn’t exhaustive, we wanted to showcase the top packages that we consistently use in both our VGV work and personal Flutter projects.
Thanks to those who contributed to this article: Samantha O’Brien, Noel Jacob, Marcos Sevilla, and Daniel Duan.