Open
Description
Now that we have FutureOr
, and more apis are starting to use it, I think it makes sense to take advantage of this in Future.wait
if possible (error handling might get weird, not sure).
The main use case is when calling .map
on some iterable and calling a function that returns a FutureOr
. Today you have to wrap that call in an async method to make sure the type of your iterable is Future<T>
, but ideally you wouldn't have to do that.
Ideal:
FutureOr<...> doStuff(input) => ...
Future doLotsOfStuff(Iterable inputs) => Future.wait(inputs.map(doStuff))
Required today (or something similar):
FutureOr<...> doStuff(input) => ...
Future doLotsOfStuff(Iterable<...> inputs) =>
Future.wait(inputs.map((input) async => doStuff(input)))