Codec<T> class abstract interface

A reversible encoder for a value of type T to / from a JSON-compatible representation.

Object? covers any value accepted by dart:convert.JsonCodec: null, bool, int, double, String, List<Object?>, or Map<String, Object?>. The actual concrete type returned by encode depends on the implementation; CRDT codecs always return a Map<String, Object?> while primitive codecs return primitives.

Codecs are pure values: no state, no side effects, safe to share across isolates.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(Object? json) → T
encode(T value) Object?
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