readBenchmarkResultJson function
Reads a VM benchmark JSON report from an absolute file path.
Throws ArgumentError for relative paths and FormatException if the decoded root is not a JSON object.
Implementation
Future<BenchmarkResult> readBenchmarkResultJson(String path) async {
final decoded = jsonDecode(await _absoluteFile(path).readAsString());
if (decoded is! Map<String, Object?>) {
throw const FormatException('Benchmark report must be a JSON object.');
}
return BenchmarkResult.fromJson(decoded);
}