decodeRest method

List<int> decodeRest()

Provides a fast way to decode the rest of the source bytes in a single call. This method trades memory for improved speed in that it potentially over-allocates the List containing results.

Implementation

List<int> decodeRest() {
  final codeunits = List<int>.filled(remaining, 0);
  var i = 0;
  while (moveNext()) {
    codeunits[i++] = current;
  }
  if (i == codeunits.length) {
    return codeunits;
  } else {
    return codeunits.sublist(0, i);
  }
}