loadLatestMetadata method
Loads the most recent release manifest for projectPath.
Implementation
Future<ReleaseMetadata?> loadLatestMetadata(String projectPath) async {
final dirPath = getManifestDirectory(projectPath);
final latestFile = File('$dirPath/latest.json');
if (await latestFile.exists()) {
try {
final content = await latestFile.readAsString();
final json = jsonDecode(content) as Map<String, dynamic>;
return ReleaseMetadata.fromJson(json);
} catch (_) {}
}
final all = await loadAllMetadata(projectPath);
if (all.isNotEmpty) {
return all.first;
}
return null;
}