parseFile method

Future<MockConfig> parseFile(
  1. String configPath
)

Loads, parses, and validates a YAML file from disk.

Implementation

Future<MockConfig> parseFile(String configPath) async {
  final file = File(configPath);
  if (!await file.exists()) {
    throw MockConfigException(
        'Configuration file not found: ${path.normalize(configPath)}');
  }

  final content = await file.readAsString();
  return parseString(content, sourcePath: file.absolute.path);
}