W3cubDocs

/Dart 2

asUint8List method

Uint8List asUint8List ([int offsetInBytes = 0, int length ])

Creates a Uint8List view of a region of this byte buffer.

The view is backed by the bytes of this byte buffer. Any changes made to the Uint8List will also change the buffer, and vice versa.

The viewed region start at offsetInBytes and contains length bytes. If length is omitted, the range extends to the end of the buffer.

The start index and length must describe a valid range of the buffer:

  • offsetInBytes must not be negative,
  • length must not be negative, and
  • offsetInBytes + length must not be greater than lengthInBytes.

Implementation

Uint8List asUint8List([int offsetInBytes = 0, int length]) =>
    new UnmodifiableUint8ListView(_data.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/UnmodifiableByteBufferView/asUint8List.html