register<T> function
void
register<T>(
- EJsonEncoder<
T> encoder, - EJsonDecoder<
T> decoder, { - Iterable<
Type> ? superTypes,
Register custom EJSON encoder
and decoder
for a type T
.
The last registered codec pair for a given type T
will be used.
Implementation
void register<T>(EJsonEncoder<T> encoder, EJsonDecoder<T> decoder, {Iterable<Type>? superTypes}) {
TypePlus.add<T>(superTypes: superTypes);
customEncoders[T] = encoder;
customDecoders[T] = decoder;
}