toJsonString method

String toJsonString()

Public method or function.

Implementation

String toJsonString() {
  final map = <String, dynamic>{
    'generatedAt': generatedAt.toUtc().toIso8601String(),
    'overallAccuracy': overallAccuracy,
    'overallPrecision': overallPrecision,
    'overallRecall': overallRecall,
    'totalTruePositives': totalTruePositives,
    'totalFalsePositives': totalFalsePositives,
    'totalFalseNegatives': totalFalseNegatives,
    'analyzerPrecision': analyzerPrecision.map(
      (k, v) => MapEntry(k, v.toStringAsFixed(4)),
    ),
    'analyzerRecall': analyzerRecall.map(
      (k, v) => MapEntry(k, v.toStringAsFixed(4)),
    ),
    'entries': entries.map((e) => e.toJson()).toList(),
  };
  return const JsonEncoder.withIndent('  ').convert(map);
}