loadConfigFile function

Map<String, dynamic> loadConfigFile(
  1. String path,
  2. String? fileOptionResult
)

Implementation

Map<String, dynamic> loadConfigFile(String path, String? fileOptionResult) {
  final File file = File(path);
  final String yamlString = file.readAsStringSync();
  // ignore: always_specify_types
  final Map yamlMap = loadYaml(yamlString);

  if (!(yamlMap['flutter_init'] is Map)) {
    stderr.writeln("");
    exit(1);
  }
  print(yamlMap['flutter_init'].toString());

  final Map<String, dynamic> config = <String, dynamic>{};

  for (MapEntry<dynamic, dynamic> entry in yamlMap['flutter_init'].entries) {
    config[entry.key] = entry.value;
  }

  return config;
}