Skip to content

Instantly share code, notes, and snippets.

@sergeykondr
Created November 29, 2021 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergeykondr/19c09437be5971c466c4961aede01648 to your computer and use it in GitHub Desktop.
Save sergeykondr/19c09437be5971c466c4961aede01648 to your computer and use it in GitHub Desktop.
блок 17-27 строчки идет в очередь event loop. это равноценно, если этот код обернуть в Future (пример далее будет).
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