-
Book Overview & Buying
-
Table Of Contents
DART Cookbook
By :
The following step is to read the data from a JSON file, which we will use in this recipe. Angular has a built-in core functionality called the HTTP Service to make HTTP requests to a server. In our example, the job data has been serialized to the JSON format in the file jobs.json, and we will make an HTTP request to the web server to get this data. You can follow along with the code in the project angular_service.
The change we make in this recipe is nearly transparent to the user; the web page stays the same, but because making an HTTP request is asynchronous, we will work with a Future and must provide a message, such as "Loading data…", as long as the request is being executed.
JobListingController controller class, lib\job_listing.dart, we define a new variable of the type Http: final Http _http; . The constructor now becomes the following:JobListingController(this._http) {
_loadData();
}The bulk of the change takes place in...
Change the font size
Change margin width
Change background colour