getCacheMode static method

Future<AndroidCacheMode?> getCacheMode()

Gets the current setting for overriding the cache mode. This method should only be called if AndroidWebViewFeature.isFeatureSupported returns true for AndroidWebViewFeature.SERVICE_WORKER_CACHE_MODE.

NOTE: available on Android 24+.

Official Android API: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getCacheMode()

Implementation

static Future<AndroidCacheMode?> getCacheMode() async {
  return AndroidCacheMode.fromNativeValue(
      (await ServiceWorkerController.getCacheMode())?.toNativeValue());
}