writeBenchmarkResultJson function
Writes result as pretty JSON to an absolute VM file path.
Creates parent directories as needed and throws ArgumentError for relative paths.
Implementation
Future<void> writeBenchmarkResultJson(
String path,
BenchmarkResult result,
) async {
final file = _absoluteFile(path);
await file.parent.create(recursive: true);
await file.writeAsString(
const JsonEncoder.withIndent(' ').convert(result.toJson()),
flush: true,
);
}