ETag class final

Represents an HTTP ETag entity tag for conditional requests.

An ETag is a string that uniquely identifies a specific version of a resource. It can be either strong (exact match required) or weak (semantic equivalence).

Example

final etag = ETag('abc123', false);
final weakEtag = ETag('xyz', true);
final wildcard = ETag.wildcard;

Constructors

ETag(String tag, bool weak)
Creates a new ETag instance.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag String
The unquoted entity tag value.
final
weak bool
Whether the ETag is weak.
final

Methods

compare(ETag other, bool strong) bool
Performs a comparison between this ETag and another ETag.
equalizedProperties() List<Object?>
Mixin-style contract for value-based equality, hashCode, and toString.
getFormattedTag() String
Returns the fully formatted ETag, including the W/ prefix for weak ETags and quotes around the tag value.
isWildcard() bool
Returns true if this ETag is a wildcard.
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.
inherited

Static Properties

wildcard ETag
Wildcard ETag matching any entity tag value.
final

Static Methods

create(String rawValue) ETag
Creates an ETag instance from a formatted string.
parse(String source) List<ETag>
Parses multiple ETags from an If-Match or If-None-Match HTTP header.
quoteETagIfNecessary(String tag) String
Wraps an ETag string in quotes if necessary.