WebMessageListener constructor

WebMessageListener({
  1. required String jsObjectName,
  2. Set<String>? allowedOriginRules,
  3. 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);
}