description

# Uint8ClampedList.view constructor Null safety

Uint8ClampedList.view(

1. ByteBuffer buffer,
2. [int offsetInBytes = 0,
3. int? length]

)

Creates a Uint8ClampedList view of the specified region in the specified byte `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`.

Note that when creating a view from a TypedData list or byte data, that list or byte data may itself be a view on a larger buffer with a TypedData.offsetInBytes greater than zero. Merely doing `Uint8ClampedList.view(other.buffer, 0, count)` may not point to the bytes you intended. Instead you may need to do:

    Uint8ClampedList.view(other.buffer, other.offsetInBytes, count)

Alternatively, use Uint8ClampedList.sublistView which includes this computation:

    Uint8ClampedList.sublistView(other, 0, count);

(The third argument is an end index rather than a length, so if you start from a position greater than zero, you need not reduce the count correspondingly).

## Implementation

    factory Uint8ClampedList.view(ByteBuffer buffer,
        [int offsetInBytes = 0, int? length]) {
      return buffer.asUint8ClampedList(offsetInBytes, length);
    }