fluttercommunity / fluttercommunity/flutter_webview_plugin
JavascriptChannel on iOS
- 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
Research direction
Start with WebviewScaffold and the javascriptChannels configuration shown in the issue, then reproduce the message flow on iOS and compare it with Android. Done means the issue documents a confirmed iOS-specific requirement or a reproducible failure with a scoped fix and verification steps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flutter
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100