Question : interact with flutter and javascript
Answered by : drab-dingo-drslkrs8ci5q
WebView( initialUrl: url, javascriptMode: JavascriptMode.unrestricted, javascriptChannels: Set.from([ JavascriptChannel( name: 'Print', onMessageReceived: (JavascriptMessage message) { //This is where you receive message from //javascript code and handle in Flutter/Dart //like here, the message is just being printed //in Run/LogCat window of android studio print(message.message); }) ]), onWebViewCreated: (WebViewController w) { webViewController = w; }, )
Source : https://stackoverflow.com/questions/53689662/flutter-webview-two-way-communication-with-javascript | Last Update : Sat, 17 Jul 21
Question : interact with flutter and javascript
Answered by : drab-dingo-drslkrs8ci5q
<script type='text/javascript'> Print.postMessage('Hello World being called from Javascript code');
</script>
Source : https://stackoverflow.com/questions/53689662/flutter-webview-two-way-communication-with-javascript | Last Update : Sat, 17 Jul 21