load_future 0.1.0 copy "load_future: ^0.1.0" to clipboard
load_future: ^0.1.0 copied to clipboard

Load future with progress dialog.

Load Future with dialog progress bar

Preview #

The preview app running in macOS

Features #

  • Load Future
  • Customize loader
  • Without context
  • return Future

Getting started #

Add dependency #

load_future: ^0.1.0

Wrap App or any Widget with LoadBuilder #

Wrap MaterialApp or any Widget with LoadBuilder where you want to show loading.

LoadBuilder(
    builder: (context, child, isLoading) => DialogBarrier(
        isLoading: isLoading,
        indicator: const CircularProgressIndicator(),
        child: child,
    ),
    child: const MaterialApp(
        title: title,
        home: MyHomePage(title: title),
    ),
);

Usage #

Wrap your Future<T> with Future<T> context.load(Future<T> future) #

Future<Response> longTask() async {
  ...;
}

onTap: () => context.load(longTask())
            .then((response) => ...) // work with success result
            .catchError((e, s) => ...) // work with error

Warning #

load can be called only with BuildContext.

Dialog is not dismissible. You should cancel wrapped Future by own. Example: load(future.timeout(duration))

1
likes
140
points
36
downloads

Publisher

unverified uploader

Weekly Downloads

Load future with progress dialog.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on load_future