Skip to content

Instantly share code, notes, and snippets.

@HaradaKumiko
Created February 18, 2022 11:42
Show Gist options
  • Save HaradaKumiko/185ab0b132eab7dbbe8db3cb8a3b6b31 to your computer and use it in GitHub Desktop.
Save HaradaKumiko/185ab0b132eab7dbbe8db3cb8a3b6b31 to your computer and use it in GitHub Desktop.
Future<String> pesanOrder() async {
var order = await prosesOrder();
return 'Pesananan anda... $order';
}
Future<String> prosesOrder() => Future.delayed(
const Duration(seconds: 2),
() => 'Large Latte',
);
void main() async {
print('Mengambil order...');
print(await pesanOrder());
print('Order berhasil....');
}
@HaradaKumiko
Copy link
Author

Output
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment