vectorToBytes static method

Uint8List vectorToBytes(
  1. List<double> v
)

Implementation

static Uint8List vectorToBytes(List<double> v) {
  final b = BytesBuilder();
  final buf = ByteData(4 * v.length);
  for (int i = 0; i < v.length; i++) {
    buf.setFloat32(i * 4, v[i], Endian.little);
  }
  b.add(buf.buffer.asUint8List());
  return b.toBytes();
}