fromBase32 method

String fromBase32({
  1. String def = '',
})

Decodes the string from Base32 encoding and returns the resulting string.

If decoding fails, the method returns a default value.

def is the default value returned in case of a decoding error.

Returns the decoded string if successful; otherwise, returns def.

Implementation

String fromBase32({String def = ''}) {
  try {
    return base32.decodeAsString(this);
  } catch (e) {
    return def;
  }
}