shouldInterceptRequest property
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'ServiceWorkerClientCompat.shouldInterceptRequest', apiUrl: 'https://developer.android.com/reference/androidx/webkit/ServiceWorkerClientCompat#shouldInterceptRequest(android.webkit.WebResourceRequest)')])
final
Notify the host application of a resource request and allow the application to return the data.
If the return value is null, the Service Worker will continue to load the resource as usual.
Otherwise, the return response and data will be used.
This method is called only if WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST is supported. You can check whether that flag is supported using WebViewFeature.isFeatureSupported.
request represents an object containing the details of the request.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - ServiceWorkerClientCompat.shouldInterceptRequest)
Parameters - Officially Supported Platforms/Implementations:
request: all platforms
Use the ServiceWorkerClient.isPropertySupported method to check if this property is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'ServiceWorkerClientCompat.shouldInterceptRequest',
apiUrl:
'https://developer.android.com/reference/androidx/webkit/ServiceWorkerClientCompat#shouldInterceptRequest(android.webkit.WebResourceRequest)',
),
],
)
final Future<WebResourceResponse?> Function(WebResourceRequest request)?
shouldInterceptRequest;