load static method
Loads the definition for the specified template.
Returns the parsed TemplateDefinition for the template.
Implementation
static Future<TemplateDefinition> load(String template) async {
final root = const PackageLocator().packageRoot();
final templateRoot = '${root.path}/templates/$template';
final manifest = File('$templateRoot/template.yaml');
if (!manifest.existsSync()) {
throw Exception('Template "$template" not found.');
}
final map = await _readYaml(manifest);
final files = Map<dynamic, dynamic>.from(map['files'] ?? const {});
for (final section in _sections) {
map[section] = await _loadSection(templateRoot: templateRoot, files: files, section: section);
}
return TemplateDefinition.fromMap(map);
}