IntUtils class

Utility class for integer-related operations and conversions.

Constructors

IntUtils()

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

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

bitlengthInBytes(int val) int
Calculates the number of bytes required to represent the bit length of an integer value.
decodeVarint(List<int> byteint) Tuple<int, int>
Decodes a variable-length byte array into an integer value according to Bitcoin's variable-length integer encoding scheme.
encodeVarint(int i) List<int>
Encodes an integer into a variable-length byte array according to Bitcoin's variable-length integer encoding scheme.
fromBytes(List<int> bytes, {Endian byteOrder = Endian.big, bool sign = false, int maxBytes = 6}) int
Converts a list of bytes to an integer, following the specified byte order.
parse(dynamic v) int
Parses a dynamic value v into an integer.
prependVarint(List<int> data) List<int>
Prepends a variable-length integer encoding of the given data length to the provided data.
toBytes(int val, {required int length, Endian byteOrder = Endian.big, int maxBytesLength = 6}) List<int>
Converts an integer to a byte list with the specified length and endianness.
tryParse(dynamic v) int?
Tries to parse a dynamic value v into an integer, returning null if parsing fails.