Creating and Awaiting Futures
Produce and consume Future values.
A Promise of a Value
A Future represents a value that is not ready yet but will arrive later, like a receipt you redeem when your order is done.
Future of a Type
A future is always typed by what it will deliver. A Future<int> promises an int once the async work completes.
Future<int> fetchScore() async {
return 42;
}All lessons in this course
- The Event Loop and Microtasks
- Creating and Awaiting Futures
- Error Handling in async Code
- Future.wait and Parallel Work