fromJson static method

VectorDataType fromJson(
  1. Map<String, dynamic> data
)
override

Factory method: parse a JSON representation into a concrete DataType. Looks up the correct subclass in _dataTypes.

Implementation

static VectorDataType fromJson(Map<String, dynamic> data) {
  if (data['type'] != 'vector') {
    throw Exception("Expected type 'vector', got '${data['type']}'");
  }
  return VectorDataType(size: data['size'] as int, elementType: DataType.fromJson(data['element_type'] as Map<String, dynamic>));
}