encoding/layout/layout library

Classes

BaseInteger<T>
Shared contract for fixed-width integer layouts (IntegerLayout, BigIntLayout).
BaseLazyStructLayoutBuilder<T, SOURCE, R extends LayoutRepository>
Shared contract for a field whose layout is resolved lazily.
BigIntLayout
Fixed-width BigInt layout, for widths beyond what a Dart int holds.
BitSequenceLayout
Compact-length-prefixed bit sequence; the wire length is a bit count while the payload is stored byte-aligned.
CompactBigIntLayout
SCALE compact-encoded big integer, validated against layout's width.
CompactBytes
Compact-length-prefixed raw byte blob.
CompactIntLayout
SCALE compact-encoded integer, validated against layout's width.
CompactLengthPrefixedLayout<T>
Base for [compact length][payload]-encoded values. Subclasses only need to convert between raw payload bytes and T, plus how the wire length value maps to a payload byte count (see BitSequenceLayout).
CompactOffsetLayout
Offset layout that delegates to a compact-encoded CompactIntLayout.
ConstantLayout<T>
A layout that always decodes/encodes to a fixed value and takes no bytes.
ConvLayout<A, B>
Bidirectional mapping between a wire shape B and a domain type A.
COptionLayout<T>
Rust COption<T>: a 1-byte discriminator (0 = none, 1 = some) followed by layout when present.
CustomLayout<T, D>
Wraps layout with an encoder/decoder pair to expose it as a different domain type D.
DoubleLayout
Fixed-width floating point layout (32 or 64 bit).
DynamicBytesLayout
Self-delimiting bytes: discriminator-encoded length prefix + payload. Not every variable-length field uses this — a trailing field can just run to the end of the buffer (see RemainderListLayout in array.dart) — so check the actual field's encoding before assuming a length prefix.
DynamicSizeLayout<T>
Length-prefixed payload: a discriminator-encoded byte count followed by exactly that many bytes decoded through inner. The inner layout is bounded to just that byte range, so remainder-based inner layouts stop at the right place instead of reading into whatever follows.
EmptyLayout<R>
ExternalLayout
Base type for layouts whose span/position is resolved externally.
ExternalOffsetLayout
An ExternalLayout with a size that is only known once decoded.
GreedyCount
Consumes every remaining byte as elementSpan-sized elements.
IntegerLayout
Fixed-width integer layout, up to 7 bytes wide.
Layout<T>
Base contract every layout implements: byte span plus decode/encode.
LayoutByteReader
Read-only cursor over an immutable byte buffer used by layout decoders.
LayoutByteWriter
A utility class for writing layout bytes dynamically.
LayoutConst
Factory methods for every layout type: the primary entry point for building layouts without calling each type's constructor directly.
LayoutDecodeResult<T>
Result of a decode: the value plus how many bytes it consumed.
LayoutRepository
Marker base for the user-supplied context object threaded through lazy layout builders (see LazyStructLayoutBuilder, LazyMsgPackMapLayoutBuilder).
LayoutSerializable
Mixin for objects that can be serialized/deserialized via a Layout.
LayoutSerializationUtils
SCALE compact-integer and Bitcoin-style varint codecs used by the layout types.
LazyLayout<T>
Layout that resolves lazily, letting self-referential layouts be built.
LazyMsgPackMapLayoutBuilder<K, V, R extends LayoutRepository>
A map value field whose layout is resolved lazily, keyed by K.
LazyStructLayout<R extends LayoutRepository>
Like StructLayout, but each field's layout is resolved lazily via LazyStructLayoutBuilder, so later fields can depend on earlier results.
LazyStructLayoutBuilder<T, R extends LayoutRepository>
A field of a LazyStructLayout, with its layout resolved lazily and optional decode/encode finalization hooks.
LazyUnion
Like Union, but variant layouts are resolved lazily via LazyVariantModel.
LazyVariantLayout
A single variant within a containing LazyUnion.
LazyVariantModel<T>
Describes one variant of a LazyUnion: its lazily-resolved layout and how its discriminator index is determined.
LEB128U32OffsetLayout
Offset layout for an unsigned 32-bit LEB128-encoded length.
LEBBigIntegerLayout
LEB128-encoded BigInt, zig-zag encoded when validator is signed.
LEBIntegerLayout
LEB128-encoded integer, zig-zag encoded when validator is signed.
MapEntryLayout
Layout for a single key/value pair, used to build map layouts.
MsgPackAnyLayout
A MessagePack layout for schema-less / unknown dynamic type decoding and encoding.
MsgPackArrayLayout<T>
MessagePack array (fixarray/array16/array32) of elementLayout elements.
MsgPackBigIntLayout
MessagePack integer decoded/encoded as a BigInt (all forms, including magnitudes beyond a Dart int).
MsgPackBinaryLayout
MessagePack binary blob (bin8/bin16/bin32), optionally of a fixedLength.
MsgPackBoolLayout
MessagePack bool.
MsgPackConst
MessagePack format tag bytes and shared length-header helpers.
MsgPackEncodeOption<T>
Gate deciding whether a value should be emitted at all when encoding.
MsgPackEncodeOptionDefault<T>
Default encode gate: always emits the value.
MsgPackExtLayout
MessagePack extension type (fixext 1/2/4/8/16, ext8/16/32).
MsgPackExtValue
A MessagePack extension value: an application-defined type tag plus data.
MsgPackFixedKeyDynamicLazyValueMapLayout<K, V, R extends LayoutRepository>
MessagePack map with a fixed key layout, whose value layout is chosen per-decoded-key from valueLayouts.
MsgPackFixedKeyFixedLazyValueMapLayout<K, V, R extends LayoutRepository>
MessagePack map with a fixed key layout and a single shared value layout.
MsgPackFloatLayout
MessagePack 32- or 64-bit float.
MsgPackIntLayout
MessagePack integer, decoded/encoded across the fixint/uint8-64/int8-64 forms.
MsgPackMapLayout<K, V>
MessagePack map (fixmap/map16/map32) of keyLayout/valueLayout pairs.
MsgPackNilLayout
MessagePack nil.
MsgPackStringLayout
MessagePack UTF-8 string (fixstr/str8/str16/str32).
MsgPackTimestampLayout
MessagePack timestamp extension (ext type -1; 32/64/96-bit forms).
NatLayout
LEB128-style unsigned natural number (no upper bound).
NoneLayout<T>
A layout with no data: always decodes to null, writes nothing.
ObjSeqLayout<R>
Sequence of fields concatenated in order, mapped to/from a domain type R via build/unbuild instead of a Map — the natural shape for a generated encoding of an annotated class.
OffsetLayout
Delegates to layout at a fixed byte offset from wherever it's decoded.
OptionalLayout<T>
A discriminator-flagged value: noneFlag means absent, someFlag means layout follows.
PaddingLayout<T>
Transparent wrapper that reports layout's span as its own, used to mark a field whose absence is tolerated (e.g. trailing struct padding).
RawBytesLayout
Raw byte blob of a fixed size or a size resolved via an ExternalLayout.
RawTailLayout
Consumes/writes every remaining byte in the buffer.
RemainderListLayout<T>
Repeats element until the buffer is exhausted, with no count/length prefix — e.g. how a Tezos operation list fills the rest of a message.
RequestLayoutParams<T, SOURCE, R extends LayoutRepository>
Context passed to a lazy layout builder when it's asked to resolve its layout. encodeValue is only ever set (and required) when encoding.
SequenceLayout<T>
A contiguous sequence of elementLayout, either a fixed/derived count or, when count is null, decoded until the buffer is exhausted.
StructLayout
A contiguous sequence of named fields, decoded/encoded into a Map<String, dynamic> in declaration order.
TaggedUnionLayout<T>
A tagged union of cases, where tagLayout reads/writes the tag and tagFor picks the case to encode a given T value with.
TupleLayout
Fixed-order list of heterogeneous layouts, concatenated end to end.
Union
A tagged union: discriminator selects which registered VariantLayout decodes/encodes the rest of the data.
UnionCase<T>
One tag/layout pair in a TaggedUnionLayout.
VariantDeserializeResult
Represents the result of deserializing a variant type.
VariantLayout
A single variant within a containing union, tagged by variant.
VariantLayoutSerializable
Mixin for variant types that support layout-based serialization.
VarintIntLayout
Varint-encoded integer, validated against layout's width.
VarintOffsetLayout
Offset layout that delegates to a varint-encoded VarintIntLayout.
WrappedIntOffsetLayout<L extends Layout<int>>
Base for offset layouts that just delegate int decode/encode/span to a wrapped layout (see CompactOffsetLayout, VarintOffsetLayout).
XDRBytesLayout
XDR byte blob: layout payload padded to a 4-byte boundary.
ZarithIntLayout
Zarith signed integer ("Z"): first byte carries a sign bit (0x40) and 6 magnitude bits, subsequent bytes carry 7 magnitude bits each, all but the last byte have the continuation bit (0x80) set.

