Pragmatic Flutter: Building Cross-Platform Mobile Apps for Android, iOS, Web, & Desktop by Priyanka Tyagi

Pragmatic Flutter: Building Cross-Platform Mobile Apps for Android, iOS, Web, & Desktop by Priyanka Tyagi

Author:Priyanka Tyagi
Language: eng
Format: epub
Publisher: CRC Press
Published: 2021-06-14T00:00:00+00:00


12

Integrating REST API

This chapter is an introduction to fetching data from a remote REST (Representational state transfer) API (Application Programming Interface) in a Flutter app. The Representational state transfer is a software architectural style for an API that uses less bandwidth for data transfer. It uses HTTP requests to access data. You'll learn how to access The Google Books API (Books API v1 (Experimental)) to fetch books listing for the given criteria. The Google Books API allows to view books’ data in JSON representation (JSON Representation) over the HTTP. The JavaScript Object Notation (JSON) is a type of data interchange format. The JSON format is a programming language that is independent and text-based. It uses key/value pairs to store information and is human-readable.

Google Books (Google Books) is an effort to digitize the world's books. The Google Books API lets developers search books based on content. We will use this API to search books that match specific criteria and fetch book listings using this REST API. Once we have data available, we will render the raw JSON formatted data in a simple Flutter user interface. We will touch base on setting up an API key on Google API Console, and use Books API. We will dive into API details and learn how to make a REST API call to fetch results and display it in a Flutter app.

By the end of this chapter, you'll have a good understanding of getting your own API key from Google API Console. You will use this API key to make a REST call to fetch book listings. Finally, you will learn to display the raw JSON response returned from API in a Flutter widget.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.