CodecRegistry class Null safety

Provides encoding and decoding services based on the ContentType of a Request or Response.

The defaultInstance provides a lookup table of ContentType to Codec. By default, 'application/json', 'application/x-www-form-urlencoded' and 'text/*' content types have codecs and can transform a Response.body into a list of bytes that can be transferred as an HTTP response body.

Additional mappings are added via add. This method must be called per-isolate and it is recommended to add mappings in an application's ApplicationChannel subclass constructor.


hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


add(ContentType contentType, Codec codec, {bool allowCompression = true}) → void
Adds a custom codec for contentType. [...]
codecForContentType(ContentType? contentType) Codec<dynamic, List<int>>?
Returns a Codec for contentType. [...]
isContentTypeCompressable(ContentType? contentType) bool
Whether or not contentType has been configured to be compressed. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
setAllowsCompression(ContentType contentType, bool allowed) → void
Toggles whether HTTP bodies of contentType are compressed with GZIP. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]

Static Properties

defaultInstance CodecRegistry
The instance used by Conduit to encode and decode HTTP bodies. [...]