This is a question that gets asked quite often. Initially, this took a lot of setup, see the section below on how this used to work before the release of Flutter 2.5 in September 2021.
At the time of writing this is how you can easily display test coverage:
You can see coverage information for both unit and integration test runs with the newest IntelliJ / AndroidStudio plugin for Flutter. Accessed it by clicking the toolbar button next to the “Debug” button:
And this is how the code coverage is displayed:
The red bars indicate code which hasn’t been covered and and green bars which code has been covered.
Alternative ways to get the code coverage:
You can also install lcov and convert the lcov.info file to HTML pages and then see the result in the browser with sorting option.
1.1. Installation on Ubuntu
sudo apt-get update -qq -y sudo apt-get install lcov -y
1.2. Installation on Mac
brew install lcov
2. Run tests, generate coverage files and convert to HTML
flutter test --coverage genhtml coverage/lcov.info -o coverage/html