Last active
August 10, 2023 23:19
-
-
Save alandalegend/8f35960921878d732c992c140fe78fa5 to your computer and use it in GitHub Desktop.
Futures.dart
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
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