WebViewCookieManager class
Manages cookies pertaining to all WebViews.
Platform-Specific Features
This class contains an underlying implementation provided by the current platform. Once a platform implementation is imported, the examples below can be followed to use features provided by a platform's implementation.
Below is an example of setting platform-specific creation parameters for iOS and Android:
PlatformWebViewCookieManagerCreationParams params =
const PlatformWebViewCookieManagerCreationParams();
if (WebViewPlatform.instance is WebKitWebViewPlatform) {
params = WebKitWebViewCookieManagerCreationParams
.fromPlatformWebViewCookieManagerCreationParams(
params,
);
} else if (WebViewPlatform.instance is AndroidWebViewPlatform) {
params = AndroidWebViewCookieManagerCreationParams
.fromPlatformWebViewCookieManagerCreationParams(
params,
);
}
final WebViewCookieManager webViewCookieManager =
WebViewCookieManager.fromPlatformCreationParams(
params,
);
Below is an example of accessing the platform-specific implementation for iOS and Android:
final WebViewCookieManager cookieManager = WebViewCookieManager();
if (WebViewPlatform.instance is WebKitWebViewPlatform) {
final WebKitWebViewCookieManager webKitManager =
cookieManager.platform as WebKitWebViewCookieManager;
} else if (WebViewPlatform.instance is AndroidWebViewPlatform) {
final AndroidWebViewCookieManager androidManager =
cookieManager.platform as AndroidWebViewCookieManager;
}
Constructors
- WebViewCookieManager()
- Constructs a WebViewCookieManager.
- WebViewCookieManager.fromPlatform(PlatformWebViewCookieManager platform)
- Constructs a WebViewCookieManager from a specific platform implementation.
- WebViewCookieManager.fromPlatformCreationParams(PlatformWebViewCookieManagerCreationParams params)
- Constructs a WebViewCookieManager from creation params for a specific platform.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- platform → PlatformWebViewCookieManager
-
Implementation of
PlatformWebViewCookieManager
for the current platform.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearCookies(
) → Future< bool> - Clears all cookies for all WebViews.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setCookie(
WebViewCookie cookie) → Future< void> - Sets a cookie for all WebView instances.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited