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 18,000 packages to help you add functionality to your Flutter application and leverage solutions created by the community.
This blog contains a curated list of Flutter and Dart packages that are essential to our development on client projects at VGV, as well as those we use in our personal projects.
Top Open Source Packages
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. Here is an example:
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.
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 realtime 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.
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.
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.
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.
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 their documentation.
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.
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.
Then, specify either a package or a local directory to analyze.
Top VGV Packages
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.
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!
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.
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.
Interacting with the NameInput class defined above is simple and intuitive.
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.
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.
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. Check out pub.dev for the full catalog of Flutter and Dart packages.