load_future 0.0.1
load_future: ^0.0.1 copied to clipboard
Load future with proggress dialog.
Load Future with dialog progress bar
Features #
- Load Future
- Customize loader
- Without context
- return Future
Getting started #
Add dependency #
load_future: ^latest
Wrap XApp with LoadWidget #
Wrap MaterialApp or CupertinoApp with LoadWidget and use common navigatorKey.
final navigatorKey = GlobalKey<NavigatorState>();
LoadWidget(
navigatorKey: navigatorKey,
...
child: MaterialApp(
navigatorKey: navigatorKey,
...
),
);
Usage #
Wrap your Future<T> with Future<T> load(Future<T> future) #
Future<Response> longTask() async {
...;
}
onTap: () => load(longTask())
.then((response) => ...) // work with success result
.catchError((e, s) => ...) // work with error
Warning #
Dialog is not dismissible. You should cancel wrapped Future by own. Example:
load(future.timeout(duration))
Feature plans: #
- ❌ Load Stream Builder from Future