fromYaml static method

Resource fromYaml(
  1. dynamic yaml
)

Returns a Resource, accepts a String in YAML format as an argument

Implementation

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