The flutter_test package provides the following tools for
testing widgets:

The WidgetTester allows building and interacting
with widgets in a test environment.

The testWidgets() function automatically
creates a new WidgetTester for each test case,
and is used in place of the normal test() function.

The Finder classes allow searching for widgets
in the test environment.

Widget-specific Matcher constants help verify
   whether a Finder locates a widget or
multiple widgets in the test environment.

If this sounds overwhelming, don’t worry. Learn how all of these pieces fit
together throughout this recipe, which uses the following steps:

Add the flutter_test dependency.

Create a widget to test.

Create a testWidgets test.

Build the widget using the WidgetTester.

Search for the widget using a Finder.

Verify the widget using a Matcher.