cookie 0.0.4 copy "cookie: ^0.0.4" to clipboard
cookie: ^0.0.4 copied to clipboard

Dart 1 only

Simple cookies manipulation (browser side) with api like jquery.cookie

Cookie #

Simple cookies manipulation (browser side) with api similar to jquery.cookie

Example #

	import 'package:cookie/cookie.dart' as cookie;

Create session cookie:

	cookie.set('the_cookie', 'the_value');

Create expiring cookie, 7 days from then:

	cookie.set('the_cookie', 'the_value', expires: 7);

Create expiring cookie, valid across entire site:

    cookie.set('the_cookie', 'the_value', expires: 7, path: '/');

Read cookie:

    cookie.get('the_cookie'); // => "the_value"
    cookie.get('not_existing'); // => null

Delete cookie:

    // Same path as when the cookie was written...
    cookie.remove('the_cookie', path: '/');

Note: when deleting a cookie, you must pass the exact same path, domain and secure options that were used to set the cookie, unless you're relying on the default options that is.

0
likes
30
pub points
55%
popularity

Publisher

unverified uploader

Simple cookies manipulation (browser side) with api like jquery.cookie

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

More

Packages that depend on cookie