postMessage method
Post a message
to the injected JavaScript object which sent this PlatformJavaScriptReplyProxy
.
If message
is of type WebMessageType.ARRAY_BUFFER
, be aware that large byte buffers can lead to out-of-memory crashes on low-end devices.
Official Android API: https://developer.android.com/reference/androidx/webkit/JavaScriptReplyProxy#postMessage(java.lang.String)
Implementation
@override
Future<void> postMessage(WebMessage message) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('message', () => message.toMap());
await _androidWebMessageListener.channel?.invokeMethod('postMessage', args);
}