getIaCValue static method

String? getIaCValue(
  1. String targetDir,
  2. String key
)

Gets the value of key from the iac.json file in the targetDir.

Implementation

static String? getIaCValue(String targetDir, String key) {
  final targetFile = File(path.join(targetDir, 'iac.json'));
  if (!targetFile.existsSync()) {
    throw FileSystemException('File not found', targetFile.path);
  }

  final jsonData = targetFile.readAsStringSync();
  final Map<String, dynamic> iacMap = jsonDecode(jsonData);
  return iacMap.containsKey(key) ? iacMap[key] : null;
}