Created
November 11, 2020 23:54
-
-
Save maks/31495c5cf14211a812e56ec9f5fa2f22 to your computer and use it in GitHub Desktop.
dart run loop demo
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
// Futures are treated as events and hence go onto event queue | |
// while microtasks have their own queue which is dispatched | |
// before the event queue in the run loop | |
// ref: https://www.didierboelens.com/2019/01/futures-isolates-event-loop/ | |
void main() { | |
Future.microtask(() { | |
print('doing micro'); | |
}); | |
Future(() { | |
print('doing future'); | |
}); | |
print('finish main'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment