requestPostMessageChannel method

Future<bool> requestPostMessageChannel({
  1. required WebUri sourceOrigin,
  2. WebUri? targetOrigin,
})

Sends a request to create a two way postMessage channel between the client and the browser. If you want to specifying the target origin to communicate with, set the targetOrigin.

sourceOrigin - A origin that the client is requesting to be identified as during the postMessage communication. It has to either start with http or https.

targetOrigin - The target Origin to establish the postMessage communication with. This can be the app's package name, it has to either start with http or https.

Returns whether the implementation accepted the request. Note that returning true here doesn't mean an origin has already been assigned as the validation is asynchronous.

Officially Supported Platforms/Implementations:

Implementation

Future<bool> requestPostMessageChannel(
    {required WebUri sourceOrigin, WebUri? targetOrigin}) {
  throw UnimplementedError(
      'requestPostMessageChannel is not implemented on the current platform');
}