SpecimenProcessing.fromYaml constructor

SpecimenProcessing.fromYaml(
  1. dynamic yaml
)

Factory constructor that accepts a String in YAML format as an argument

Implementation

factory SpecimenProcessing.fromYaml(dynamic yaml) => yaml is String
    ? SpecimenProcessing.fromJson(
        jsonDecode(jsonEncode(loadYaml(yaml))) as Map<String, dynamic>)
    : yaml is YamlMap
        ? SpecimenProcessing.fromJson(
            jsonDecode(jsonEncode(yaml)) as Map<String, dynamic>)
        : throw ArgumentError(
            'SpecimenProcessing cannot be constructed from input provided,'
            ' it is neither a yaml string nor a yaml map.');