Skip to main content
Version: 6.x.x

Cookie Manager

To manage WebView cookies, you can use the CookieManager class, which implements a singleton object (shared instance).

On Android, it is implemented using the CookieManager class. On iOS and MacOS, it is implemented using the WKHTTPCookieStore class. On Web platform, it is implemented using Javascript.

Basic Usage

Note for iOS below 11.0, MacOS 10.13 and Web platform (LIMITED SUPPORT!)

In this case, almost all of the methods (CookieManager.deleteAllCookies and CookieManager.getAllCookies are not supported!) has been implemented using JavaScript because there is no other way to work with them on iOS below 11.0 and MacOS 10.13. Check here for JavaScript restrictions.


// get the CookieManager instance
CookieManager cookieManager = CookieManager.instance();

// set the expiration date for the cookie in milliseconds
final expiresDate = 3)).millisecondsSinceEpoch;
final url = WebUri("");

// set the cookie
await cookieManager.setCookie(
url: url,
name: "myCookie",
value: "myValue",
expiresDate: expiresDate,
isSecure: true,

// get cookies
List<Cookie> cookies = await cookieManager.getCookies(url: url);

// get a cookie
Cookie? cookie = await cookieManager.getCookie(url: url, name: "myCookie");

// delete a cookie
await cookieManager.deleteCookie(url: url, name: "myCookie");

// delete cookies
await cookieManager.deleteCookies(url: url, domain: "");