Enums

LayoutAction
Whether a lazy layout builder is being asked to decode or encode.

Typedefs

BaseIntiger<T> = BaseInteger<T>
Deprecated alias kept for compatibility; use BaseInteger instead.
CbGetEnumIndex = int Function(Map<String, dynamic> source)
CbGetLayoutSpan = List<int> Function(int)
CbLayoutFunc<T> = Layout<T> Function({String? property})
CbLazyStructLayoutFunc<T, R extends LayoutRepository> = Layout<T>? Function(String? property, RequestLayoutParams<T, Map<String, dynamic>, R> params)
CbMsgPackLayoutFunc<K, V, R extends LayoutRepository> = Layout<V>? Function(String? property, RequestLayoutParams<V, Map<K, V>, R> params)
CbNormalizeLayoutResult = Map<String, dynamic> Function(Map<String, dynamic> result, int variant)
CbOnFinalizeDecode<T, R extends LayoutRepository> = dynamic Function(T layoutResult, Map<String, dynamic> structResult, R? repository)
CbOnFinalizeEncode<T, R extends LayoutRepository> = void Function(T source, Map<String, dynamic> structSource, R? repository)
CbWrappedLayoutDecoder<T, D> = D Function(T value)
CbWrappedLayoutEncoder<T, D> = T Function(D source)