calculateLineCoverage function

double calculateLineCoverage (File lcovReport)

Implementation

double calculateLineCoverage(File lcovReport) {
  final report = Report.fromCoverage(lcovReport.readAsStringSync());
  var totalLines = 0;
  var hitLines = 0;
  for (final rec in report.records) {
    for (final line in rec.lines.data) {
      totalLines++;
      hitLines += (line.executionCount > 0) ? 1 : 0;
    }
  }
  return hitLines / totalLines;
}