I accidentally came across this behavior while playing around the async behavior.
Can anyone explain to me why the setTimeout with 0 seconds is not executing the print statement immediately?
setTimeout enqueues the passed function into the event queue and the passed code is executed async. https://webdev.dartlang.org/articles/performance/event-loop
The sync code is executed to the end and then the next event in the event queue is processed.