postMessage method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'CustomTabsSession.postMessage', apiUrl: 'https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)')])
Future<CustomTabsPostMessageResultType> postMessage(
  1. String message
)

Sends a postMessage request using the origin communicated via requestPostMessageChannel. Fails when called before PlatformChromeSafariBrowserEvents.onMessageChannelReady event.

message – The message that is being sent.

Returns an integer constant about the postMessage request result. Will return CustomTabsPostMessageResultType.SUCCESS if successful.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • message: all platforms

Use the PlatformChromeSafariBrowser.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'CustomTabsSession.postMessage',
      apiUrl:
          'https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)',
    ),
  ],
)
Future<CustomTabsPostMessageResultType> postMessage(String message) {
  throw UnimplementedError(
    'postMessage is not implemented on the current platform',
  );
}