tryDecode static method

List<int>? tryDecode(
  1. String data, {
  2. bool validatePadding = true,
  3. bool urlSafe = true,
})

Tries to decode a Base64 string, returning null if decoding fails.

Same parameters as decode, but catches exceptions and returns null on error.

Implementation

static List<int>? tryDecode(String data,
    {bool validatePadding = true, bool urlSafe = true}) {
  try {
    return decode(data, urlSafe: urlSafe, validatePadding: validatePadding);
  } catch (_) {
    return null;
  }
}