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

Unified Diff: src/tests/site/code/futures.dart

Issue 22528003: update examples on homepage (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: src/tests/site/code/futures.dart
diff --git a/src/tests/site/code/futures.dart b/src/tests/site/code/futures.dart
new file mode 100644
index 0000000000000000000000000000000000000000..89bf82dddf36f6871611bf5dc1055f0e60a131e8
--- /dev/null
+++ b/src/tests/site/code/futures.dart
@@ -0,0 +1,10 @@
+import 'dart:io';
+import 'dart:async';
+
+void printDailyNewsDigest() {
+ File file = new File("dailyNewsDigest.txt");
+ Future future = file.readAsString(); // readAsString() returns a Future.
+ future.then((content) {
+ print(content); // Executes when the future's work is done.
+ });
sethladd 2013/08/08 05:06:29 how about a catchError. I think that's a cool feat
Kathy Walrath 2013/08/08 17:09:38 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698