vectorToJson function

Map<String, dynamic>? vectorToJson(
  1. Vector? vector
)

Returns a json-serializable map for the vector

Implementation

Map<String, dynamic>? vectorToJson(Vector? vector) {
  if (vector == null) {
    return null;
  }

  final encodedDType = dTypeToJson(vector.dtype);
  final encodedData = vector.toList(growable: false);

  return <String, dynamic>{
    vectorDTypeJsonKey: encodedDType,
    vectorDataJsonKey: encodedData,
  };
}