AcceptLanguageEntry class
A parsed entry from an HTTP Accept-Language header or browser preferences with quality weighting.
Implements Comparable to sort entries in descending order of quality weight (quality),
from highest preference (q=1.0) to lowest.
const entry = AcceptLanguageEntry('fr-FR', 0.9);
print(entry.tag); // "fr-FR"
print(entry.quality); // 0.9
See also:
- parseAcceptLanguage, which parses an entire header string into sorted entries.
- firstLocaleTag, extracting only the top priority tag.
- Implemented types
Constructors
- AcceptLanguageEntry(String tag, [double quality = 1.0])
-
Creates an AcceptLanguageEntry with
tagand optionalqualityweighting (defaults to1.0).const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- quality → double
-
Quality value weight (
q=) ranging between0.0and1.0.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tag → String
-
The BCP-47 language tag or subtag (e.g.
'fr','en-US').final
Methods
-
compareTo(
AcceptLanguageEntry other) → int -
Compares this object to another object.
override
-
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