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.

xeladu
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…

--

--

xeladu

Flutter and Firebase expert, blogger on QuickCoder.org, find my ebooks and freebies on shop.quickcoder.org, contact me on me.quickcoder.org!