fromBinary static method

BuBytes fromBinary(
  1. String data, {
  2. int zeroPadByteLen = 0,
})

Parses a binary string back into bytes, zero-padded to zeroPadByteLen bytes.

Implementation

static BuBytes fromBinary(String data, {int zeroPadByteLen = 0}) {
  final BigInt intValue = BigInt.parse(data, radix: 2);
  final String hexValue = intValue
      .toRadixString(16)
      .padLeft(zeroPadByteLen, '0');
  return fromHexString(hexValue);
}