JavaScriptHandlerCallback typedef

JavaScriptHandlerCallback = dynamic Function(List arguments)

This type represents a callback, added with PlatformInAppWebViewController.addJavaScriptHandler, that listens to post messages sent from JavaScript.

The Android implementation uses addJavascriptInterface. The iOS implementation uses addScriptMessageHandler

The JavaScript function that can be used to call the handler is window.flutter_inappwebview.callHandler(handlerName <String>, ...args);, where args are rest parameters. The args will be stringified automatically using JSON.stringify(args) method and then they will be decoded on the Dart side.

Also, a JavaScriptHandlerCallback can return json data to the JavaScript side. In this case, simply return data that you want to send and it will be automatically json encoded using jsonEncode from the dart:convert library.

Implementation

typedef dynamic JavaScriptHandlerCallback(List<dynamic> arguments);