What are you going to learn : How to use Async/await to call a async function(which is returning Future/Stream)?
To read the latest version of this article click here: https://mibcoder.com
Where to use Async/await?
By using “Await” we can call any async function(who’s return type Future or Stream) and get response in same statement.
These are to thing to call async function in single statement:
i- Mark function with “async” in which we have to call “async function”.
void useFutureMethodTwo()async{................
}
ii- write “await” in front of “async function” call
String onValue=await getFuture();
Note: Program will wait at this statement until it get response from async function.
To handle error use try and catch: