In this example, create two files: counter.dart and counter_test.dart.

The counter.dart file contains a class that you want to test and
resides in the lib folder. The counter_test.dart file contains
the tests themselves and lives inside the test folder.

In general, test files should reside inside a test folder
located at the root of your Flutter application or package.
Test files should always end with _test.dart,
this is the convention used by the test runner when searching for tests.

When you’re finished, the folder structure should look like this:

3. Create a class to test

Next, you need a “unit” to test. Remember: “unit” is another name for a
function, method, or class. For this example, create a Counter class
inside the lib/counter.dart file. It is responsible for incrementing
and decrementing a value starting at 0.