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

Side by Side Diff: src/site/articles/using-future-based-apis/code/example5.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 main() {
5 Future.wait([expensiveA(), expensiveB(), expensiveC()])
6 .then((List responses) => chooseBestResponse(responses))
7 .catchError((e) => handleError(e));
8 }
9
10 Future expensiveA() => new Future.value('from expensiveA');
11 Future expensiveB() => new Future.value('from expensiveB');
12 Future expensiveC() => new Future.value('from expensiveC');
13
14 doSomethingWith(value) {
15 print(value);
16 }
17
18 chooseBestResponse(List responses) {
19 print(responses[1]);
20 }
21
22 handleError(e) {
23 print('error handled');
24 }
OLDNEW
« no previous file with comments | « src/site/articles/using-future-based-apis/code/example4.dart ('k') | src/site/articles/using-future-based-apis/index.markdown » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698