tryDecode static method

String? tryDecode(
  1. List<int>? value, {
  2. StringEncoding type = StringEncoding.utf8,
  3. bool allowInvalidOrMalformed = false,
  4. bool b64NoPadding = false,
  5. Base58Alphabets base58alphabets = Base58Alphabets.bitcoin,
})

Decodes a list of bytes value into a string using the specified type if possible.

The type parameter determines the decoding type to use, with UTF-8 being the default. Returns the decoded string.

Implementation

static String? tryDecode(List<int>? value,
    {StringEncoding type = StringEncoding.utf8,
    bool allowInvalidOrMalformed = false,
    bool b64NoPadding = false,
    Base58Alphabets base58alphabets = Base58Alphabets.bitcoin}) {
  if (value == null) return null;
  try {
    return decode(value,
        type: type,
        allowInvalidOrMalformed: allowInvalidOrMalformed,
        b64NoPadding: b64NoPadding,
        base58alphabets: base58alphabets);
  } catch (e) {
    return null;
  }
}