  var length = end - start;
  if (length == 0) return Uint8List(0);
  &#47;&#47; Create a new encoder with a length that is guaranteed to be big enough.
  &#47;&#47; A single code unit uses at most 3 bytes, a surrogate pair at most 4.
  var encoder = _Utf8Encoder.withBufferSize(length * 3);
  var endPosition = encoder._fillBuffer(string, start, end);
  assert(endPosition &gt;= end - 1);
  if (endPosition != end) {
    &#47;&#47; Encoding skipped the last code unit.
    &#47;&#47; That can only happen if the