EnumBinaryCodec class

Binary codec for Enum type (1-byte discriminant + optional fields).

Encodes enums as discriminant byte followed by variant fields. Special case: unit variant with discriminant=0 encodes as empty for top-level.

Mixed-in types

Constructors

EnumBinaryCodec(IBinaryCodec binaryCodec)
Creates an Enum codec.
const

Properties

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

Methods

decodeNested(Uint8List buffer, EnumType type, int offset) → (EnumValue, int)
Decodes Enum from nested position, returns (value, bytesConsumed).
decodeTopLevel(Uint8List buffer, EnumType type) EnumValue
Decodes Enum from top-level buffer.
encodeNested(EnumValue value) Uint8List
Encodes Enum for nested (1-byte discriminant + fields).
encodeTopLevel(EnumValue value) Uint8List
Encodes Enum for top-level.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requireBufferLength(Uint8List buffer, int offset, int requiredBytes, [String? typeName]) → void
Validates buffer has at least requiredBytes starting from offset.
inherited
requireBytesRead(Uint8List buffer, int offset, int bytesRead) → void
Validates bytes read don't exceed buffer bounds.
inherited
requireEndOffset(Uint8List buffer, int offset, int length, [String? typeName]) → void
Validates calculated end offset doesn't exceed buffer length.
inherited
requireExactLength(Uint8List buffer, int requiredBytes, [String? typeName]) → void
Validates buffer has exactly requiredBytes length.
inherited
requireMaxLength(Uint8List buffer, int maxLength) → void
Validates buffer doesn't exceed maximum allowed length.
inherited
requireMinimumLength(Uint8List buffer, int minLength, [String? typeName]) → void
Validates buffer meets minimum length requirement.
inherited
requireOffsetInBounds(Uint8List buffer, int offset, [String? context]) → void
Validates offset is not at or beyond buffer end.
inherited
requireOffsetWithBytes(Uint8List buffer, int offset, int requiredBytes) → void
Validates offset with specific minimum required bytes.
inherited
requireValidOffset(Uint8List buffer, int offset) → void
Validates offset is within valid range for buffer.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited