tryEncode method

String? tryEncode(
  1. List<int> data, {
  2. bool lowerCase = true,
})

Like encode, but returns null instead of throwing on invalid input.

Implementation

String? tryEncode(List<int> data, {bool lowerCase = true}) {
  try {
    return encode(data, lowerCase: lowerCase);
  } catch (_) {
    return null;
  }
}