getHitTestResult method

Future<InAppWebViewHitTestResult?> getHitTestResult()

Gets the hit result for hitting an HTML elements.

NOTE: On iOS, it is implemented using JavaScript.

Supported Platforms/Implementations:

Implementation

Future<InAppWebViewHitTestResult?> getHitTestResult() async {
  Map<String, dynamic> args = <String, dynamic>{};
  Map<dynamic, dynamic>? hitTestResultMap =
      await _channel.invokeMethod('getHitTestResult', args);

  if (hitTestResultMap == null) {
    return null;
  }

  hitTestResultMap = hitTestResultMap.cast<String, dynamic>();

  InAppWebViewHitTestResultType? type =
      InAppWebViewHitTestResultType.fromValue(
          hitTestResultMap["type"]?.toInt());
  String? extra = hitTestResultMap["extra"];
  return InAppWebViewHitTestResult(type: type, extra: extra);
}