loadProfile method

Future<GenConfig> loadProfile(
  1. String name
)

Load a profile by name

Implementation

Future<GenConfig> loadProfile(String name) async {
  final file = File(_getProfilePath(name));

  if (!await file.exists()) {
    throw FileSystemException('Profile not found: $name', file.path);
  }

  final content = await file.readAsString();
  final yaml = loadYaml(content);

  if (yaml is! Map) {
    throw FormatException('Invalid profile format: $name');
  }

  return GenConfig.fromYaml(yaml);
}