1WebView(
2 initialUrl: url,
3 javascriptMode: JavascriptMode.unrestricted,
4 javascriptChannels: Set.from([
5 JavascriptChannel(
6 name: 'Print',
7 onMessageReceived: (JavascriptMessage message) {
8 //This is where you receive message from
9 //javascript code and handle in Flutter/Dart
10 //like here, the message is just being printed
11 //in Run/LogCat window of android studio
12 print(message.message);
13 })
14 ]),
15 onWebViewCreated: (WebViewController w) {
16 webViewController = w;
17 },
18 )
19
1<script type='text/javascript'>
2 Print.postMessage('Hello World being called from Javascript code');
3</script>
4