Show Coverage of Flutter app in VS Code

Show Test Coverage of a Flutter app in Visual Studio Code

Here is a short guide about how to visualize code coverage of a Flutter app in Visual Studio Code.

4 min readJan 26, 2022
Photo by Clay Banks on Unsplash

Today I want to show you how you can measure your code coverage and see the covered and uncovered lines in your Flutter app. We are going to use Visual Studio Code and two free extensions from the Visual Studio Marketplace:

If you are unfamiliar with the concept of unit testing and how to write tests for a Flutter app please check my other article where I explain the basics of testing.

The test subject

I created a simple class called login_service.dart. It allows logging in, logging out, and checking the current state (logged in or not). It’s very basic and has flaws (like hard-coded user name and password) but will be enough to demonstrate how coverage works. The class is shown below.

The unit tests

Furthermore, we have some unit tests to cover all possible statements of the LoginService. You can see it in the file below.

Collect coverage information

Flutter has a built-in command to collect coverage information while executing all tests. So you just need to open a shell of your choice…




Developer for .NET, Flutter, Firebase, blogger on, find my ebooks and freebies on, contact me on!