VarInt class

A VarInt or "Variable Integer" is an integer format used widely in Bitcoin to indicate the lengths of fields within transaction, block and peer-to-peer network data.

A VarInt is a variable length field 1, 3, 5 or 9 bytes in length dependent on the size of the object being defined. The VarInt format is used as it is space efficient over simply using an 8-byte field where variable length objects are used.

Constructors

VarInt.fromValue(int value)
Given an integer value this will be converted into a VarInt.
factory
VarInt.parse(Uint8List data, {int start = 0})
Given an Array of Bytes, parse it and create a VarInt instance from the specified starting index.
factory

Properties

flag int
final
hashCode int
The hash code for this object.
no setterinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
toUint8List Uint8List
Converts the VarInt into a Uint8List with the flag prefixing the field value.
no setter
value int
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

isValid(int flag, Uint8List value) bool
varIntSize(int flag) int
The first Byte of a Uint8List of type VarInt, defines the size of the Segment associated.