TemplateConfig.fromYamlString constructor

TemplateConfig.fromYamlString(
  1. String yamlString
)

Parses YAML string content.

Implementation

factory TemplateConfig.fromYamlString(String yamlString) {
  try {
    final doc = loadYaml(yamlString);
    if (doc is! Map) {
      throw const ConfigurationException(
          'Template YAML must evaluate to a Map.');
    }
    return TemplateConfig.fromYamlMap(doc);
  } catch (e) {
    if (e is CliException) rethrow;
    throw ConfigurationException('Failed to parse template YAML: $e');
  }
}