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.
|
+} |