deleteAllCookies method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'CookieManager.removeAllCookies', apiUrl: 'https://developer.android.com/reference/android/webkit/CookieManager#removeAllCookies(android.webkit.ValueCallback%3Cjava.lang.Boolean%3E)'), IOSPlatform(apiName: 'WKWebsiteDataStore.removeData', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata', available: '11.0', note: """It will return always `true`."""), MacOSPlatform(apiName: 'WKWebsiteDataStore.removeData', apiUrl: 'https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata', available: '10.13', note: """It will return always `true`."""), WindowsPlatform(), LinuxPlatform(apiName: 'webkit_website_data_manager_clear', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebsiteDataManager.clear.html', note: 'Uses WebsiteDataManager to clear all cookie data.')])
Removes all cookies.
The return value indicates whether any cookies were removed.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - CookieManager.removeAllCookies)
- iOS WKWebView 11.0+ (Official API - WKWebsiteDataStore.removeData):
- It will return always
true.
- It will return always
- macOS WKWebView 10.13+ (Official API - WKWebsiteDataStore.removeData):
- It will return always
true.
- It will return always
- Windows WebView2
- Linux WPE WebKit (Official API - webkit_website_data_manager_clear):
- Uses WebsiteDataManager to clear all cookie data.
Use the PlatformCookieManager.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(
apiName: 'CookieManager.removeAllCookies',
apiUrl:
'https://developer.android.com/reference/android/webkit/CookieManager#removeAllCookies(android.webkit.ValueCallback%3Cjava.lang.Boolean%3E)',
),
IOSPlatform(
apiName: 'WKWebsiteDataStore.removeData',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata',
available: '11.0',
note: """It will return always `true`.""",
),
MacOSPlatform(
apiName: 'WKWebsiteDataStore.removeData',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532938-removedata',
available: '10.13',
note: """It will return always `true`.""",
),
WindowsPlatform(),
LinuxPlatform(
apiName: 'webkit_website_data_manager_clear',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.WebsiteDataManager.clear.html',
note: 'Uses WebsiteDataManager to clear all cookie data.',
),
],
)
Future<bool> deleteAllCookies() {
throw UnimplementedError(
'deleteAllCookies is not implemented on the current platform',
);
}