dvReadTargetManifest function
The manifest of the package name at root, or null when it has none or
it is not one Dartvel can read.
Implementation
DVTargetPackage? dvReadTargetManifest(String name, String root) {
final File manifest = File(p.join(root, dvTargetManifestFile));
if (!manifest.existsSync()) return null;
final Object? yaml;
try {
yaml = loadYaml(manifest.readAsStringSync());
} on Object {
return null;
}
if (yaml is! Map) return null;
final Object? executable = yaml['executable'];
final Object? targets = yaml['targets'];
if (executable is! String || targets is! List) return null;
return DVTargetPackage(
name: name,
root: root,
executable: executable,
targets: <String>[for (final Object? target in targets) '$target'],
);
}