WebMessageListener constructor

WebMessageListener({
  1. required String jsObjectName,
  2. Set<String>? allowedOriginRules,
  3. OnPostMessageCallback? onPostMessage,
})

This listener receives messages sent on the JavaScript object which was injected by PlatformInAppWebViewController.addWebMessageListener.

Officially Supported Platforms/Implementations:

  • Android native WebView
  • iOS
  • MacOS

Implementation

WebMessageListener(
    {required String jsObjectName,
    Set<String>? allowedOriginRules,
    OnPostMessageCallback? onPostMessage})
    : this.fromPlatformCreationParams(
          params: PlatformWebMessageListenerCreationParams(
              jsObjectName: jsObjectName,
              allowedOriginRules: allowedOriginRules,
              onPostMessage: onPostMessage));