Skip to content

Instantly share code, notes, and snippets.

@ridhoperdana
Created December 21, 2020 22:37
Show Gist options
  • Select an option

  • Save ridhoperdana/36188c7c2729a609a0b16f8429309dd2 to your computer and use it in GitHub Desktop.

Select an option

Save ridhoperdana/36188c7c2729a609a0b16f8429309dd2 to your computer and use it in GitHub Desktop.
example of async and standard function dart
Future<String> asyncFunction(int functionID) async {
return 'This will be run asynchronously $functionID';
}
String standardFunction(int functionID) {
return 'This will be run synchronously $functionID';
}
void startFunction() {
for (int i = 0; i < 10; i++) {
asyncFunction(i).then((value) => {print(value)});
}
print(standardFunction(100));
}
void main() {
startFunction();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment