readMutationCampaignReport function
Reads a VM-only mutation campaign report JSON file from absolute path.
Throws ArgumentError for relative paths and FormatException when the decoded root is not a JSON object.
Implementation
Future<MutationCampaignReport> readMutationCampaignReport(String path) async {
final uri = Uri.file(path);
if (!uri.isAbsolute) {
throw ArgumentError.value(path, 'path', 'must be absolute');
}
final decoded = jsonDecode(await File.fromUri(uri).readAsString());
if (decoded is! Map<String, Object?>) {
throw const FormatException('Campaign report must be a JSON object.');
}
return MutationCampaignReport.fromJson(decoded);
}