loadConfigFile function
Implementation
Map<String, dynamic> loadConfigFile(String path, String? fileOptionResult) {
final File file = File(path);
final String yamlString = file.readAsStringSync();
final Map yamlMap = loadYaml(yamlString);
if (!(yamlMap['flutter_icons'] is Map)) {
stderr.writeln(NoConfigFoundException('Check that your config file '
'`${fileOptionResult ?? defaultConfigFile}`'
' has a `flutter_icons` section'));
exit(1);
}
// yamlMap has the type YamlMap, which has several unwanted side effects
final Map<String, dynamic> config = <String, dynamic>{};
for (MapEntry<dynamic, dynamic> entry in yamlMap['flutter_icons'].entries) {
config[entry.key] = entry.value;
}
return config;
}