takeBigInt method

BigInt takeBigInt({
  1. int? length,
  2. Endian byteOrder = Endian.big,
  3. bool sign = false,
})

Extracts the plaintext as a BigInt and destroys this secret in the same step. Same "read once, then gone" contract as takeBytes.

Caveat worth knowing: the returned BigInt is not itself zeroable — Dart's BigInt is immutable with internal digits outside your control, so the value can persist in memory for as long as the BigInt object is reachable. This only guarantees the SecretBytes's own storage is wiped, not every representation you derive from it afterward.

Implementation

BigInt takeBigInt({
  int? length,
  Endian byteOrder = Endian.big,
  bool sign = false,
}) {
  final value = toBigInt(length: length, byteOrder: byteOrder, sign: sign);
  zero();
  return value;
}