postMessage method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'CustomTabsSession.postMessage', apiUrl: 'https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)')])
- 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:
- Android Chrome Custom Tabs (Official API - CustomTabsSession.postMessage)
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',
);
}