flutterResultMap = new HashMap<>();
flutterResultMap.put("result", null);
flutterResultMap.put("error", null);
- flutterResultMap.put("isBlocking", true);
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@@ -58,27 +60,25 @@ public class Util {
@Override
public void success(Object result) {
flutterResultMap.put("result", result);
- flutterResultMap.put("isBlocking", false);
+ latch.countDown();
}
@Override
public void error(String s, String s1, Object o) {
flutterResultMap.put("error", "ERROR: " + s + " " + s1);
flutterResultMap.put("result", o);
- flutterResultMap.put("isBlocking", false);
+ latch.countDown();
}
@Override
public void notImplemented() {
- flutterResultMap.put("isBlocking", false);
+ latch.countDown();
}
});
}
});
- while((Boolean) flutterResultMap.get("isBlocking")) {
- // block until flutter side returns
- }
+ latch.await();
return new WaitFlutterResult(flutterResultMap.get("result"), (String) flutterResultMap.get("error"));
}
diff --git a/example/assets/index.html b/example/assets/index.html
index fc349eed..45b9c555 100644
--- a/example/assets/index.html
+++ b/example/assets/index.html
@@ -26,8 +26,8 @@
Inline WebView
Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.
-
- Learn more
+
+
@@ -54,6 +54,9 @@
console.log(JSON.stringify(result));
});
});
+ $(document).ready(function() {
+ console.log("jQuery ready");
+ });