Created
November 29, 2021 00:00
-
-
Save sergeykondr/19c09437be5971c466c4961aede01648 to your computer and use it in GitHub Desktop.
блок 17-27 строчки идет в очередь event loop. это равноценно, если этот код обернуть в Future (пример далее будет).
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
void main() async { | |
methodA(); | |
methodB(); //намеренно вызвано без await | |
methodA(); | |
} | |
methodA() { | |
print('A'); | |
} | |
methodB() async { | |
print('B start'); | |
Future.microtask(() { | |
print('microtask 1'); | |
}); | |
await Future(() { | |
print('Future B'); | |
}); | |
print('1'); | |
Future.microtask(() { | |
print('microtask 2'); | |
}); | |
Future(() { | |
print('Future DDDDB'); | |
}); | |
print('B end'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment