W3cubDocs

/Dart 2

Uint8List.view constructor

Uint8List.view(ByteBuffer buffer, [ int offsetInBytes = 0, int length ])

Creates a Uint8List view of the specified region in buffer.

Changes in the Uint8List will be visible in the byte buffer and vice versa. If the offsetInBytes index of the region is not specified, it defaults to zero (the first byte in the byte buffer). If the length is not specified, it defaults to null, which indicates that the view extends to the end of the byte buffer.

Throws RangeError if offsetInBytes or length are negative, or if offsetInBytes + (length * elementSizeInBytes) is greater than the length of buffer.

Implementation

factory Uint8List.view(ByteBuffer buffer,
    [int offsetInBytes = 0, int length]) {
  return buffer.asUint8List(offsetInBytes, length);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-typed_data/Uint8List/Uint8List.view.html