Why does an async method needs to return a future?
async
and await
don't make async execution sync. There is no way to do that.
All async
and await
does is to make async code look more like sync code. It is just syntactic sugar. Everything that can be done with async
and await
can be done without it as well.
Instead of deeply nested .then(...then(...then(...).catchError())).catchError(...)
distinct statements, for loops, try
, catch
, finally
can be used which makes code easier to write, read and reason about.