fromJSON static method

StructureElement fromJSON(
  1. Map<String, dynamic> data
)

Implementation

static StructureElement fromJSON(Map<String, dynamic> data) {
	if (data["kotlinType"] == null) {
		throw ArgumentError('Missing discriminator: kotlinType');
	}
	String discriminator = data["kotlinType"];
	switch (discriminator) {
		case "dropdown":
			return DropdownField.fromJSON(data);
		case "radio-button":
			return RadioButton.fromJSON(data);
		case "date-picker":
			return DatePicker.fromJSON(data);
		case "time-picker":
			return TimePicker.fromJSON(data);
		case "date-time-picker":
			return DateTimePicker.fromJSON(data);
		case "number-field":
			return NumberField.fromJSON(data);
		case "textfield":
			return TextField.fromJSON(data);
		case "checkbox":
			return CheckBox.fromJSON(data);
		case "multiple-choice":
			return MultipleChoice.fromJSON(data);
		case "measure-field":
			return MeasureField.fromJSON(data);
		case "com.icure.cardinal.sdk.model.embed.form.template.FieldsGroup":
			return FieldsGroup.fromJSON(data);
		default:
			throw ArgumentError('Invalid subclass $discriminator');
	}
}