Last active
August 30, 2019 04:29
-
-
Save Dalmangyi/f8d338addf1117c5886e3720c00fa4f7 to your computer and use it in GitHub Desktop.
Dart Future exam
This file contains 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
import 'dart:async'; | |
main() async { | |
countSeconds(4); | |
await message(); | |
} | |
void countSeconds(s) { | |
for(var i=1; i<=s; i++ ) { | |
Future.delayed(Duration(seconds: i), () => print(i)); | |
} | |
} | |
void message () async { | |
print('hi'); | |
var name = await thinking(); | |
print('bye $name'); | |
} | |
Future<String> thinking() { | |
return Future.delayed(Duration(seconds: 4), () => 'Mr...Kim?'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment