setCacheMode method

  1. @override
Future<void> setCacheMode(
  1. CacheMode mode
)

Overrides the way the cache is used. This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SERVICE_WORKER_CACHE_MODE.

NOTE: available on Android 24+.

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

Implementation

@override
Future<void> setCacheMode(CacheMode mode) async {
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent("mode", () => mode.toNativeValue());
  await channel?.invokeMethod('setCacheMode', args);
}