tryFromBinary function

Uint8List? tryFromBinary(
  1. String input, {
  2. Base2Codec codec = Base2Codec.standard,
})

Converts a Base-2 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 fromBinary. See fromBinary for the meaning of codec.

Implementation

Uint8List? tryFromBinary(
  String input, {
  Base2Codec codec = Base2Codec.standard,
}) {
  try {
    return fromBinary(input, codec: codec);
  } on FormatException {
    return null;
  }
}