getConfig function

YamlMap? getConfig(
  1. String? yamlFile
)

Implementation

YamlMap? getConfig(String? yamlFile) {
  if (yamlFile == null) return null;

  final File file = File(yamlFile);

  if (!file.existsSync()) {
    throw Exception('The config file `$yamlFile` was not found.');
  }

  final yamlMap = loadYaml(file.readAsStringSync());
  if (yamlMap is! YamlMap) return null;

  return yamlMap;
}