Last updated:
0 purchases
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.