androidShouldInterceptRequest method

Future<WebResourceResponse?>? androidShouldInterceptRequest(
  1. WebResourceRequest request
)
inherited

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.

Official Android API:

Implementation

Future<WebResourceResponse?>? androidShouldInterceptRequest(
    WebResourceRequest request) {
  return null;
}