Created
August 20, 2022 10:33
-
-
Save mym0404/bc0a6cb025259993eb41ab6b7655158f to your computer and use it in GitHub Desktop.
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
import 'dart:async'; | |
main() { | |
print('main #1 of 2'); | |
scheduleMicrotask(() => print('microtask #1 of 3')); | |
new Future.delayed( | |
new Duration(seconds: 1), () => print('future #1 (delayed)')); | |
new Future(() => print('future #2 of 4')) | |
.then((_) => print('future #2a')) | |
.then((_) { | |
print('future #2b'); | |
scheduleMicrotask(() => print('microtask #0 (from future #2b)')); | |
}).then((_) => print('future #2c')); | |
scheduleMicrotask(() => print('microtask #2 of 3')); | |
new Future(() => print('future #3 of 4')) | |
.then((_) => new Future(() => print('future #3a (a new future)'))) | |
.then((_) => print('future #3b')); | |
new Future(() => print('future #4 of 4')); | |
scheduleMicrotask(() => print('microtask #3 of 3')); | |
print('main #2 of 2'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment