toJson method

Map<String, Object> toJson()

A JSON-serializable representation of this vector, in the same shape as the JS SDK's VectorValue.toJSON(): its type (jsonType) and vectorValues. Read it back with VectorValue.fromJson.

Like in the JS SDK, a vector with a NaN or infinite component cannot be encoded as JSON.

Implementation

Map<String, Object> toJson() {
  return <String, Object>{
    'type': jsonType,
    'vectorValues': List<double>.of(_values),
  };
}