matrixToJson function
Encodes a matrix
to a json-serializable map
Implementation
Map<String, dynamic>? matrixToJson(Matrix? matrix) {
if (matrix == null) {
return null;
}
return <String, dynamic>{
matrixDTypeJsonKey: dTypeToJson(matrix.dtype),
matrixDataJsonKey: matrix.toList(),
};
}