Skip to content

Instantly share code, notes, and snippets.

@htsuruo
Created July 11, 2022 01:25
Show Gist options
  • Save htsuruo/c57c64ec7f53e82916e47cf05dfce7fc to your computer and use it in GitHub Desktop.
Save htsuruo/c57c64ec7f53e82916e47cf05dfce7fc to your computer and use it in GitHub Desktop.
microtasks
// What is the difference in calling
// Future and Future.microtask in Flutter?
// ref. https://stackoverflow.com/a/63070317
void main() {
Future(() => print('future 1'));
Future(() => print('future 2'));
// Microtasks will be executed before futures.
Future.microtask(() => print('microtask 1'));
Future.microtask(() => print('microtask 2'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment