setAmountBytes method

void setAmountBytes(
  1. ByteArray amountBytes
)

Sets the amount from a byte array. Reads an 8-byte little-endian unsigned integer from the provided array. @param amountBytes The byte array representing the amount.

Implementation

void setAmountBytes(ByteArray amountBytes) {
  // Ensure the amountBytes array is large enough to read a 64-bit integer
  if (amountBytes.length < TXAMOUNT) {
    throw ArgumentError(
        'Amount bytes array too short. Expected $TXAMOUNT bytes.');
  }
  final byteData =
      ByteData.view(amountBytes.buffer, amountBytes.offsetInBytes, TXAMOUNT);
  _amount = BigInt.from(byteData.getUint64(0, Endian.little));
}