Verify the widget using a Matcher.

1. Add the flutter_test dependency

Before writing tests, include the flutter_test
dependency in the dev_dependencies section of the pubspec.yaml file.
If creating a new Flutter project with the command line tools or
a code editor, this dependency should already be in place.

dev_dependencies

flutter_test

sdk

flutter

2. Create a widget to test

Next, create a widget for testing. For this recipe,
create a widget that displays a title and message.

3. Create a testWidgets test

With a widget to test, begin by writing your first test.
Use the testWidgets() function provided by the
flutter_test package to define a test.
The testWidgets function allows you to define a
widget test and creates a WidgetTester to work with.