tryFromBase64 function

Uint8List? tryFromBase64(
  1. String input, {
  2. Base64Codec? codec,
  3. bool padding = true,
})

Converts a Base-64 string to an 8-bit integer sequence, returning null instead of throwing when the input is not valid.

This is the non-throwing counterpart of fromBase64. See fromBase64 for the meaning of codec and padding.

Implementation

Uint8List? tryFromBase64(
  String input, {
  Base64Codec? codec,
  bool padding = true,
}) {
  try {
    return fromBase64(input, codec: codec, padding: padding);
  } on FormatException {
    return null;
  }
}