import 'dart:io';
import 'dart:async';
void printDailyNewsDigest() {
File file = new File("dailyNewsDigest.txt");
Future future = file.readAsString();
future.then((content) {
print(content);
});
}
void main() {
printDailyNewsDigest();
printWinningLotteryNumbers();//does something synchronous
printWeatherForecast();//does something synchronous
printBaseballScore();//does something synchronous
}
I have a simple question about asynchronous operations in Dart and specifically asynchronous operations in the above code. When does asynchronous execution begin in the above code? Does asynchronous execution begin with the file.readAsString() call or does it begin when main exits and the task queue is processed? The documentation that I read is a little vague about this one point.
If I had to guess, I would guess asynchronous execution would begin with the call to file.readAsString(). Am I right?