In this recipe, we leveraged a service that mocks a web API. It's an easy way to create client code without having to build a real web service. Mocklab works with "stubs": a stub is a URL that contains a verb (such as GET) and a response.
Basically, we created an address that, when called, would return a JSON response containing an array of Pizza objects.
The http library allows the app to make requests to web services.
Note the following instruction:
import 'package:http/http.dart' as http;
With the as http command, you are naming the library so that you can use the functions and classes of the http library through the HTTP name, such as http.get().
The get() method of HTTP returns a Future containing a Response object. When dealing with web services, you use "verbs". Verbs are actions you perform on the web service. A GET action retrieves data from the web service. You will see other verbs such as POST, PUT, and DELETE in...