I found it difficult when I want to run javascript in package flutter_inappwebview
, Previously I tried with webview_flutter
I was able to run runJavascript
but there was a problem when I used webview_flutter I could not upload this file for example when I used webview_flutter
final json =
jsonEncode(TawkVisitor(name: "jhon", email: "jhon@mail.com"));
String javascriptString;
javascriptString =
'''Tawk_API = Tawk_API || {};Tawk_API.onLoad = function() {Tawk_API.setAttributes($json);''';
await controller.runJavascript(javascriptString);
setState(() {});
can you guys help how to run javascript in packages flutter_inappwebview
Try this one:
String yourCode = "alert('JS Running')";
controller.evaluateJavascript(source: yourCode).then((result) {
debugPrint(result);
});