Get It Future Builder

style: very good analysis License: MIT Pub package

get_it_future_builder provides a widget named GetItFutureBuilder to wait for your async dependencies to be ready on your presentation layer.

This project is in its infancy stage, where any suggestions and PRs are welcome.

Installation 💻

❗ In order to start using Get It Future Builder you must have the Flutter SDK installed on your machine.

Add get_it_future_builder to your pubspec.yaml:


Install it:

flutter packages get

How to Use It

A Single Dependency

You can also see example directory.

Register your async dependency through GetIt as such:

  () async {
    return await getApplicationDocumentsDirectory();
  instanceName: 'documents_dir', // optional

In our example, we'll use getApplicationDocumentsDirectory method of path_provider. Since it calls native code through MethodChannel, it has to be asynchronous.

Then, in the presentation layer, you can simply do:

// notice how we get the dependency with generics
  // optional
  instanceName: 'documentsDir',
  // render this widget while loading
  loading: (context) => LinearProgressIndicator(),
  // render this widget when it's ready
  ready: (context, instance) => Text('documents dir is: ${instance.path}'),

Multiple Dependencies

get_it_future_builder supports the initialization widget up to 3 dependencies. These widgets are respectively named:

  • GetItFutureBuilder2
  • GetItFutureBuilder3

To initialize 2 dependencies on your widget tree, use GetItFutureBuilder2.

Let's assume we have two asynchronous dependencies.

  () async {
    return await getApplicationDocumentsDirectory();
  instanceName: 'documents_dir', // optional

  () async {
    return await getTemporaryDirectory();
  instanceName: 'temp_dir', // optional

To initialize them asynchronously, use GetItFutureBuilder2 as below:

GetItFutureBuilder2<Directory, Directory>(
  instanceName1: 'documents_dir', // optional
  instanceName2: 'temp_dir', // optional
  loading: (context) => const LinearProgressIndicator(),
  ready: (context, instance1, instance2) => Text(
    'Documents dir is ${instance1.path} and temp dir is ${instance2.path}',

The initialization of dependencies run concurrently.


A Very Good Project created by Very Good CLI.