deferred_type_flutter 1.1.0 icon indicating copy to clipboard operation
deferred_type_flutter: ^1.1.0 copied to clipboard

Several packages for Flutter based on the library deferred_type.

deferred_type_flutter for Dart #

Pub Version GitHub

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(),
  );
);

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.

0
likes
140
pub points
0%
popularity

Publisher

unverified uploader

Several packages for Flutter based on the library deferred_type.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

deferred_type, flutter

More

Packages that depend on deferred_type_flutter