setWebMessageCallback method
Sets a callback to receive message events on the main thread.
Implementation
Future<void> setWebMessageCallback(WebMessageCallback? onMessage) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('index', () => this._index);
await _webMessageChannel._channel
.invokeMethod('setWebMessageCallback', args);
this._onMessage = onMessage;
}