This example also uses the http package,
so define that dependency in the dependencies section.

mockito: 5.0.0 supports Dart’s null safety thanks to code generation.
To run the required code generation, add the build_runner dependency
in the dev_dependencies section.

dependencies

http

<newest_version>

dev_dependencies

flutter_test

sdk

flutter

mockito

<newest_version>

build_runner

<newest_version>

2. Create a function to test

In this example, unit test the fetchAlbum function from the
Fetch data from the internet recipe.
To test this function, make two changes: