OLD | NEW |
| (Empty) |
1 import 'dart:io'; | |
2 import 'dart:async'; | |
3 | |
4 void printDailyNewsDigest() { | |
5 File file = new File("dailyNewsDigest.txt"); | |
6 Future future = file.readAsString(); | |
7 future.then((content) => doSomethingWith(content)) | |
8 .catchError((e) => handleError(e)); | |
9 } | |
10 | |
11 void main() { | |
12 printDailyNewsDigest(); | |
13 printWinningLotteryNumbers(); | |
14 printWeatherForecast(); | |
15 printBaseballScore(); | |
16 } | |
17 | |
18 doSomethingWith(content) { | |
19 print('do something with content'); | |
20 } | |
21 | |
22 handleError(e) { | |
23 print('handleError'); | |
24 } | |
25 | |
26 printWinningLotteryNumbers() { | |
27 print('Winning lotto numbers: [23, 63, 87, 26, 2]'); | |
28 } | |
29 | |
30 printWeatherForecast() { | |
31 print('Tomorrow\'s forecast: 70F, sunny.'); | |
32 } | |
33 | |
34 printBaseballScore() { | |
35 print('Baseball score: Red Sox 10, Yankees 0'); | |
36 } | |
OLD | NEW |