Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/site/articles/using-future-based-apis/code/example3.dart

Issue 99503002: appropriating Shailen's excellent Futures intro into tutorial (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: another pesky file Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698