toUint8List method

Uint8List toUint8List([
  1. int offset = 0,
  2. int? length
])

Implementation

Uint8List toUint8List([int offset = 0, int? length]) {
  final len = length ?? this.length - offset;
  if (buffer is Uint8List) {
    final b = buffer as Uint8List;
    return Uint8List.view(
        b.buffer, b.offsetInBytes + this.offset + offset, len);
  }
  return (buffer is Uint8List)
      ? (buffer as Uint8List)
          .sublist(this.offset + offset, this.offset + offset + len)
      : Uint8List.fromList(
          buffer.sublist(this.offset + offset, this.offset + offset + len));
}