writeMutationCampaignReport function
Writes a mutation campaign report as VM-only JSON to absolute path.
Creates parent directories as needed and throws ArgumentError for
relative paths; this uses dart:io and is not web-safe.
Implementation
Future<void> writeMutationCampaignReport(
String path,
MutationCampaignReport report,
) async {
final uri = Uri.file(path);
if (!uri.isAbsolute) {
throw ArgumentError.value(path, 'path', 'must be absolute');
}
final file = File.fromUri(uri);
await file.parent.create(recursive: true);
await file.writeAsString(
const JsonEncoder.withIndent(' ').convert(report.toJson()),
flush: true,
);
}