decodeBech32 static method

List<String> decodeBech32(
  1. String bech32String
)

Decode a bech32 string into a hex string + human readable part

Implementation

static List<String> decodeBech32(String bech32String) {
  try {
    const Bech32Codec codec = Bech32Codec();
    final Bech32 bech32 = codec.decode(bech32String, bech32String.length);
    final eightBitWords = _convertBits(bech32.data, 5, 8, false);
    return [HEX.encode(eightBitWords), bech32.hrp];
  } catch (e) {
    developer.log(
        'decodeBech32 error: $e, \n \n String is: $bech32String \n \n',
        error: e);
  }
  return ["", ""];
}