deferred_type_flutter for Dart
Packages for Flutter based on the library deferred_type.
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(), ); );
Detailed API documentation can be found on pub.dev.
- Come up with a better name for the FutureBuilder.
This project is MIT licensed.