JavaScriptMessage class
A message that was sent by JavaScript code running in a WebView
.
Platform specific implementations can add additional fields by extending this class and providing a factory method that takes the JavaScriptMessage as a parameter.
{@tool sample} This example demonstrates how to extend the JavaScriptMessage to provide additional platform specific parameters.
When extending JavaScriptMessage additional parameters should always
accept null
or have a default value to prevent breaking changes.
@immutable
class WKWebViewScriptMessage extends JavaScriptMessage {
WKWebViewScriptMessage._(
JavaScriptMessage javaScriptMessage,
this.extraData,
) : super(javaScriptMessage.message);
factory WKWebViewScriptMessage.fromJavaScripMessage(
JavaScriptMessage javaScripMessage, {
String? extraData,
}) {
return WKWebViewScriptMessage._(
javaScriptMessage,
extraData: extraData,
);
}
final String? extraData;
}
{@end-tool}
- Annotations
Constructors
- JavaScriptMessage({required String message})
-
Creates a new JavaScript message object.
const
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited