returning futures
Above code was inspired by what I read in flutter documentation. But
I found this part most interesting:
Here, printCountdown
enters 10 Future entries to the event loop, each
setting of at different seconds (1, 2, 3, 4 ... 10). You could think
the entry of these Futures as instantaneous. This is one way to use
Future.delayed. But another one is in delayedGreeting
. Notably, here
we are able to return the result of the function passed to
Future.delayed
as if it came from delayedGreeting
. Note that
delayedGreeting
returns the Future.delayed
as it is.