androidShouldInterceptRequest property

(Future<WebResourceResponse?> Function(InAppWebViewController controller, WebResourceRequest request)?) androidShouldInterceptRequest
final

Notify the host application of a resource request and allow the application to return the data. If the return value is null, the WebView will continue to load the resource as usual. Otherwise, the return response and data will be used.

This callback is invoked for a variety of URL schemes (e.g., http(s):, data:, file:, etc.), not only those schemes which send requests over the network. This is not called for javascript: URLs, blob: URLs, or for assets accessed via file:///android_asset/ or file:///android_res/ URLs.

In the case of redirects, this is only called for the initial resource URL, not any subsequent redirect URLs.

request Object containing the details of the request.

NOTE: available only on Android. In order to be able to listen this event, you need to set AndroidInAppWebViewOptions.useShouldInterceptRequest option to true.

Official Android API:

Implementation

final Future<WebResourceResponse?> Function(
        InAppWebViewController controller, WebResourceRequest request)?
    androidShouldInterceptRequest;