WebMessageListener constructor
WebMessageListener({
- required String jsObjectName,
- Set<
String> ? allowedOriginRules, - OnPostMessageCallback? onPostMessage,
Implementation
WebMessageListener(
{required this.jsObjectName,
Set<String>? allowedOriginRules,
this.onPostMessage}) {
this.id = IdGenerator.generate();
this.allowedOriginRules =
allowedOriginRules != null ? allowedOriginRules : Set.from(["*"]);
assert(!this.allowedOriginRules.contains(""),
"allowedOriginRules cannot contain empty strings");
this._channel = MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_web_message_listener_${id}_$jsObjectName');
this._channel.setMethodCallHandler(handleMethod);
}