Flutter REST API Crash Course: Build a Coronavirus App

Flutter REST API Crash Course: Build a Coronavirus App

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 2.5 Hours | 1.32 GB

Build a Coronavirus Tracking App, and learn how to use REST APIs in Flutter

Welcome to this crash course, where you will learn how to use REST APIs with Dart and Flutter.

I created this course because REST APIs are used everywhere in today’s web. And if you master the basics of the Dart http library, you can write Flutter apps that can tap into thousands of web APIs.

In this crash course you will build a simple but completely functional Coronavirus tracker application in Flutter.

Included in this course

  • Short introduction to REST: what it is and how it works.
  • Overview of the nCoV 2019 health API. This is used to fetch global data about the Coronavirus outbreak.
  • Api keys & access tokens: what they are and how to use them.
  • REST Client: a VSCode extension that you can use to send HTTP requests and view the response directly in VS Code.
  • Design a REST API service using the Dart http package.
  • Make requests and parse the JSON response data into strongly-typed model classes.
  • Build a dashboard UI with nice-looking cards that show the data from the API.
  • Combine multiple API requests into a single response by using futures.
  • Use a RefreshIndicator to get updated data from the API.
  • Error handling, and how to show alert dialogs to the user.
  • Data caching with Shared Preferences, so that the data is saved on device for offline use.

Most importantly, you will learn about good app architecture as a way to structure our code and keep it modular.

This course is all about mastering the basics. It covers many important topics, with attention to detail, and emphasis on how to write a production-ready app.

By the end of this course, you will be able to build Flutter apps that connect with any other REST API that you want to use.

What you’ll learn

  • Build a simple, yet complete Coronavirus tracking application using REST APIs
  • Good app architecture: learn how to structure your code and keep it modular
  • Attention to detail and emphasis on writing a production-ready app
Table of Contents

Intro to REST, the nCoV 2019 REST API, and REST Client
1 RESTful APIs The Basics
2 The nCoV 2019 Coronavirus API Setup instructions, API Keys and Access Tokens
3 REST Client for VS Code Initial setup & sending requests
4 Using Environment Variables and excluding sensitive data with .gitignore
5 REST Client Adding the remaining requests
6 Useful Links & Resources

Building an API Service with the Dart http package
7 App Architecture Overview
8 Using the APIService class to show endpoint data
9 Recap on the APIService class
10 Useful Links & Resources
11 Installing the http package
12 Saving the API key + GitHub source code + the Error Lens extension
13 The API class
14 The APIService class requesting an access token
15 Parsing the http response and retrieving the access token
16 Using the API Service to show the access token
17 Adding the remaining endpoints to the API class
18 Requesting and parsing data from the remaining endpoints

Building a Data Repository and creating the basic UI
19 The Data Repository
20 Loading and refreshing the access token when needed
21 Adding a Provider for the DataRepository
22 Creating a basic dashboard UI
23 Creating a custom card widget to show endpoint data
24 Loading the initial endpoint data from the API
25 Adding a refresh indicator
26 Useful Links & Resources

Loading data from multiple endpoints and polishing the UI
27 Loading data from multiple endpoints with Future.wait
28 The EndpointsData class
29 Improving the DataRepository class with generics and function arguments
30 Showing all the cards
31 Adding the icon assets to the project
32 Update the cards layout, image and color
33 Useful Links & Resources

Date formatting and reading the last updated date from the server
34 Showing when the data was last updated client vs server approach
35 Parsing date information from the API response data
36 Creating a new data model to hold the date and value from the API
37 Showing the last updated date in the UI
38 Formatting dates with the intl package
39 Add thousands’ separators with the NumberFormat class
40 Useful Links & Resources

Error handling and caching data with Shared Preferences
41 Error handling overview, and understanding the call stack
42 Useful Links & Resources
43 Showing an alert dialog to the user
44 Completing the error handling code
45 Introduction to data persistence with Shared Preferences
46 Writing a DataCacheService
47 Integrating the DataCacheService in the DataRepository
48 Injecting the DataCacheService in main.dart
49 Hot fix The getter ‘date’ was called on null
50 Conclusion & next steps