load method
Loads the specified module definition from a template.
Resolves the FKIT package root and returns the corresponding ModuleDefinition.
Implementation
Future<ModuleDefinition> load({
required String template,
required String module,
}) async {
final root = const PackageLocator().packageRoot();
final file =
File('${root.path}/templates/$template/modules/$module/module.yaml');
if (!file.existsSync()) {
throw Exception('Module "$module" not found in template "$template".');
}
final yaml = loadYaml(await file.readAsString());
return ModuleDefinition.fromMap(Map<dynamic, dynamic>.from(yaml));
}