getHitTestResult method
Gets the hit result for hitting an HTML elements.
NOTE: On iOS, it is implemented using JavaScript.
Officially Supported Platforms/Implementations:
- Android native WebView (Official API - WebView.getHitTestResult)
- iOS
Implementation
@override
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.fromNativeValue(
hitTestResultMap["type"]?.toInt());
String? extra = hitTestResultMap["extra"];
return InAppWebViewHitTestResult(type: type, extra: extra);
}