Reputation: 327
I have two buttons on the webpage see the image below
I try
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
webView.addJavaScriptHandler(handlerName: "performClick", callback: (value){
print("value ==="+value.toString());
});
},
But unable to receive the data.
I did it in android native see the below code in kotlin that works for me
webviewTaskPost.addJavascriptInterface(object : Any() {
@JavascriptInterface // For API 17+
fun performClick(parameter: String) {
if (parameter == "1") {
submittedCaseApplication()
} else if (parameter == "2") {
showMyTaskList()
}
//Toast.makeText(this@MainActivity, strl, Toast.LENGTH_SHORT).show()
}
}, "ok")
How can I receive value in dart flutter like an android native?
Upvotes: 0
Views: 1400
Reputation: 327
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
webView.addJavaScriptHandler(handlerName: "Back", callback: (value){
print("value ==="+value.toString());
});
This Way is ok, I updated my web look how I update my Button Click
Upvotes: 3