fluttercommunity / fluttercommunity/flutter_webview_plugin

JavascriptChannel on iOS

Open
#712 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
1.5k
Forks
938
PR merge metrics
No merged PRs in 30d

Description

I use JavascriptChannel to pass a string back to the app form webview.
It works perfectly for Android but can't make it work on iOS? Is there anything specific I need to do to make it work?

```
class WebViewJavascriptChannel {
static Set getChannel(Function(String) handler) {
return [
JavascriptChannel(
name: 'JavascriptChannel',
onMessageReceived: (JavascriptMessage javascriptMessage) {
handler(javascriptMessage.message);
print(javascriptMessage.message);
}),
].toSet();
}
}

Widget _getBankIDWebView(String url) {
return WebviewScaffold(
javascriptChannels:
WebViewJavascriptChannel.getChannel(_updateString),
url: url,
withZoom: false,
hidden: true,
appBar: _getAppBar(),
);
}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.