W3cubDocs

/Dart 2

convert method

Uint8List convert (String input, [ int start = 0, 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;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-convert/Base64Decoder/convert.html