Last updated:
0 purchases
deferred type flutter
deferred_type_flutter for Dart #
Packages for Flutter based on the library deferred_type.
FutureBuilder2 #
FutureBuilder2, an alternative "FutureBuilder" which is simpler to use than the bundled one provided by default in Flutter.
import "package:deferred_type/deferred_type.dart";
final futureBuilder = FutureBuilder2<String>(
future: someFuture,
builder: (context, state) => state.maybeWhen<Widget>(
inProgress: () => const CircularProgressIndicator(),
success: (data) => SomeWidget(data),
error: (error, _stacktrace) => SomeErrorWidget(error),
// handle fallback cases, must be provided
// if all states are not handled.
orElse: () => const FallbackWidget(),
);
);
copied to clipboard
API Reference #
Detailed API documentation can be found on pub.dev.
Possible to-do #
Come up with a better name for the FutureBuilder.
License #
This project is MIT licensed.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.