HeaderCodec<T extends Object> class
sealed
A specialized codec for HTTP headers that defines conversion between a typed
value T and its string representation in headers.
This interface extends the generic _Codec by specializing the storage type
to Iterable<String>, which represents how multiple header values can be
stored for a single header name.
The interface provides two methods:
decode: Converts from header string values to the typed valueT- encode: Converts from the typed value
Tto header string values
Two factory constructors are provided:
- HeaderCodec: For handling headers that need to process multiple values
- HeaderCodec.single: For simpler headers that only need to process a single value
Constructors
-
HeaderCodec(T decode(Iterable<
String> encoded), Iterable<String> encode(T decoded)) -
Factory constructor for creating a HeaderCodec that processes multiple values.
constfactory
-
HeaderCodec.single(T singleDecode(String), Iterable<
String> encode(T)) -
Factory constructor for creating a HeaderCodec that processes a single value.
constfactory
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
-
decode(
Iterable< String> encoded) → T -
Converts from the storage type
StorageTto the target typeTinherited -
encode(
T value) → Iterable< String> -
Converts from the target type
Tto the storage typeStorageT -
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