flutter_live_coverage 1.2.0 copy "flutter_live_coverage: ^1.2.0" to clipboard
flutter_live_coverage: ^1.2.0 copied to clipboard

Flutter runtime code coverage plugin supporting Release mode. Collects line-level coverage data with LCOV output and S3 upload support.

Changelog #

1.2.0 #

New instrumentation coverage (inline, line-number-preserving AST edits):

  • Expression-bodied functions (=>) are now tracked: rewritten to an equivalent block body ({ hit(); return (e); }, or statement form for syntactically-void functions and setters). Applies to typed functions/methods, getters, setters, factory constructors and lambdas; named declarations without a written return type are skipped (an override may inherit void, invisible without resolution)
  • Braceless control-flow bodies are now tracked: wrapped in braces with a hit call (if (c) foo(); -> if (c) { hit(); foo(); }), preserving semantics exactly
  • catch/on clauses are now tracked: the hit is injected as the first statement inside the catch block, so the clause is only marked covered when an exception is actually caught

Instrumentation correctness fixes:

  • Fix braceless control-flow corruption: statements (if/for/while/break/…) that are the braceless body of another control-flow statement are no longer instrumented — previously the inserted hit call became the loop/branch body, silently changing program behavior (including infinite loops)
  • Fix switch instrumentation: case/default label lines are no longer recorded — previously this produced a syntax error (default as first member) or dead code after break that could never be marked covered
  • Fix catch instrumentation: catch clause lines are no longer recorded — previously the hit landed inside the try block, marking the catch as covered when no exception was thrown
  • Fix BitSet boundary: hits on the last executable line were silently dropped when its line number was a multiple of 8
  • Fix default include pattern: lib/**/*.dart does not match files directly under lib/ in package:glob (skipping lib/main.dart); the default is now lib/**.dart
  • Fix part-file compilation: the library file of an instrumented part file now always receives the coverage import, even when it has no executable lines or is excluded from instrumentation
  • Guard against double instrumentation: instrumented files are tagged with a marker comment and the CLI aborts if it finds already-instrumented input (re-instrumenting corrupted the source map)
  • Fix file ID collisions: hash-based file IDs are now checked for collisions and deduplicated (a collision silently merged two files' coverage)

Other fixes and changes:

  • Fix method channel name mismatch: Dart side used code_coverage while Android/iOS/macOS registered flutter_live_coverage (Linux/Windows updated to match)
  • Fix CoverageExportResult.localFileDeleted reporting true when local file deletion actually failed
  • Fix S3 upload file name extraction on Windows paths
  • Replace hand-rolled JSON encoder with dart:convert
  • Faster instrumentation on large files (removed O(n²) AST scan)
  • dart_parser.dart / code_instrumenter.dart are no longer exported from the package barrel (CLI-internal; avoids compiling package:analyzer into apps)
  • Added instrumenter regression test suite

1.1.0 #

  • Fix if-else chain instrumentation to avoid syntax errors
  • When instrumenting else if chains, skip recording nested IfStatement lines to prevent inserting hit calls between } and else if

1.0.0 #

  • Initial release
  • Runtime code coverage collection for Release mode
  • Line-level coverage tracking using efficient BitSet storage
  • LCOV format output compatible with genhtml, codecov, etc.
  • Local file storage with automatic cleanup
  • AWS S3 upload support with SigV4 authentication
  • CLI instrumentation tool for source code transformation
  • Auto-upload feature with configurable intervals
  • Automatic local file cleanup after successful S3 upload
0
likes
130
points
25
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter runtime code coverage plugin supporting Release mode. Collects line-level coverage data with LCOV output and S3 upload support.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

analyzer, args, aws_common, aws_signature_v4, flutter, flutter_web_plugins, glob, path, path_provider, plugin_platform_interface, web

More

Packages that depend on flutter_live_coverage

Packages that implement flutter_live_coverage