fromJson static method

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

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

Implementation

static DataType fromJson(Map<String, dynamic> data) {
  final type = data['type'];
  final constructor = _dataTypes[type];
  if (constructor == null) {
    throw Exception("Unknown data type: $type");
  }
  return constructor(data);
}