getHitTestResult method
Gets the hit result for hitting an HTML elements.
NOTE: On iOS, it is implemented using JavaScript.
Supported Platforms/Implementations:
- Android native WebView (Official API - WebView.getHitTestResult)
- iOS
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);
}