Codec<S, T> class abstract mixin

A Codec encodes and (if supported) decodes data.

Codecs can be fused. For example fusing json and utf8 produces an encoder that can convert Json objects directly to bytes, or can decode bytes directly to json objects.

Fused codecs generally attempt to optimize the operations and can be faster than executing each step of an encoding separately.

The Codec class provides a default implementation of encode, decode, fuse and inverted. Subclasses can choose to provide more efficient implementations of these.

Implementers

Constructors

Codec()
const

Properties

decoder Converter<T, S>
Returns the decoder of this, converting from T to S.
read-only
encoder Converter<S, T>
Returns the encoder from S to T.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
inverted Codec<T, S>
Inverts this.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

decode(T encoded) → S
Decodes encoded data.
encode(S input) → T
Encodes input.
fuse<R>(Codec<T, R> other) Codec<S, R>
Fuses this with other.
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