util/bytes library

Functions

addHexPrefix(String str) String
Adds "0x" to a given String if it does not already start with "0x".
baToJSON(dynamic ba) → dynamic
Converts a Uint8List or List<Uint8List> to JSON.
bufferToHex(Uint8List buf) String
Converts a Uint8List into a hex String.
bufferToInt(Uint8List buf) int
Converts a Uint8List to a int.
fromSigned(Uint8List signedInt) BigInt
Interprets a Uint8List as a signed integer and returns a BigInt. Assumes 256-bit numbers.
setLength(Uint8List msg, int length, {bool right = false}) Uint8List
setLengthLeft(Uint8List msg, int length, {bool right = false}) Uint8List
Left Pads an Uint8List with leading zeros till it has length bytes. Or it truncates the beginning if it exceeds.
setLengthRight(Uint8List msg, int length) Uint8List
Right Pads an Uint8List with leading zeros till it has length bytes. Or it truncates the beginning if it exceeds.
stripZeros(Uint8List a) Uint8List
toBuffer(dynamic v) Uint8List
Attempts to turn a value into a Uint8List. As input it supports Uint8List, String, int, null, BigInt method.
toUnsigned(BigInt unsignedInt) Uint8List
Converts a BigInt to an unsigned integer and returns it as a Uint8List. Assumes 256-bit numbers.
unpad(Uint8List a) Uint8List
Trims leading zeros from a Uint8List.
unpadString(String a) String
zeros(int bytes) Uint8List
Returns a buffer filled with 0s.