Cookies class

Class for controlling your Cookies and creating CookieBanners. IMPORTANT: Don't forget to change the default value of your main-cookie-id: acceptedCookiesId.

Constructors

Cookies()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

acceptedCookiesId String
Change this to the value where you want to save your users decision.
getter/setter pair

Static Methods

checkAccepted(BuildContext context, {CookieBanner? banner}) → void
Call this if you want to check if the users allowed cookies and show a banner if not. Create your own CookieBanner banner by creating your own Banner Class which extends CookieBanner. The acceptedId of your own CookieBanner overwrites the acceptedCookiesId.
create(String id, String content) → void
Creates a new Cookie identified by id and saves content in it.
exists(String id) bool
Checks if there exists a cookie with id.
get(String id) String?
Returns the content of the cookie with id. Returns null if there is no Cookie.
remove(String id) → void
Removes an existing Cookie with id.
removeAllCookies() → void
Removes all in this Session created Cookies.
wrapBanner({required Widget child, CookieBanner? banner}) Widget
Wrap Cookie.wrapBanner(child) around your Site to show the CookieBanner if needed. Create your own CookieBanner by creating your own Banner Class which extends CookieBanner. IMPORTANT: Don't forget to change the default value of your main-cookie-id: acceptedCookiesId.