Future: `await` & `async`
Explore how to use Dart's async and await keywords to write asynchronous code that reads like synchronous code. Understand handling errors with try/catch in async operations and controlling execution order through sequencing of asynchronous functions. Gain practical skills to manage asynchronous tasks confidently in Dart.
We'll cover the following...
In this lesson, you’ll learn to use the await and async keywords to carry out asynchronous operations.
The code that uses async and await keywords is asynchronous, but it looks appears similar to synchronous code.
In this lesson, you will see a few examples that use await to wait for the result of an asynchronous function to return before executing the next line of code.
The await & async
The await and async keywords are used together. The function that is expected to perform the expensive work will be marked with the keyword async. Inside the function, the expensive call is prefixed by the keyword await. ...