DocView class final
A read-only, zero-copy view over one encoded VXS document.
Creating a view validates the header only: no field is decoded, nothing is allocated beyond the view itself. Values are read on demand.
final view = DocView.parse(bytes);
final text = view.getString(5); // only now is utf8 decoded
Properties
- bodyEnd → int
-
Offset one past the last field entry.
final
- bodyStart → int
-
Offset of the first field entry.
final
- buffer → Uint8List
-
Backing bytes; do not modify while views are alive.
final
- byteEnd → int
-
Offset one past this document inside buffer.
final
- byteLength → int
-
Total encoded size in bytes, including any checksum trailer.
no setter
- byteOffset → int
-
Offset of the magic byte inside buffer.
final
- checksum → int?
-
Stored CRC-32C of the body, or
nullwhen the document has none.final - fieldCount → int
-
Number of field entries, obtained by scanning.
no setter
- flags → int
-
Header flags byte.
final
- hasChecksum → bool
-
Whether the document carries a checksum trailer.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schemaId → int
-
Schema id recorded when the document was written.
final
- schemaVersion → int
-
Schema version recorded when the document was written.
final
Methods
-
cursor(
) → DocCursor - Creates a cursor positioned before the first field.
-
forEachField(
void visit(DocCursor cursor)) → void - Visits every field once, without allocating per field.
-
getBool(
int fieldId) → bool? -
Reads a boolean field, or
nullwhen absent. -
getBytes(
int fieldId) → Bytes? - Returns a zero-copy slice of a bytes/string field.
-
getFloat32(
int fieldId) → double? -
Reads a float32 field, or
nullwhen absent. -
getFloat64(
int fieldId) → double? -
Reads a float64 field, or
nullwhen absent. -
getInt(
int fieldId) → int? -
Reads a zigzag varint field, or
nullwhen absent. -
getString(
int fieldId) → String? -
Reads a string field, or
nullwhen absent. Decodes UTF-8 on every call. -
getStringView(
int fieldId) → StringView? - Returns a zero-copy UTF-8 view of a string field.
-
has(
int fieldId) → bool -
Whether
fieldIdis present in the encoded bytes. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
project(
VxsSchema schema, List< int> fieldIds) → List<Object?> -
Reads several fields in a single scan, in
fieldIdsorder. -
toBytes(
) → Bytes - Zero-copy view of the whole encoded document.
-
toString(
) → String -
A string representation of this object.
override
-
validate(
VxsSchema schema, {bool allowUnknown = true, int maxDepth = 8}) → List< VxsValidationIssue> -
Checks the document against
schema. -
validateOrThrow(
VxsSchema schema, {bool allowUnknown = true, int maxDepth = 8}) → void - Throws VxsFormatException on the first validation issue.
-
verifyChecksum(
) → void - Recomputes CRC-32C and throws when it does not match the stored value.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited