Search packages, repositories and app categories

Package detailsv0.1.3

lcov_parser

A Dart package that parses LCOV coverage files into structured records, providing easy access to line, branch, and function coverage data.

AndroidiOSmacOSWindowsLinux
30-day downloads
387K
Likes
4
Pub points
140

Install package

flutter pub add lcov_parser

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The lcov_parser package is a Dart tool designed to parse LCOV (Linux Coverage) format files, converting them into structured data for line, branch, and function coverage. It enables developers to analyze test coverage results programmatically, making it easier to integrate with CI/CD pipelines or generate reports. The package supports multiple platforms and is ideal for teams aiming to maintain high code quality through detailed coverage metrics.

Use cases

  • Parsing LCOV files from test runs
  • Integrating coverage analysis into CI/CD workflows
  • Generating coverage reports in applications
  • Analyzing code coverage trends over time
  • Validating coverage thresholds in pull requests

Key features

  • Supports line, branch, and function coverage
  • Provides structured data models
  • Easy integration with Dart projects
  • Cross-platform compatibility
  • Lightweight and focused on parsing

Suitable for

  • Test automation engineers
  • CI/CD pipeline developers
  • Code quality teams
  • Dart project maintainers
  • Coverage report generators

Considerations

  • Requires valid LCOV input files
  • Does not generate coverage data—only parses it
  • Limited to LCOV format
  • No built-in reporting UI
  • Depends on external coverage tools to produce LCOV

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Lcov parser

Dart

A simple lcov file parser implementation in Dart.

The lcov is used to get test coverage. It works as a front-end for gcov collecting the data and generating the coverage info.

This implementation translates the lcov format to Dart classes we can understand and use the coverage info for a lot of proposals.

How to use

To use it is very simple, this package exports the model of the record and the parser class, and you will receive from the return of the parser is a list of record. As you can see in the code below

import 'package:lcov_parser/lcov_parser.dart';

void main() async {
    final file = 'absolute path from lcov.info file';
    final records = await Parser.parse(file);
}

Another option is to parse records from a list of strings:

void main() {
  final lines = [
    'SF:lib/src/interceptors/app_version_interceptor.dart',
    'DA:6,1',
    'DA:11,1',
    // ...more lines here
    'end_of_record',
  ];
  final records = Parser.parseLines(lines);
}

You also will find a script example in the example/main.dart file.

How to contribute with the project.

Feel free to open issues in this repository or open your pull request.

Running the tests

In the root path

dart test

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package