ScalarListView.view constructor Null safety

ScalarListView.view(
  1. Float32List buffer,
  2. [int offset = 0,
  3. int stride = 0]
)

Create a new stride list as a view of buffer. Optionally it is possible to specify a offset in the buffer and a stride between each vector.

Implementation

ScalarListView.view(Float32List buffer, [int offset = 0, int stride = 0])
    : _offset = offset,
      _stride = stride == 0 ? 1 : stride,
      _length = (buffer.length - math.max(0, offset - stride)) ~/
          (stride == 0 ? 1 : stride),
      _buffer = buffer;