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

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: incorporate most of Seth's round #2 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
« no previous file with comments | « src/site/scss/style.scss ('k') | src/tests/site/code/syntax.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f7f9d54eb23283e2cf3a940093e52c75c3ace4e7
--- /dev/null
+++ b/src/tests/site/code/futures.dart
@@ -0,0 +1,14 @@
+import 'dart:io';
+import 'dart:async';
+
+void printDailyNewsDigest() {
+ File file = new File('dailyNewsDigest.txt');
+ file.readAsString() // readAsString() returns a Future.
+ .then((content) => print(content)) // Handle successful completion.
+ .catchError((error) => // Handle failure.
+ print("Sorry, no news today. Here's why:\n$error"));
sethladd 2013/08/08 23:43:12 I don't see people putting a newline after => so p
+}
+
+main() {
+ printDailyNewsDigest();
+}
« no previous file with comments | « src/site/scss/style.scss ('k') | src/tests/site/code/syntax.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698