MedicationKnowledge.fromYaml constructor
MedicationKnowledge.fromYaml(
- dynamic yaml
Factory constructor that accepts a String in YAML format as an argument
Implementation
factory MedicationKnowledge.fromYaml(dynamic yaml) => yaml is String
? MedicationKnowledge.fromJson(
jsonDecode(jsonEncode(loadYaml(yaml))) as Map<String, dynamic>)
: yaml is YamlMap
? MedicationKnowledge.fromJson(
jsonDecode(jsonEncode(yaml)) as Map<String, dynamic>)
: throw ArgumentError(
'MedicationKnowledge cannot be constructed from input provided,'
' it is neither a yaml string nor a yaml map.');