postMessage method
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 CustomTabsService.RESULT_SUCCESS if successful.
Officially Supported Platforms/Implementations:
Implementation
@override
Future<CustomTabsPostMessageResultType> postMessage(String message) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("message", () => message);
return CustomTabsPostMessageResultType.fromNativeValue(
await channel?.invokeMethod<int>("postMessage", args)) ??
CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR;
}