Skip to content

Instantly share code, notes, and snippets.

@maks
Created November 11, 2020 23:54
Show Gist options
  • Save maks/31495c5cf14211a812e56ec9f5fa2f22 to your computer and use it in GitHub Desktop.
Save maks/31495c5cf14211a812e56ec9f5fa2f22 to your computer and use it in GitHub Desktop.
dart run loop demo
// 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