fromBigInt function
Converts a BigInt to 8-bit integer sequence.
Parameters:
inputis a non-negative BigInt.- If
msbFirstis true,inputbytes are read in big-endian order giving the first byte the most significant value, otherwise the bytes are read as little-endian order, giving the first byte the least significant value. codecis the BigIntCodec to use. It is derived from the other parameters if not provided.
Raises:
- FormatException when the
inputis negative.
Implementation
Uint8List fromBigInt(
BigInt input, {
BigIntCodec? codec,
bool msbFirst = false,
}) {
codec ??= _codecFromParameters(msbFirst: msbFirst);
var out = codec.decoder.convert(input);
return Uint8List.fromList(out as List<int>);
}