SubstanceDefinitionSourceMaterial.fromYaml constructor

SubstanceDefinitionSourceMaterial.fromYaml(
  1. dynamic yaml
)

Deserialize SubstanceDefinitionSourceMaterial from a String or YamlMap object

Implementation

factory SubstanceDefinitionSourceMaterial.fromYaml(
  dynamic yaml,
) {
  if (yaml is String) {
    return SubstanceDefinitionSourceMaterial.fromJson(
      yamlToJson(yaml),
    );
  } else if (yaml is YamlMap) {
    return SubstanceDefinitionSourceMaterial.fromJson(
      yamlMapToJson(yaml),
    );
  } else {
    throw ArgumentError(
      'SubstanceDefinitionSourceMaterial '
      'cannot be constructed from the provided input. '
      'It must be a YAML string or YAML map.',
    );
  }
}