Codec abstract class

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.

Implemented by

Constructors

Codec()
const

Properties

decoderConverter<T, S>
read-only

Returns the decoder of this, converting from T to S.

encoderConverter<S, T>
read-only

Returns the encoder from S to T.

invertedCodec<T, S>
read-only

Inverts this.

hashCodeint
read-only, inherited

The hash code for this object.

runtimeTypeType
read-only, inherited

A representation of the runtime type of the object.

Operators

operator ==(other) → bool
inherited

The equality operator.

Methods

decode(T encoded) → S
encode(S input) → T
fuse<R>(Codec<T, R> other) → Codec<S, R>

Fuses this with other.

noSuchMethod(Invocation invocation) → dynamic
inherited

Invoked when a non-existent method or property is accessed.

toString() → String
inherited

Returns a string representation of this object.

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-convert/Codec-class.html