WebMessageListener class

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

Officially Supported Platforms/Implementations:

  • Android native WebView
  • iOS
  • MacOS

Constructors

WebMessageListener({required String jsObjectName, Set<String>? allowedOriginRules, OnPostMessageCallback? onPostMessage})
This listener receives messages sent on the JavaScript object which was injected by PlatformInAppWebViewController.addWebMessageListener.
WebMessageListener.fromPlatform({required PlatformWebMessageListener platform})
Constructs a WebMessageListener from a specific platform implementation.
WebMessageListener.fromPlatformCreationParams({required PlatformWebMessageListenerCreationParams params})
Constructs a WebMessageListener.

Properties

allowedOriginRules Set<String>?
A set of matching rules for the allowed origins.
no setter
hashCode int
The hash code for this object.
no setterinherited
jsObjectName String
The name for the injected JavaScript object.
no setter
onPostMessage OnPostMessageCallback?
Event that receives a message sent by a postMessage() on the injected JavaScript object.
no setter
platform PlatformWebMessageListener
Implementation of PlatformWebMessageListener for the current platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Disposes the channel.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toMap() Map<String, dynamic>
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited