Converting JSON by hand is only one option.
For more information, see the full article on
JSON and serialization.

Convert the http.Response to an Album

Now, use the following steps to update the fetchAlbum()
function to return a Future<Album>:

Convert the response body into a JSON Map with
the dart:convert package.

If the server does return an OK response with a status code of
200, then convert the JSON Map into an Album
using the fromJson() factory method.

If the server does not return an OK response with a status code of 200,
then throw an exception.
(Even in the case of a “404 Not Found” server response,
throw an exception. Do not return null.
This is important when examining
the data in snapshot, as shown below.)

Hooray!
Now you’ve got a function that fetches an album from the internet.

4. Fetch the data