convert method Null safety
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);
// TODO(38725): Remove workaround when assignment promotion is implemented
if (end == null) {
throw RangeError("Invalid range");
}
if (start == end) return Uint8List(0);
var decoder = _Base64Decoder();
var buffer = decoder.decode(input, start, end)!;
decoder.close(input, end);
return buffer;
}