Codec<S, T> 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.

Implementers

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. [...]
hashCodeint
read-only, inherited
The hash code for this object. [...]
invertedCodec<T, S>
read-only
Inverts this. [...]
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.

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
inherited
Invoked when a non-existent method or property is accessed. [...]
toString() → String
inherited
A string representation of this object. [...]

Operators

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

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