Note:
  You’re providing an http.Client to the function in this example.
  This makes the function easier to test and use in different environments.

3. Parse and convert the JSON into a list of photos

Next, following the guidance from the
Fetch data from the internet recipe,
convert the http.Response into a list of Dart objects.
This makes the data easier to work with.

Create a Photo class

First, create a Photo class that contains data about a photo.
Include a fromJson() factory method to make it easy to create a
Photo starting with a JSON object.

Convert the response into a list of photos

Now, use the following instructions to update the
fetchPhotos() function so that it returns a
Future<List<Photo>>:

Create a parsePhotos() function that converts the response
body into a List<Photo>.

Use the parsePhotos() function in the fetchPhotos() function.