HeaderAccessor<T extends Object> class final

A typed header, the HeaderName and the HeaderCodec that reads and writes it.

Always const constructed. Read one through a Headers like any other accessor:

final length = headers(Headers.contentLength);   // int?
final host = headers.get(Headers.host);           // throws if absent

The headers cache decoded values by accessor and raw value, so a header is parsed once per message.

Inheritance

Constructors

HeaderAccessor(HeaderName key, HeaderCodec<T> codec)
const

Properties

codec → HeaderCodec<T>
final
hashCode → int
The hash code for this object.
no setterinherited
key → HeaderName
The key used to identify this value in storage.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(Iterable<String> raw) → T
Decodes raw.
override
decodeBytes(T decoder(Uint8List), Uint8List bytes) → T
decoder over bytes, the wire bytes of the first field.
decodeFields(T decoder(List<Uint8List>), List<Uint8List> fields) → T
decoder over fields, the wire bytes of every field.
encode(T value) → Iterable<String>
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