Converts the bytes (a list of unsigned 7- or 8-bit integers) to the corresponding string.
If start and end are provided, only the sub-list of bytes from start to end (end not inclusive) is used as input to the conversion.
String convert(List<int> bytes, [int start = 0, int end]) {
var byteCount = bytes.length;
RangeError.checkValidRange(start, end, byteCount);
end ??= byteCount;
for (var i = start; i < end; i++) {
var byte = bytes[i];
if ((byte & ~_subsetMask) != 0) {
if (!_allowInvalid) {
throw FormatException("Invalid value in input: $byte");
}
return _convertInvalid(bytes, start, end);
}
}
return String.fromCharCodes(bytes, start, end);
}
© 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/AsciiDecoder/convert.html