client_cookie 3.0.2 copy "client_cookie: ^3.0.2" to clipboard
client_cookie: ^3.0.2 copied to clipboard

Emulates Cookie store for dart:io and Flutter as if its a Browser. Parses cookies from 'set-cookie' response header and also writes cookies to request header.

client_cookie #

Emulates Cookie store for dart:io and Flutter as if its a Browser.

Cookies #

Lets create a cookie named Client with value jaguar_resty:

main() {
  var cookie = new ClientCookie('Client', 'jaguar_resty', 
    new DateTime.now());
}

Use header getter obtain cookie in String format that can be directly added to HTTP request:

main() {
  var cookie = new ClientCookie('Client', 'jaguar_resty', 
    new DateTime.now());
  print(cookie.header);
}

Encoding a bunch of cookies #

ClientCookie has a static method called toHeader that encodes multiple cookies into a header string:

main() {
  var cookie1 = new ClientCookie('Client', 'jaguar_resty', new DateTime.now());
  var cookie2 = new ClientCookie('Client', 'jaguar_resty', new DateTime.now());
  print(ClientCookie.toHeader([cookie1, cookie2]));
}
6
likes
120
pub points
52%
popularity

Publisher

unverified uploader

Emulates Cookie store for dart:io and Flutter as if its a Browser. Parses cookies from 'set-cookie' response header and also writes cookies to request header.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

http

More

Packages that depend on client_cookie