BenchmarkResults.parse constructor

BenchmarkResults.parse(
  1. Map<String, Object?> json
)

Deserializes a JSON object to create a BenchmarkResults object.

Implementation

factory BenchmarkResults.parse(Map<String, Object?> json) {
  final Map<String, List<BenchmarkScore>> results =
      <String, List<BenchmarkScore>>{};
  for (final String key in json.keys) {
    final List<BenchmarkScore> scores = (json[key]! as List<Object?>)
        .cast<Map<String, Object?>>()
        .map(BenchmarkScore.parse)
        .toList(growable: false);
    results[key] = scores;
  }
  return BenchmarkResults(results);
}