Vector<T>.constant constructor

Vector<T>.constant(
  1. DataType<T> dataType,
  2. int count, {
  3. T? value,
  4. VectorFormat? format,
})

Constructs a vector with a constant value.

If format is specified the resulting vector is mutable, otherwise this is a read-only view.

Implementation

factory Vector.constant(DataType<T> dataType, int count,
    {T? value, VectorFormat? format}) {
  final result =
      ConstantVector<T>(dataType, count, value ?? dataType.defaultValue);
  return format == null ? result : result.toVector(format: format);
}