There are three keywords future, await, async to achieve asynchronous programming in Dart. I found the below example from the official documentation is most insightfull. Future printOrderMessage() async { print(‘Awaiting user order…’); var order = await fetchUserOrder(); print(‘Your order is: $order’); } Future fetchUserOrder() { // Imagine that this function is more complex and slow….
Asynchronous programming in Dart
Posted on