W3cubDocs

/Dart 2

convert method

Uint8List convert (String input, [ int start = 0, int end ])

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 new Uint8List(0);
  var decoder = new _Base64Decoder();
  Uint8List 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.dartlang.org/stable/2.0.0/dart-convert/Base64Decoder/convert.html