toBytes method

Uint8List toBytes()

Copies the frame into a fresh contiguous Uint8List.

Implementation

Uint8List toBytes() {
  _ensureValid();
  final n = length;
  if (n == 0) return _empty;
  final out = Uint8List(n);
  if (_len1 != 0) {
    out.setRange(0, _len1, _buf1, _off1);
  }
  if (_len2 != 0) {
    out.setRange(_len1, n, _buf2, _off2);
  }
  return out;
}