AndroidServiceWorkerController class

Class that manages Service Workers used by WebView.

NOTE: available on Android 24+.

Officially Supported Platforms/Implementations:

Inheritance
  • Object
  • PlatformInterface
  • AndroidServiceWorkerController
Available extensions

Constructors

AndroidServiceWorkerController.new(PlatformServiceWorkerControllerCreationParams params)
Creates a new AndroidServiceWorkerController.
AndroidServiceWorkerController.static()
factory

Properties

handleMethod → dynamic

Available on AndroidServiceWorkerController, provided by the InternalServiceWorkerController extension

no setter
hashCode int
The hash code for this object.
no setterinherited
params → PlatformServiceWorkerControllerCreationParams
The parameters used to initialize the PlatformServiceWorkerController.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceWorkerClient → ServiceWorkerClient?
Service Worker client.
no setter

Methods

dispose() → void
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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
setServiceWorkerClient(ServiceWorkerClient? value) Future<void>
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

instance() AndroidServiceWorkerController
Gets the AndroidServiceWorkerController shared instance.