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?
Solution 1: Kleak
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
genhtmlprogram 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.