KeyValueCodec<A> final
final class KeyValueCodec<A> extends Codec<A>A Codec that reads and writes a single JSON object field.
KeyValueCodec binds a Codec to a named object key, so that decoding navigates into that field and encoding wraps the value in a single-key object. Multiple KeyValueCodecs can be combined into a product codec for a whole object via the product2–product8 static methods (or the extension syntax on tuples exposed by syntax.dart).
final nameCodec = KeyValueCodec('name', Codec.string);
final ageCodec = KeyValueCodec('age', Codec.integer);
final personCodec = KeyValueCodec.product2(
nameCodec, ageCodec,
Person.new,
(p) => (p.name, p.age),
);Inheritance
Object → Decoder<A> → Codec<A> → KeyValueCodec<A>
Constructors
KeyValueCodec()
KeyValueCodec(String key, Codec<A> value)Creates a KeyValueCodec that decodes from and encodes to key using value.
Implementation
KeyValueCodec(this.key, this.value)
: codecKV = Codec.from(
value.at(key),
value.mapJson((a) => Json.fromJsonObject(JsonObject.fromIterable([(key, a)]))),
);Properties
codecKV final
final Codec<A> codecKVInternal codec that handles field navigation and single-key object wrapping.
Implementation
final Codec<A> codecKV;hashCode no setter inherited
int get hashCodeThe hash code for this object.
A hash code is a single integer which represents the state of the object that affects operator == comparisons.
All objects have hash codes. The default hash code implemented by Object represents only the identity of the object, the same way as the default operator == implementation only considers objects equal if they are identical (see identityHashCode).
If operator == is overridden to use the object state instead, the hash code must also be changed to represent that state, otherwise the object cannot be used in hash based data structures like the default Set and Map implementations.
Hash codes must be the same for objects that are equal to each other according to operator ==. The hash code of an object should only change if the object changes in a way that affects equality. There are no further requirements for the hash codes. They need not be consistent between executions of the same program and there are no distribution guarantees.
Objects that are not equal are allowed to have the same hash code. It is even technically allowed that all instances have the same hash code, but if clashes happen too often, it may reduce the efficiency of hash-based data structures like HashSet or HashMap.
If a subclass overrides hashCode, it should override the operator == operator as well to maintain consistency.
Inherited from Object.
Implementation
external int get hashCode;key final
final String keyThe JSON object key this codec reads from and writes to.
Implementation
final String key;runtimeType no setter inherited
Type get runtimeTypeA representation of the runtime type of the object.
Inherited from Object.
Implementation
external Type get runtimeType;value final
final Codec<A> valueThe codec applied to the value at key.
Implementation
final Codec<A> value;Methods
at() inherited
Decoder<A> at(String key)Returns a decoder that navigates into key before decoding.
Inherited from Decoder.
Implementation
Decoder<A> at(String key) => DownFieldDecoder(key, this);atField() inherited
KeyValueCodec<A> atField(String key)Binds this codec to key, producing a KeyValueCodec that decodes from and encodes to a single named object field.
Inherited from Codec.
Implementation
KeyValueCodec<A> atField(String key) => KeyValueCodec(key, this);contramap() inherited
Encoder<B> contramap<B>(A Function(B) f)Returns an encoder for B that converts a B to A with f and then delegates to this encoder.
Inherited from Encoder.
Implementation
Encoder<B> contramap<B>(Function1<B, A> f) => ContramapEncoder(this, f);decode() inherited
DecodeResult<DecodingFailure, A> decode(Json json)Decodes json by wrapping it in a root cursor.
Inherited from Decoder.
Implementation
DecodeResult<A> decode(Json json) => decodeC(json.hcursor);decodeC() override
DecodeResult<DecodingFailure, A> decodeC(HCursor cursor)Decodes from an HCursor with full history available for error reporting.
Implementation
@override
DecodeResult<A> decodeC(HCursor cursor) => codecKV.decodeC(cursor);either() inherited
Returns a decoder that tries this decoder first (producing Left) and falls back to decodeB (producing Right).
Inherited from Decoder.
Implementation
Decoder<Either<A, B>> either<B>(Decoder<B> decodeB) => EitherDecoder(this, decodeB);emap() inherited
Returns a decoder that applies f to the decoded value; f may return Left(message) to signal a failure.
Inherited from Decoder.
Implementation
Decoder<B> emap<B>(Function1<A, Either<String, B>> f) => EmapDecoder(this, f);encode() override
Json encode(A a)Encodes a as a Json value.
Implementation
@override
Json encode(A a) => codecKV.encode(a);ensure() inherited
Decoder<A> ensure(bool Function(A) p, String Function() message)Returns a decoder that fails with message if p returns false for the decoded value.
Inherited from Decoder.
Implementation
Decoder<A> ensure(Function1<A, bool> p, Function0<String> message) => Decoder.instance(
(c) => decodeC(c).filterOrElse(p, () => DecodingFailure.fromString(message(), c)),
);flatMap() inherited
Returns a decoder that uses the decoded A to choose the next decoder.
Inherited from Decoder.
Implementation
Decoder<B> flatMap<B>(Function1<A, Decoder<B>> f) => FlatMapDecoder(this, f);handleError() inherited
Decoder<A> handleError(A Function(DecodingFailure) f)Returns a decoder that recovers from failure by applying f to produce a fallback value.
Inherited from Decoder.
Implementation
Decoder<A> handleError(Function1<DecodingFailure, A> f) =>
handleErrorWith((err) => Decoder.instance((_) => f(err).asRight()));handleErrorWith() inherited
Decoder<A> handleErrorWith(Decoder<A> Function(DecodingFailure) f)Returns a decoder that recovers from failure by using f to choose a fallback decoder.
Inherited from Decoder.
Implementation
Decoder<A> handleErrorWith(Function1<DecodingFailure, Decoder<A>> f) =>
HandleErrorDecoder(this, f);iemap() override
KeyValueCodec<B> iemap<B>(Either<String, B> Function(A) f, A Function(B) g)Returns a new codec that maps decoded values through f and encodes with g. f may return Left(message) to signal a decoding failure.
Implementation
@override
KeyValueCodec<B> iemap<B>(
Function1<A, Either<String, B>> f,
Function1<B, A> g,
) => KeyValueCodec(key, value.iemap(f, g));map() inherited
Decoder<B> map<B>(B Function(A) f)Returns a decoder that maps successfully decoded values through f.
Inherited from Decoder.
Implementation
Decoder<B> map<B>(Function1<A, B> f) => Decoder.instance((c) => decodeC(c).map(f));mapJson() inherited
Returns an encoder that applies f to the encoded Json.
Inherited from Encoder.
Implementation
Encoder<A> mapJson(Function1<Json, Json> f) => Encoder.instance((a) => f(encode(a)));noSuchMethod() inherited
dynamic noSuchMethod(Invocation invocation)Invoked when a nonexistent method or property is accessed.
A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:
dynamic object = 1;
object.add(42); // Statically allowed, run-time errorThis invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).
Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.
A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:
class MockList<T> implements List<T> {
noSuchMethod(Invocation invocation) {
log(invocation);
super.noSuchMethod(invocation); // Will throw.
}
}
void main() {
MockList().add(42);
}This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.
If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.
The default behavior is to throw a NoSuchMethodError.
Inherited from Object.
Implementation
@pragma("vm:entry-point")
@pragma("wasm:entry-point")
external dynamic noSuchMethod(Invocation invocation);nullable() override
KeyValueCodec<A?> nullable()Returns a codec for nullable A: encodes null as JNull and decodes JNull or a missing field as Dart null.
Implementation
@override
KeyValueCodec<A?> nullable() => KeyValueCodec(key, value.nullable());optional() override
KeyValueCodec<Option<A>> optional()Returns a codec for Option<A>: encodes None as JNull and decodes JNull or a missing field as None.
Implementation
@override
KeyValueCodec<Option<A>> optional() => KeyValueCodec(key, value.optional());or() inherited
Returns a decoder that tries this decoder first, falling back to d if it fails.
Inherited from Decoder.
Implementation
Decoder<A> or(Decoder<A> d) => OrDecoder(this, d);prepare() inherited
Returns a decoder that applies f to the cursor before decoding.
Inherited from Decoder.
Implementation
Decoder<A> prepare(Function1<ACursor, ACursor> f) => PreparedDecoder(this, f);recover() inherited
Decoder<A> recover(A a)Returns a decoder that falls back to a on failure.
Inherited from Decoder.
Implementation
Decoder<A> recover(A a) => recoverWith(Decoder.instance((_) => a.asRight()));recoverWith() inherited
Returns a decoder that falls back to other on failure.
Inherited from Decoder.
Implementation
Decoder<A> recoverWith(Decoder<A> other) => handleErrorWith((_) => other);toString() inherited
String toString()A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.
Inherited from Object.
Implementation
external String toString();tryDecodeC() override
DecodeResult<DecodingFailure, A> tryDecodeC(ACursor cursor)Decodes from an ACursor, returning a failure if the cursor is in a failed state.
Implementation
@override
DecodeResult<A> tryDecodeC(ACursor cursor) => codecKV.tryDecodeC(cursor);withKey()
KeyValueCodec<A> withKey(String newKey)Returns a copy of this codec that reads from and writes to newKey instead of key.
Implementation
KeyValueCodec<A> withKey(String newKey) => KeyValueCodec(newKey, value);xmap() override
KeyValueCodec<B> xmap<B>(B Function(A) f, A Function(B) g)Returns a new codec that maps decoded values through f and encodes with g. Unlike iemap, f must always succeed.
Implementation
@override
KeyValueCodec<B> xmap<B>(Function1<A, B> f, Function1<B, A> g) =>
KeyValueCodec(key, value.xmap(f, g));Operators
operator ==() inherited
bool operator ==(Object other)The equality operator.
The default behavior for all Objects is to return true if and only if this object and other are the same object.
Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:
Total: It must return a boolean for all arguments. It should never throw.
Reflexive: For all objects
o,o == omust be true.Symmetric: For all objects
o1ando2,o1 == o2ando2 == o1must either both be true, or both be false.Transitive: For all objects
o1,o2, ando3, ifo1 == o2ando2 == o3are true, theno1 == o3must be true.
The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.
If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.
Inherited from Object.
Implementation
external bool operator ==(Object other);Static Methods
product10() override
Codec<K> product10<A, B, C, D, E, F, G, H, I, J, K>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
K Function(A, B, C, D, E, F, G, H, I, J) apply,
Record Function(K) tupled,
)Combines 10 field codecs into a codec for type K.
Implementation
static Codec<K> product10<A, B, C, D, E, F, G, H, I, J, K>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
Function10<A, B, C, D, E, F, G, H, I, J, K> apply,
Function1<K, (A, B, C, D, E, F, G, H, I, J)> tupled,
) {
final decoder = PrimitiveDecoder<K>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<K>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product11() override
Codec<L> product11<A, B, C, D, E, F, G, H, I, J, K, L>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
L Function(A, B, C, D, E, F, G, H, I, J, K) apply,
Record Function(L) tupled,
)Combines 11 field codecs into a codec for type L.
Implementation
static Codec<L> product11<A, B, C, D, E, F, G, H, I, J, K, L>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
Function11<A, B, C, D, E, F, G, H, I, J, K, L> apply,
Function1<L, (A, B, C, D, E, F, G, H, I, J, K)> tupled,
) {
final decoder = PrimitiveDecoder<L>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<L>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product12() override
Codec<M> product12<A, B, C, D, E, F, G, H, I, J, K, L, M>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
M Function(A, B, C, D, E, F, G, H, I, J, K, L) apply,
Record Function(M) tupled,
)Combines 12 field codecs into a codec for type M.
Implementation
static Codec<M> product12<A, B, C, D, E, F, G, H, I, J, K, L, M>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
Function12<A, B, C, D, E, F, G, H, I, J, K, L, M> apply,
Function1<M, (A, B, C, D, E, F, G, H, I, J, K, L)> tupled,
) {
final decoder = PrimitiveDecoder<M>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<M>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product13() override
Codec<N> product13<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
N Function(A, B, C, D, E, F, G, H, I, J, K, L, M) apply,
Record Function(N) tupled,
)Combines 13 field codecs into a codec for type N.
Implementation
static Codec<N> product13<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
Function13<A, B, C, D, E, F, G, H, I, J, K, L, M, N> apply,
Function1<N, (A, B, C, D, E, F, G, H, I, J, K, L, M)> tupled,
) {
final decoder = PrimitiveDecoder<N>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<N>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product14() override
Codec<O> product14<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
O Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N) apply,
Record Function(O) tupled,
)Combines 14 field codecs into a codec for type O.
Implementation
static Codec<O> product14<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
Function14<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> apply,
Function1<O, (A, B, C, D, E, F, G, H, I, J, K, L, M, N)> tupled,
) {
final decoder = PrimitiveDecoder<O>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<O>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product15() override
Codec<P> product15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
P Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) apply,
Record Function(P) tupled,
)Combines 15 field codecs into a codec for type P.
Implementation
static Codec<P> product15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
Function15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> apply,
Function1<P, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)> tupled,
) {
final decoder = PrimitiveDecoder<P>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<P>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product16() override
Codec<Q> product16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
Q Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) apply,
Record Function(Q) tupled,
)Combines 16 field codecs into a codec for type Q.
Implementation
static Codec<Q> product16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
Function16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q> apply,
Function1<Q, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)> tupled,
) {
final decoder = PrimitiveDecoder<Q>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<Q>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product17() override
Codec<R> product17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
R Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) apply,
Record Function(R) tupled,
)Combines 17 field codecs into a codec for type R.
Implementation
static Codec<R> product17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
Function17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R> apply,
Function1<R, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)> tupled,
) {
final decoder = PrimitiveDecoder<R>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
final rq = _decodeField(obj, codecQ);
if (rq.isLeft) return (rq as Left<DecodingFailure, Q>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
_get(rq),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
codecQ.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<R>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
(codecQ.key, codecQ.value.encode(q)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product18() override
Codec<S> product18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
S Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) apply,
Record Function(S) tupled,
)Combines 18 field codecs into a codec for type S.
Implementation
static Codec<S> product18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
Function18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S> apply,
Function1<S, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)> tupled,
) {
final decoder = PrimitiveDecoder<S>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
final rq = _decodeField(obj, codecQ);
if (rq.isLeft) return (rq as Left<DecodingFailure, Q>).a.asLeft();
final rr = _decodeField(obj, codecR);
if (rr.isLeft) return (rr as Left<DecodingFailure, R>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
_get(rq),
_get(rr),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
codecQ.decodeC(cursor),
codecR.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<S>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
(codecQ.key, codecQ.value.encode(q)),
(codecR.key, codecR.value.encode(r)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product19() override
Codec<T> product19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
T Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) apply,
Record Function(T) tupled,
)Combines 19 field codecs into a codec for type T.
Implementation
static Codec<T> product19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
Function19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T> apply,
Function1<T, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)> tupled,
) {
final decoder = PrimitiveDecoder<T>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
final rq = _decodeField(obj, codecQ);
if (rq.isLeft) return (rq as Left<DecodingFailure, Q>).a.asLeft();
final rr = _decodeField(obj, codecR);
if (rr.isLeft) return (rr as Left<DecodingFailure, R>).a.asLeft();
final rs = _decodeField(obj, codecS);
if (rs.isLeft) return (rs as Left<DecodingFailure, S>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
_get(rq),
_get(rr),
_get(rs),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
codecQ.decodeC(cursor),
codecR.decodeC(cursor),
codecS.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<T>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
(codecQ.key, codecQ.value.encode(q)),
(codecR.key, codecR.value.encode(r)),
(codecS.key, codecS.value.encode(s)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product2() override
Codec<C> product2<A, B, C>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
C Function(A, B) apply,
Record Function(C) tupled,
)Combines two field codecs into a codec for type C.
apply constructs a C from the two decoded field values; tupled destructs a C into the two field values for encoding.
Implementation
static Codec<C> product2<A, B, C>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
Function2<A, B, C> apply,
Function1<C, (A, B)> tupled,
) {
final decoder = PrimitiveDecoder<C>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
return apply(_get(ra), _get(rb)).asRight();
},
(cursor) => (codecA.decodeC(cursor), codecB.decodeC(cursor)).mapN(apply),
);
final encoder = Encoder.instance<C>(
(a) => tupled(a)(
(a, b) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product20() override
Codec<U> product20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
U Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) apply,
Record Function(U) tupled,
)Combines 20 field codecs into a codec for type U.
Implementation
static Codec<U> product20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
Function20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U> apply,
Function1<U, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)> tupled,
) {
final decoder = PrimitiveDecoder<U>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
final rq = _decodeField(obj, codecQ);
if (rq.isLeft) return (rq as Left<DecodingFailure, Q>).a.asLeft();
final rr = _decodeField(obj, codecR);
if (rr.isLeft) return (rr as Left<DecodingFailure, R>).a.asLeft();
final rs = _decodeField(obj, codecS);
if (rs.isLeft) return (rs as Left<DecodingFailure, S>).a.asLeft();
final rt = _decodeField(obj, codecT);
if (rt.isLeft) return (rt as Left<DecodingFailure, T>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
_get(rq),
_get(rr),
_get(rs),
_get(rt),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
codecQ.decodeC(cursor),
codecR.decodeC(cursor),
codecS.decodeC(cursor),
codecT.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<U>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
(codecQ.key, codecQ.value.encode(q)),
(codecR.key, codecR.value.encode(r)),
(codecS.key, codecS.value.encode(s)),
(codecT.key, codecT.value.encode(t)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product21() override
Codec<V> product21<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
V Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) apply,
Record Function(V) tupled,
)Combines 21 field codecs into a codec for type V.
Implementation
static Codec<V> product21<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
Function21<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V> apply,
Function1<V, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)> tupled,
) {
final decoder = PrimitiveDecoder<V>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
final rq = _decodeField(obj, codecQ);
if (rq.isLeft) return (rq as Left<DecodingFailure, Q>).a.asLeft();
final rr = _decodeField(obj, codecR);
if (rr.isLeft) return (rr as Left<DecodingFailure, R>).a.asLeft();
final rs = _decodeField(obj, codecS);
if (rs.isLeft) return (rs as Left<DecodingFailure, S>).a.asLeft();
final rt = _decodeField(obj, codecT);
if (rt.isLeft) return (rt as Left<DecodingFailure, T>).a.asLeft();
final ru = _decodeField(obj, codecU);
if (ru.isLeft) return (ru as Left<DecodingFailure, U>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
_get(rq),
_get(rr),
_get(rs),
_get(rt),
_get(ru),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
codecQ.decodeC(cursor),
codecR.decodeC(cursor),
codecS.decodeC(cursor),
codecT.decodeC(cursor),
codecU.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<V>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
(codecQ.key, codecQ.value.encode(q)),
(codecR.key, codecR.value.encode(r)),
(codecS.key, codecS.value.encode(s)),
(codecT.key, codecT.value.encode(t)),
(codecU.key, codecU.value.encode(u)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product22() override
Codec<W> product22<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
KeyValueCodec<V> codecV,
W Function(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) apply,
Record Function(W) tupled,
)Combines 22 field codecs into a codec for type W.
Implementation
static Codec<W> product22<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
KeyValueCodec<V> codecV,
Function22<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W> apply,
Function1<W, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)> tupled,
) {
final decoder = PrimitiveDecoder<W>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
final rj = _decodeField(obj, codecJ);
if (rj.isLeft) return (rj as Left<DecodingFailure, J>).a.asLeft();
final rk = _decodeField(obj, codecK);
if (rk.isLeft) return (rk as Left<DecodingFailure, K>).a.asLeft();
final rl = _decodeField(obj, codecL);
if (rl.isLeft) return (rl as Left<DecodingFailure, L>).a.asLeft();
final rm = _decodeField(obj, codecM);
if (rm.isLeft) return (rm as Left<DecodingFailure, M>).a.asLeft();
final rn = _decodeField(obj, codecN);
if (rn.isLeft) return (rn as Left<DecodingFailure, N>).a.asLeft();
final ro = _decodeField(obj, codecO);
if (ro.isLeft) return (ro as Left<DecodingFailure, O>).a.asLeft();
final rp = _decodeField(obj, codecP);
if (rp.isLeft) return (rp as Left<DecodingFailure, P>).a.asLeft();
final rq = _decodeField(obj, codecQ);
if (rq.isLeft) return (rq as Left<DecodingFailure, Q>).a.asLeft();
final rr = _decodeField(obj, codecR);
if (rr.isLeft) return (rr as Left<DecodingFailure, R>).a.asLeft();
final rs = _decodeField(obj, codecS);
if (rs.isLeft) return (rs as Left<DecodingFailure, S>).a.asLeft();
final rt = _decodeField(obj, codecT);
if (rt.isLeft) return (rt as Left<DecodingFailure, T>).a.asLeft();
final ru = _decodeField(obj, codecU);
if (ru.isLeft) return (ru as Left<DecodingFailure, U>).a.asLeft();
final rv = _decodeField(obj, codecV);
if (rv.isLeft) return (rv as Left<DecodingFailure, V>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
_get(rj),
_get(rk),
_get(rl),
_get(rm),
_get(rn),
_get(ro),
_get(rp),
_get(rq),
_get(rr),
_get(rs),
_get(rt),
_get(ru),
_get(rv),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
codecJ.decodeC(cursor),
codecK.decodeC(cursor),
codecL.decodeC(cursor),
codecM.decodeC(cursor),
codecN.decodeC(cursor),
codecO.decodeC(cursor),
codecP.decodeC(cursor),
codecQ.decodeC(cursor),
codecR.decodeC(cursor),
codecS.decodeC(cursor),
codecT.decodeC(cursor),
codecU.decodeC(cursor),
codecV.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<W>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
(codecJ.key, codecJ.value.encode(j)),
(codecK.key, codecK.value.encode(k)),
(codecL.key, codecL.value.encode(l)),
(codecM.key, codecM.value.encode(m)),
(codecN.key, codecN.value.encode(n)),
(codecO.key, codecO.value.encode(o)),
(codecP.key, codecP.value.encode(p)),
(codecQ.key, codecQ.value.encode(q)),
(codecR.key, codecR.value.encode(r)),
(codecS.key, codecS.value.encode(s)),
(codecT.key, codecT.value.encode(t)),
(codecU.key, codecU.value.encode(u)),
(codecV.key, codecV.value.encode(v)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product3() override
Codec<D> product3<A, B, C, D>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
D Function(A, B, C) apply,
Record Function(D) tupled,
)Combines three field codecs into a codec for type D.
Implementation
static Codec<D> product3<A, B, C, D>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
Function3<A, B, C, D> apply,
Function1<D, (A, B, C)> tupled,
) {
final decoder = PrimitiveDecoder<D>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
return apply(_get(ra), _get(rb), _get(rc)).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<D>(
(a) => tupled(a)(
(a, b, c) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product4() override
Codec<E> product4<A, B, C, D, E>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
E Function(A, B, C, D) apply,
Record Function(E) tupled,
)Combines four field codecs into a codec for type E.
Implementation
static Codec<E> product4<A, B, C, D, E>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
Function4<A, B, C, D, E> apply,
Function1<E, (A, B, C, D)> tupled,
) {
final decoder = PrimitiveDecoder<E>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
return apply(_get(ra), _get(rb), _get(rc), _get(rd)).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<E>(
(a) => tupled(a)(
(a, b, c, d) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product5() override
Codec<F> product5<A, B, C, D, E, F>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
F Function(A, B, C, D, E) apply,
Record Function(F) tupled,
)Combines 5 field codecs into a codec for type F.
Implementation
static Codec<F> product5<A, B, C, D, E, F>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
Function5<A, B, C, D, E, F> apply,
Function1<F, (A, B, C, D, E)> tupled,
) {
final decoder = PrimitiveDecoder<F>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
return apply(_get(ra), _get(rb), _get(rc), _get(rd), _get(re)).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<F>(
(a) => tupled(a)(
(a, b, c, d, e) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product6() override
Codec<G> product6<A, B, C, D, E, F, G>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
G Function(A, B, C, D, E, F) apply,
Record Function(G) tupled,
)Combines 6 field codecs into a codec for type G.
Implementation
static Codec<G> product6<A, B, C, D, E, F, G>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
Function6<A, B, C, D, E, F, G> apply,
Function1<G, (A, B, C, D, E, F)> tupled,
) {
final decoder = PrimitiveDecoder<G>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
return apply(_get(ra), _get(rb), _get(rc), _get(rd), _get(re), _get(rf)).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<G>(
(a) => tupled(a)(
(a, b, c, d, e, f) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product7() override
Codec<H> product7<A, B, C, D, E, F, G, H>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
H Function(A, B, C, D, E, F, G) apply,
Record Function(H) tupled,
)Combines 7 field codecs into a codec for type H.
Implementation
static Codec<H> product7<A, B, C, D, E, F, G, H>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
Function7<A, B, C, D, E, F, G, H> apply,
Function1<H, (A, B, C, D, E, F, G)> tupled,
) {
final decoder = PrimitiveDecoder<H>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<H>(
(a) => tupled(a)(
(a, b, c, d, e, f, g) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product8() override
Codec<I> product8<A, B, C, D, E, F, G, H, I>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
I Function(A, B, C, D, E, F, G, H) apply,
Record Function(I) tupled,
)Combines 8 field codecs into a codec for type I.
Implementation
static Codec<I> product8<A, B, C, D, E, F, G, H, I>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
Function8<A, B, C, D, E, F, G, H, I> apply,
Function1<I, (A, B, C, D, E, F, G, H)> tupled,
) {
final decoder = PrimitiveDecoder<I>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<I>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
]),
),
),
);
return Codec.from(decoder, encoder);
}product9() override
Codec<J> product9<A, B, C, D, E, F, G, H, I, J>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
J Function(A, B, C, D, E, F, G, H, I) apply,
Record Function(J) tupled,
)Combines 9 field codecs into a codec for type J.
Implementation
static Codec<J> product9<A, B, C, D, E, F, G, H, I, J>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
Function9<A, B, C, D, E, F, G, H, I, J> apply,
Function1<J, (A, B, C, D, E, F, G, H, I)> tupled,
) {
final decoder = PrimitiveDecoder<J>(
(json) {
if (json is! JObject) {
return DecodingFailure(WrongTypeExpectation('object', json), nil<CursorOp>()).asLeft();
}
final obj = json.value;
final ra = _decodeField(obj, codecA);
if (ra.isLeft) return (ra as Left<DecodingFailure, A>).a.asLeft();
final rb = _decodeField(obj, codecB);
if (rb.isLeft) return (rb as Left<DecodingFailure, B>).a.asLeft();
final rc = _decodeField(obj, codecC);
if (rc.isLeft) return (rc as Left<DecodingFailure, C>).a.asLeft();
final rd = _decodeField(obj, codecD);
if (rd.isLeft) return (rd as Left<DecodingFailure, D>).a.asLeft();
final re = _decodeField(obj, codecE);
if (re.isLeft) return (re as Left<DecodingFailure, E>).a.asLeft();
final rf = _decodeField(obj, codecF);
if (rf.isLeft) return (rf as Left<DecodingFailure, F>).a.asLeft();
final rg = _decodeField(obj, codecG);
if (rg.isLeft) return (rg as Left<DecodingFailure, G>).a.asLeft();
final rh = _decodeField(obj, codecH);
if (rh.isLeft) return (rh as Left<DecodingFailure, H>).a.asLeft();
final ri = _decodeField(obj, codecI);
if (ri.isLeft) return (ri as Left<DecodingFailure, I>).a.asLeft();
return apply(
_get(ra),
_get(rb),
_get(rc),
_get(rd),
_get(re),
_get(rf),
_get(rg),
_get(rh),
_get(ri),
).asRight();
},
(cursor) => (
codecA.decodeC(cursor),
codecB.decodeC(cursor),
codecC.decodeC(cursor),
codecD.decodeC(cursor),
codecE.decodeC(cursor),
codecF.decodeC(cursor),
codecG.decodeC(cursor),
codecH.decodeC(cursor),
codecI.decodeC(cursor),
).mapN(apply),
);
final encoder = Encoder.instance<J>(
(a) => tupled(a)(
(a, b, c, d, e, f, g, h, i) => Json.fromJsonObject(
JsonObject.fromIterable([
(codecA.key, codecA.value.encode(a)),
(codecB.key, codecB.value.encode(b)),
(codecC.key, codecC.value.encode(c)),
(codecD.key, codecD.value.encode(d)),
(codecE.key, codecE.value.encode(e)),
(codecF.key, codecF.value.encode(f)),
(codecG.key, codecG.value.encode(g)),
(codecH.key, codecH.value.encode(h)),
(codecI.key, codecI.value.encode(i)),
]),
),
),
);
return Codec.from(decoder, encoder);
}tuple10() override
Codec<Record> tuple10<A, B, C, D, E, F, G, H, I, J>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
)Combines 10 field codecs into a codec for a 10-tuple.
Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J)> tuple10<A, B, C, D, E, F, G, H, I, J>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
) => product10(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
(a, b, c, d, e, f, g, h, i, j) => (a, b, c, d, e, f, g, h, i, j),
identity,
);tuple11() override
Codec<Record> tuple11<A, B, C, D, E, F, G, H, I, J, K>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
)Combines 11 field codecs into a codec for a 11-tuple.
Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K)> tuple11<A, B, C, D, E, F, G, H, I, J, K>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
) => product11(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
(a, b, c, d, e, f, g, h, i, j, k) => (a, b, c, d, e, f, g, h, i, j, k),
identity,
);tuple12() override
Codec<Record> tuple12<A, B, C, D, E, F, G, H, I, J, K, L>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
)Combines 12 field codecs into a codec for a 12-tuple.
Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L)> tuple12<A, B, C, D, E, F, G, H, I, J, K, L>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
) => product12(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
(a, b, c, d, e, f, g, h, i, j, k, l) => (a, b, c, d, e, f, g, h, i, j, k, l),
identity,
);tuple13() override
Codec<Record> tuple13<A, B, C, D, E, F, G, H, I, J, K, L, M>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M)>
tuple13<A, B, C, D, E, F, G, H, I, J, K, L, M>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
) => product13(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
(a, b, c, d, e, f, g, h, i, j, k, l, m) => (a, b, c, d, e, f, g, h, i, j, k, l, m),
identity,
);tuple14() override
Codec<Record> tuple14<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N)>
tuple14<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
) => product14(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n) => (a, b, c, d, e, f, g, h, i, j, k, l, m, n),
identity,
);tuple15() override
Codec<Record> tuple15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)>
tuple15<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
) => product15(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o),
identity,
);tuple16() override
Codec<Record> tuple16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)>
tuple16<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
) => product16(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
),
identity,
);tuple17() override
Codec<Record> tuple17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)>
tuple17<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
) => product17(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
codecQ,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
),
identity,
);tuple18() override
Codec<Record> tuple18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)>
tuple18<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
) => product18(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
codecQ,
codecR,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
),
identity,
);tuple19() override
Codec<Record> tuple19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)>
tuple19<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
) => product19(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
codecQ,
codecR,
codecS,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
),
identity,
);tuple2() override
Codec<Record> tuple2<A, B>(KeyValueCodec<A> codecA, KeyValueCodec<B> codecB)/////////////////////////////////////////////////////////////////////////// Tuple Instances /////////////////////////////////////////////////////////////////////////// Combines 2 field codecs into a codec for a 2-tuple.
Implementation
/// Combines 2 field codecs into a codec for a 2-tuple.
static Codec<(A, B)> tuple2<A, B>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
) => product2(codecA, codecB, (a, b) => (a, b), identity);tuple20() override
Codec<Record> tuple20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)>
tuple20<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
) => product20(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
codecQ,
codecR,
codecS,
codecT,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
),
identity,
);tuple21() override
Codec<Record> tuple21<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)>
tuple21<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
) => product21(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
codecQ,
codecR,
codecS,
codecT,
codecU,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
),
identity,
);tuple22() override
Codec<Record> tuple22<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
KeyValueCodec<V> codecV,
)Implementation
static Codec<(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)>
tuple22<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
KeyValueCodec<J> codecJ,
KeyValueCodec<K> codecK,
KeyValueCodec<L> codecL,
KeyValueCodec<M> codecM,
KeyValueCodec<N> codecN,
KeyValueCodec<O> codecO,
KeyValueCodec<P> codecP,
KeyValueCodec<Q> codecQ,
KeyValueCodec<R> codecR,
KeyValueCodec<S> codecS,
KeyValueCodec<T> codecT,
KeyValueCodec<U> codecU,
KeyValueCodec<V> codecV,
) => product22(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
codecJ,
codecK,
codecL,
codecM,
codecN,
codecO,
codecP,
codecQ,
codecR,
codecS,
codecT,
codecU,
codecV,
(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) => (
a,
b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
),
identity,
);tuple3() override
Codec<Record> tuple3<A, B, C>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
)Combines 3 field codecs into a codec for a 3-tuple.
Implementation
static Codec<(A, B, C)> tuple3<A, B, C>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
) => product3(codecA, codecB, codecC, (a, b, c) => (a, b, c), identity);tuple4() override
Codec<Record> tuple4<A, B, C, D>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
)Combines 4 field codecs into a codec for a 4-tuple.
Implementation
static Codec<(A, B, C, D)> tuple4<A, B, C, D>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
) => product4(codecA, codecB, codecC, codecD, (a, b, c, d) => (a, b, c, d), identity);tuple5() override
Codec<Record> tuple5<A, B, C, D, E>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
)Combines 5 field codecs into a codec for a 5-tuple.
Implementation
static Codec<(A, B, C, D, E)> tuple5<A, B, C, D, E>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
) => product5(
codecA,
codecB,
codecC,
codecD,
codecE,
(a, b, c, d, e) => (a, b, c, d, e),
identity,
);tuple6() override
Codec<Record> tuple6<A, B, C, D, E, F>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
)Combines 6 field codecs into a codec for a 6-tuple.
Implementation
static Codec<(A, B, C, D, E, F)> tuple6<A, B, C, D, E, F>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
) => product6(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
(a, b, c, d, e, f) => (a, b, c, d, e, f),
identity,
);tuple7() override
Codec<Record> tuple7<A, B, C, D, E, F, G>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
)Combines 7 field codecs into a codec for a 7-tuple.
Implementation
static Codec<(A, B, C, D, E, F, G)> tuple7<A, B, C, D, E, F, G>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
) => product7(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
(a, b, c, d, e, f, g) => (a, b, c, d, e, f, g),
identity,
);tuple8() override
Codec<Record> tuple8<A, B, C, D, E, F, G, H>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
)Combines 8 field codecs into a codec for a 8-tuple.
Implementation
static Codec<(A, B, C, D, E, F, G, H)> tuple8<A, B, C, D, E, F, G, H>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
) => product8(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
(a, b, c, d, e, f, g, h) => (a, b, c, d, e, f, g, h),
identity,
);tuple9() override
Codec<Record> tuple9<A, B, C, D, E, F, G, H, I>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
)Combines 9 field codecs into a codec for a 9-tuple.
Implementation
static Codec<(A, B, C, D, E, F, G, H, I)> tuple9<A, B, C, D, E, F, G, H, I>(
KeyValueCodec<A> codecA,
KeyValueCodec<B> codecB,
KeyValueCodec<C> codecC,
KeyValueCodec<D> codecD,
KeyValueCodec<E> codecE,
KeyValueCodec<F> codecF,
KeyValueCodec<G> codecG,
KeyValueCodec<H> codecH,
KeyValueCodec<I> codecI,
) => product9(
codecA,
codecB,
codecC,
codecD,
codecE,
codecF,
codecG,
codecH,
codecI,
(a, b, c, d, e, f, g, h, i) => (a, b, c, d, e, f, g, h, i),
identity,
);