matrixToJson function

Map<String, dynamic>? matrixToJson(
  1. Matrix? matrix
)

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(),
  };
}