future_helper

Last updated:

0 purchases

future_helper Image
future_helper Images
Add to Cart

Description:

future helper

Map a Future<InitialType> to a Future<TargetType>.

Usage #
final Future<int> intFuture = Future.value(3);
final Future<String> convertedFuture =
intFuture.map((myInt) => 'My int converted $myInt');
final String convertedResult = await convertedFuture;
copied to clipboard
Useful for converting library futures to custom model futures:
final Future<CustomModel> customFuture =
libraryFuture.map((libraryModel) => (CustomModel(libraryModel.property)));
final customModelResult = await customFuture;
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.