toJson method

Map<String, List<Map<String, dynamic>>> toJson()

Serializes benchmark metrics to JSON.

Implementation

Map<String, List<Map<String, dynamic>>> toJson() {
  return scores.map<String, List<Map<String, dynamic>>>(
      (String benchmarkName, List<BenchmarkScore> scores) {
    return MapEntry<String, List<Map<String, dynamic>>>(
      benchmarkName,
      scores
          .map<Map<String, dynamic>>(
              (BenchmarkScore score) => <String, dynamic>{
                    'metric': score.metric,
                    'value': score.value,
                  })
          .toList(),
    );
  });
}