shouldInterceptFetchRequest property Null safety

(Future<FetchRequest?> Function?(InAppWebViewController controller, FetchRequest fetchRequest)?) shouldInterceptFetchRequest
final

Event fired when a request is sent to a server through Fetch API. It gives the host application a chance to take control over the request before sending it.

fetchRequest represents a resource request.

NOTE: In order to be able to listen this event, you need to set InAppWebViewOptions.useShouldInterceptFetchRequest option to true. Also, unlike iOS that has WKUserScript that can inject javascript code right after the document element is created but before any other content is loaded, in Android the javascript code used to intercept fetch requests is loaded as soon as possible so it won't be instantaneous as iOS but just after some milliseconds (< ~100ms). Inside the window.addEventListener("flutterInAppWebViewPlatformReady") event, the fetch requests will be intercept for sure.

Implementation

final Future<FetchRequest?> Function(
        InAppWebViewController controller, FetchRequest fetchRequest)?
    shouldInterceptFetchRequest;