Skip to main content
Version: 6.x.x

Service Worker

Check for JavaScript Service Worker API availability.

Service Worker on Android

On Android, the AndroidServiceWorkerController and AndroidServiceWorkerClient classes can be used to intercept requests. Before using these classes or their methods, you should check if the service worker features you want to use are supported or not, for example:

Future main() async {

if (!kIsWeb && defaultTargetPlatform == {
await InAppWebViewController.setWebContentsDebuggingEnabled(kDebugMode);

var swAvailable = await WebViewFeature.isFeatureSupported(
var swInterceptAvailable = await WebViewFeature.isFeatureSupported(

if (swAvailable && swInterceptAvailable) {
ServiceWorkerController serviceWorkerController = ServiceWorkerController.instance();

await serviceWorkerController.setServiceWorkerClient(ServiceWorkerClient(
shouldInterceptRequest: (request) async {
return null;


Service Worker on iOS


The JavaScript Service Worker API is available starting from iOS 14.0+.

To enable this JavaScript API on iOS there are only 2 ways:

  • using "App-Bound Domains"
  • your App proposes itself as a possible "Default Browser" such as iOS Safari or Google Chrome

iOS App-Bound Domains

Read the WebKit - App-Bound Domains article for details.

You can specify up to 10 "app-bound" domains using the new Info.plist key WKAppBoundDomains, for example:


After that, you need to set to true the limitsNavigationsToAppBoundDomains iOS-specific WebView option, for example:

isInspectable: kDebugMode,
limitsNavigationsToAppBoundDomains: true, // adds Service Worker API on iOS 14.0+

iOS Default Browser

Read the Preparing Your App to be the Default Browser or Email Client article for details.