VectorList<T extends Vector> constructor Null safety

VectorList<T extends Vector>(
  1. int length,
  2. int vectorLength,
  3. [int offset = 0,
  4. int stride = 0]
)

Create a new vector list with length elements 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(int length, int vectorLength, [int offset = 0, int stride = 0])
    : _vectorLength = vectorLength,
      _offset = offset,
      _stride = stride == 0 ? vectorLength : stride,
      _length = length,
      _buffer = Float32List(
          VectorList._listLength(offset, stride, vectorLength, length)) {
  if (_stride < _vectorLength) {
    throw ArgumentError('Stride cannot be smaller than the vector size.');
  }
}