VectorList<T extends Vector>.view constructor
Null safety
- Float32List buffer,
- int vectorLength,
- [int offset = 0,
- int stride = 0]
Create a new vector list as a view of buffer
for vectors that have a
size of vectorLength
. Optionally it is possible to specify an offset
in the buffer
and a stride
between each vector.
Implementation
VectorList.view(Float32List buffer, int vectorLength,
[int offset = 0, int stride = 0])
: _vectorLength = vectorLength,
_offset = offset,
_stride = stride == 0 ? vectorLength : stride,
_length = (buffer.length - math.max(0, offset - stride)) ~/
(stride == 0 ? vectorLength : stride),
_buffer = buffer {
if (_stride < _vectorLength) {
throw ArgumentError('Stride cannot be smaller than the vector size.');
}
}