/>

2. Make a network request

This recipe covers how to fetch a sample album from the
JSONPlaceholder using the http.get() method.

The http.get() method returns a Future that contains a Response.

Future is a core Dart class for working with
async operations. A Future object represents a potential
value or error that will be available at some time in the future.

The http.Response class contains the data received from a successful
http call.

3. Convert the response into a custom Dart object

While it’s easy to make a network request, working with a raw
Future<http.Response> isn’t very convenient.
To make your life easier,
convert the http.Response into a Dart object.

Create an Album class

First, create an Album class that contains the data from the
network request. It includes a factory constructor that
creates an Album from JSON.