Created
April 27, 2022 00:55
-
-
Save felipecastrosales/9ac5c3a78e904bae247b1210267d1ba8 to your computer and use it in GitHub Desktop.
Função Assíncrona
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<String> createOrderMessage() async { | |
var order = await fetchUserOrder(); | |
return 'O pedido é: $order'; | |
} | |
Future<String> fetchUserOrder() => | |
Future.delayed( | |
const Duration(seconds: 3), | |
() => 'Bola de futebol', | |
); | |
Future<void> main() async { | |
print('Buscando pedido do usuário:'); | |
print(await createOrderMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment