Skip to content

Instantly share code, notes, and snippets.

@alandalegend
Last active August 10, 2023 23:19
Show Gist options
  • Save alandalegend/8f35960921878d732c992c140fe78fa5 to your computer and use it in GitHub Desktop.
Save alandalegend/8f35960921878d732c992c140fe78fa5 to your computer and use it in GitHub Desktop.
Futures.dart
void main() {
print('Estamos a punto de pedir datos');
httpGet("hola").then((data){
print(data);
});
print('Recibimos los datos');
}
Future<String> httpGet(String url){
return Future.delayed(new Duration(seconds: 4),(){
return 'Hola mundo';
});
}
/*
Estamos a punto de pedir datos
Recibimos los datos
Hola mundo
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment