BcsWriter class
Class used to write BCS data into a buffer. Initializer requires some size of a buffer to init; default value for this buffer is 1KB.
Most methods are chainable, so it is possible to write them in one go.
final serialized = BcsWriter()
.write8(10)
.write32(1000000)
.write64(BigInt.from(10000001000000))
.hex();
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) → dynamic -
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 - Get underlying buffer taking only value bytes (in case initial buffer size was bigger).
-
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.
-
writeFixedArray(
dynamic vector, int? size, dynamic cb(BcsWriter writer, dynamic el, int i, int len)) → BcsWriter -
writeULEB(
int value) → BcsWriter - Write a ULEB value into a buffer and shift cursor position by number of bytes written.
-
writeVec(
dynamic vector, dynamic cb(BcsWriter writer, dynamic el, int i, int len)) → BcsWriter - Write a vector into a buffer by first writing the vector length and then calling a callback on each passed value.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited