getView method

VectorList<Vector> getView(
  1. Float32List buffer
)

Implementation

VectorList<Vector> getView(Float32List buffer) {
  final viewOffset = offset ~/ buffer.elementSizeInBytes;
  final viewStride = stride ~/ buffer.elementSizeInBytes;
  switch (size) {
    case 2:
      return Vector2List.view(buffer, viewOffset, viewStride);
    case 3:
      return Vector3List.view(buffer, viewOffset, viewStride);
    case 4:
      return Vector4List.view(buffer, viewOffset, viewStride);
    default:
      throw StateError('size of $size is not supported');
  }
}