SetCookie class final
A single HTTP Set-Cookie cookie: a name/value pair plus its attributes.
One Set-Cookie response header line maps to one SetCookie. A response
may set several cookies; the set of them is the SetCookieHeader
collection. Mirrors the request side, where one Cookie is an element of
the CookieHeader collection (but a request Cookie carries no
attributes).
Constructors
- SetCookie({required String name, required String value, DateTime? expires, int? maxAge, Host? domain, String? path, bool secure = false, bool httpOnly = false, SameSite? sameSite})
- Constructs a SetCookie with the specified name, value and attributes.
- SetCookie.parse(String value)
-
Parses a single
Set-Cookieline (without the header name) into a SetCookie.factory
Properties
- domain → Host?
-
The domain that the cookie applies to.
final
- expires → DateTime?
-
The time at which the cookie expires.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- httpOnly → bool
-
Whether the cookie is only sent in the HTTP request and is not made
available to client side scripts.
final
- maxAge → int?
-
The number of seconds until the cookie expires. A zero or negative value
means the cookie has expired.
final
- name → String
-
The name of the cookie.
final
- path → String?
-
The path within the domain that the cookie applies to.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sameSite → SameSite?
-
Whether the cookie is available from other sites.
final
- secure → bool
-
Whether to only send this cookie on secure connections.
final
- value → String
-
The value of the cookie.
final
Methods
-
encode(
) → String -
The wire form of this cookie: a single
Set-Cookievalue (without the header name). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override