BcsWriter class

Writes BCS data into a buffer (default 1KB). Most methods are chainable.

final serialized = BcsWriter()
  .write8(10)
  .write32(1000000)
  .write64(BigInt.from(10000001000000))
  .hex();

Constructors

BcsWriter({int size = 1024, int? maxSize, int allocateSize = 1024})

Properties

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

Methods

base58() String
base64() String
encode(Encoding encoding) String
ensureSizeOrGrow(int bytes) → void
hex() String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shift(int bytes) BcsWriter
Shift current cursor position by bytes.
toBytes() Uint8List
Underlying buffer trimmed to the bytes actually written.
toString() String
A string representation of this object.
inherited
write128(BigInt value) BcsWriter
Write a U128 value into a buffer and shift cursor position by 16.
write16(int value) BcsWriter
Write a U16 value into a buffer and shift cursor position by 2.
write256(BigInt value) BcsWriter
Write a U256 value into a buffer and shift cursor position by 32.
write32(int value) BcsWriter
Write a U32 value into a buffer and shift cursor position by 4.
write64(BigInt value) BcsWriter
Write a U64 value into a buffer and shift cursor position by 8.
write8(int value) BcsWriter
Write a U8 value into a buffer and shift cursor position by 1.
writeBytes(Uint8List bytes) BcsWriter
Write a raw byte array into the buffer and shift the cursor by its length.
writeFixedArray(dynamic vector, int? size, dynamic cb(BcsWriter writer, dynamic el, int i, int len)) BcsWriter
writeULEB(int value) BcsWriter
Write a ULEB value and shift cursor by the number of bytes written.
writeVec(dynamic vector, dynamic cb(BcsWriter writer, dynamic el, int i, int len)) BcsWriter
Write a vector: ULEB length, then the callback on each element.

Operators

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