sliceBlock function

List<int> sliceBlock(
  1. List<int> buffer,
  2. int pos
)

Implementation

List<int> sliceBlock(List<int> buffer, int pos) {
  var j = pos;

  // advance until a block boundary is found
  while (buffer[j] != 10 && (j - pos < 90) && j < buffer.length) {
    j++;
  }
  if (buffer[j] == 10) {
    j++;
  } // append the trailing linefeed to the block

  return buffer.sublist(pos, j);
}