convert method Null safety

Uint8List convert(
  1. String input,
  2. [int start = 0,
  3. int? end]
)
override

Decodes the characters of input from start to end as base64.

If start is omitted, it defaults to the start of input. If end is omitted, it defaults to the end of input.

The returned Uint8List contains exactly the decoded bytes, so the Uint8List.length is precisely the number of decoded bytes. The Uint8List.buffer may be larger than the decoded bytes.

Implementation

Uint8List convert(String input, [int start = 0, int? end]) {
  end = RangeError.checkValidRange(start, end, input.length);
  if (start == end) return Uint8List(0);
  var decoder = _Base64Decoder();
  var buffer = decoder.decode(input, start, end)!;
  decoder.close(input, end);
  return buffer;
}