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 value T
  • encode: Converts from the typed value T to 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.
const
factory
HeaderCodec.single(T singleDecode(String), Iterable<String> encode(T))
Factory constructor for creating a HeaderCodec that processes a single value.
const
factory

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 StorageT to the target type T
inherited
encode(T value) Iterable<String>
Converts from the target type T to the storage type StorageT
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