Top Flutter & Dart Packages

15 open source packages to make your Flutter projects even better

Open Source
Additional Contributors
No items found.

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

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:


final box = Hive.box(‘myBox’);
box.put(‘company’, ‘VGV’);
final company = box.get(‘company’);
print(‘Company: $company);

url_launcher

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.


const url = ‘https://verygood.ventures/blog’;
if (await canLaunch(url)) {
  await launch(url);
}

cloud_firestore

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.

firebase_auth

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.

googleapis

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.

in_app_review

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.


InAppReview.instance.openStoreListing(appStoreId: '...', microsoftStoreId: '...');

flutter_gen

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.


# pubspec.yaml 
flutter:
 assets:
   - assets/images/profile.jpg


Widget build(BuildContext context) {
  return Assets.images.profile.image();
}

For more information on how to install and use flutter_gen, be sure to check out their documentation.

coverage

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

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.


dart pub global activate pana

Then, specify either a package or a local directory to analyze.


pana --hosted {published package name} [{version}]
pana {local directory}


Top VGV Packages

flutter_bloc

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.

mocktail

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.


// A Real Dog Class
class Dog{
  String bark() => 'woof!';
}

// A Mock Dog Class
class MockDog extends Mock implements Dog {}

void main() {
  final dog = MockDog();
  final sound = ‘bark’;
  // Stub the `bark` method.
  when(() => dog.bark()).thenReturn(sound);
  // Interact with the mock dog instance.
  expect(dog.bark(), equals(sound));
  // Verify the interaction occurred.
  verify(() => dog.bark()).called(1);
}

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!

mason

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.

formz

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.


// Define input validation errors
enum NameInputError { empty }

class NameInput extends FormzInput {
  // Call super.pure to represent an unmodified form input.
  const NameInput.pure() : super.pure('');

  // Call super.dirty to represent a modified form input.
  const NameInput.dirty({String value = ''}) : super.dirty(value);

  // Override validator to handle validating a given input value.
  @override
  NameInputError validator(String value) {
    return value?.isNotEmpty == true ? null : NameInputError.empty;
  }
}

Interacting with the NameInput class defined above is simple and intuitive.


final name = NameInput.pure();
print(name.value); // ''
print(name.valid); // false
print(name.status); // FormzInputStatus.pure
print(name.error); // NameInputError.empty

final joe = NameInput.dirty(value: 'joe');
print(joe.value); // 'joe'
print(joe.valid); // true
print(joe.status); // FormzInputStatus.valid
print(joe.error); // null
print(joe.toString()); // NameInput('joe', true);

very_good_analysis

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

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.

Read our other blogs on open source topics here.

More Stories