Skip to content

analogic/cookie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Simple Cookies manipulation package for Dart

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages