On the Official Flutter Packages website, it is written that the plugin for Code Coverage, dart_codecov_generator (https://pub.dev/packages/dart_codecov_generator), is DART 2 INCOMPATIBLE. So, is there a way we can use Code Coverage for Flutter projects?
1 Answer
Yes it possible to get the code coverage for a flutter project.
if you run flutter test --coverage
, it will output a file (lcov.info) in the coverage folder and then multiple solution are possible:
- you can use
genhtml
program on this file to get the coverage (you will have to do some parsing) - use online tool like codecov to upload you code coverage into the service.
-
3After running
flutter test --coverage
it is producing an empty lcov.info file. How to fix this? Aug 28, 2019 at 13:52 -
You can also use the
--coverage-path
option, e.g.:flutter test --coverage --coverage-path=path/lcov.info
. Oct 18, 2020 at 17:45