Created with <3 with dartpad.dev.
Created
July 11, 2022 01:25
-
-
Save htsuruo/c57c64ec7f53e82916e47cf05dfce7fc to your computer and use it in GitHub Desktop.
microtasks
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
// 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