ServiceWorkerController class

Class that manages Service Workers used by WebView.

NOTE: available on Android 24+.

Officially Supported Platforms/Implementations:

Constructors

ServiceWorkerController()
Class that manages Service Workers used by WebView.
ServiceWorkerController.fromPlatform(PlatformServiceWorkerController platform)
Constructs a ServiceWorkerController from a specific platform implementation.
ServiceWorkerController.fromPlatformCreationParams(PlatformServiceWorkerControllerCreationParams params)
Constructs a ServiceWorkerController from creation params for a specific platform.

Properties

hashCode int
The hash code for this object.
no setterinherited
platform PlatformServiceWorkerController
Implementation of PlatformServiceWorkerController for the current platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceWorkerClient ServiceWorkerClient?
Service Worker client.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setServiceWorkerClient(ServiceWorkerClient? value) → dynamic
Sets the client to capture service worker related callbacks. A ServiceWorkerClient should be set before any service workers are active, e.g. a safe place is before any WebView instances are created or pages loaded.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getAllowContentAccess() Future<bool>
Gets whether Service Workers support content URL access. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS.
getAllowFileAccess() Future<bool>
Gets whether Service Workers support file access. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_FILE_ACCESS.
getBlockNetworkLoads() Future<bool>
Gets whether Service Workers are prohibited from loading any resources from the network. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS.
getCacheMode() Future<CacheMode?>
Gets the current setting for overriding the cache mode. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_CACHE_MODE.
instance() ServiceWorkerController
Gets the ServiceWorkerController shared instance.
setAllowContentAccess(bool allow) Future<void>
Enables or disables content URL access from Service Workers. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS.
setAllowFileAccess(bool allow) Future<void>
Enables or disables file access within Service Workers. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_FILE_ACCESS.
setBlockNetworkLoads(bool flag) Future<void>
Sets whether Service Workers should not load resources from the network. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS.
setCacheMode(CacheMode mode) Future<void>
Overrides the way the cache is used. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_CACHE_MODE.