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;
Useful for converting library futures to custom model futures:
final Future<CustomModel> customFuture =
libraryFuture.map((libraryModel) => (CustomModel(libraryModel.property)));
final customModelResult = await customFuture;