getYamlKeyData function

Map getYamlKeyData(
  1. Context context
)

Implementation

Map getYamlKeyData(Context context) {
  final String yamlFilePath = context.pubspecPath;
  final String yamlKeyName = context.yamlKeyName;

  final Map yamlData = readYamlFile(yamlFilePath);
  final Map? yamlKeyData = yamlData[yamlKeyName];

  if (yamlKeyData == null) {
    throw Exception(
        "Your pubspec.yaml file must have a key ${yamlKeyName} in it.");
  }

  return yamlKeyData as Map;
}