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

Unified Diff: examples/dart/echo_client/lib/main.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 6 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 | « examples/dart/device_info/lib/main.dart ('k') | examples/dart/netcat/lib/main.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/dart/echo_client/lib/main.dart
diff --git a/examples/dart/echo_client/lib/main.dart b/examples/dart/echo_client/lib/main.dart
index 02cffb04330b2d11d501be79b6b71e4df8011940..4f759231058f05f5d85acf152e8c9a46b679835b 100644
--- a/examples/dart/echo_client/lib/main.dart
+++ b/examples/dart/echo_client/lib/main.dart
@@ -24,9 +24,12 @@ class EchoClientApplication extends Application {
final server = (arguments.length > 0) ? arguments[1] : "dart_echo_server";
connectToService(url.replaceAll("dart_echo_client", server), _echo);
- _echo.echoString("hello world").then((response) {
- print("${response.value}");
- }).whenComplete(_closeHandles);
+ var c = new Completer();
+ _echo.echoString("hello world", (String response) {
+ print("${response}");
+ c.complete(null);
+ });
+ c.future.whenComplete(_closeHandles);
}
Future _closeHandles() async {
« no previous file with comments | « examples/dart/device_info/lib/main.dart ('k') | examples/dart/netcat/lib/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698