fromYamlString static method
Load from yaml string
Implementation
static QuickActionItem fromYamlString(String yamlString,
{String content = ""}) {
var yaml = loadYaml(yamlString);
if (yaml is! Map) {
throw Exception('Invalid yaml file');
}
if (yaml['name'] is! String) {
throw Exception('Invalid yaml file');
}
if (yaml['description'] is! String) {
throw Exception('Invalid yaml file');
}
if (yaml['version'] is! String) {
throw Exception('Invalid yaml file');
}
if (yaml['author'] is! String) {
throw Exception('Invalid yaml file');
}
if (yaml['license'] is! String) {
throw Exception('Invalid yaml file');
}
if (yaml['git'] is! String) {
throw Exception('Invalid yaml file');
}
if (yaml['distro'] is! String && yaml['distro'] is! List) {
throw Exception('Invalid yaml file');
}
return QuickActionItem(
name: yaml['name'],
description: yaml['description'],
version: yaml['version'],
author: yaml['author'],
license: yaml['license'],
git: yaml['git'],
distro: yaml['distro'],
content: content);
}