dart-collect-coverage

Collect Dart and Flutter test coverage and generate LCOV reports.

1|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-collect-coverage-sohampawar1866
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dart-collect-coverage
Source: https://github.com/sohampawar1866/zeromile-go/tree/main/.agents/skills/dart-collect-coverage
Command: npx skills add https://github.com/sohampawar1866/zeromile-go --skill dart-collect-coverage-sohampawar1866

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires coverage.

What problem does it solve? Measuring test coverage in Dart and Flutter projects requires coordinating the coverage package, the Dart VM service, and LCOV formatting, which is error-prone when done manually. This Skill provides a structured workflow to add the coverage dependency, run tests, and produce a standard LCOV report. ## Core Features & Use Cases - Automated Coverage Collection: Run the bundled test_with_coverage script to execute tests and generate coverage.json and lcov.info in one step. - Manual VM Service Collection: Collect raw JSON coverage from a running VM service with optional branch and function-level metrics for granular control. - Coverage Ignore Directives: Exclude lines, blocks, or entire files from metrics using coverage:ignore-line, coverage:ignore-start/end, and coverage:ignore-file comments. - Use Case: A Flutter team wants to enforce a coverage threshold in CI. Use this Skill to add the coverage dev dependency, run dart run coverage:test_with_coverage, and validate that coverage/lcov.info is generated for upload to a reporting service. ## Quick Start Add the coverage package as a dev dependency and run dart run coverage:test_with_coverage to generate an LCOV report for my project.

Frequently Asked Questions about dart-collect-coverage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an LCOV coverage report for a Dart project?

Add coverage as a dev dependency with dart pub add dev:coverage, then run dart run coverage:test_with_coverage. This executes all tests, collects VM coverage data, and writes coverage/coverage.json and coverage/lcov.info to your project root.

How to collect test coverage in a Flutter project?

Add the coverage package with flutter pub add dev:coverage, then run dart run coverage:test_with_coverage. The script runs your flutter_test suites and formats the output into an LCOV report in the coverage directory.

How do I exclude files or lines from Dart coverage reports?

Use inline directives: // coverage:ignore-line for a single line, // coverage:ignore-start and // coverage:ignore-end for blocks, and // coverage:ignore-file for entire files. Pass --check-ignore when formatting to enforce these directives.

Does Dart coverage work in a monorepo workspace?

Yes, but you must specify test directories explicitly. Run dart run coverage:test_with_coverage -- pkgs/foo/test pkgs/bar/test to collect coverage across the desired packages in the workspace.

Why is coverage missing for some files in my LCOV report?

Files only appear in coverage data if they are imported and executed by your tests. Ensure the files are exercised by test cases, or add // coverage:ignore-file if they are intentionally excluded from metrics.

Can I collect branch and function coverage in Dart?

Yes, use the manual collection workflow with collect_coverage and append --function-coverage and --branch-coverage flags. This requires Dart VM 2.17.0 or later and gives deeper metrics than the default line coverage.