Flutter REST API Crash Course: Build a Coronavirus App
- Description
- Curriculum
- FAQ
- Reviews
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.
Course organization
The course follows a linear structure, and shows how to build a fully functional application from scratch.
The content is divided into multiple sections, each covering a specific topic in detail.
Full source code is provided for each lesson, and the entire project is available on GitHub.
Premium Support
Beyond all the video content, premium support is included, so that you can ask questions if you get stuck. I’ll do my best to answer all questions within 24 hours – but please keep them relevant to the course material.
Prerequisites
This course is NOT for absolute beginners.
– You should already be familiar with the Dart Language. If you are not, you can follow my introduction to Dart, which is available for free on my YouTube channel.
– You should already have Flutter installed on your system, and Visual Studio Code or Android Studio configured for Flutter development.
– You should already have some knowledge of the most common Flutter widgets, and understand the difference between stateful and stateless widgets.
Teaching style
This is a fast-paced crash course. We will build a full application from scratch, but I will not explain every single step in detail. Instead, I will focus on the most important concepts, and always explain what we’re going to build and why, and then how to do it.
Enroll Today
If you want to learn how to build maintainable Flutter apps using REST APIs, and become a better software engineer, then this course is for you.
I’m very excited to share this course with you, so enroll now to get started.
-
1RESTful APIs: The BasicsVideo lesson
-
2The nCoV 2019 Coronavirus API: Setup instructions, API Keys and Access TokensVideo lesson
-
3REST Client for VS Code: Initial setup & sending requestsVideo lesson
-
4Using Environment Variables and excluding sensitive data with .gitignoreVideo lesson
-
5REST Client: Adding the remaining requestsVideo lesson
-
6Useful Links & ResourcesText lesson
-
7App Architecture OverviewVideo lesson
-
8Installing the http packageVideo lesson
-
9Saving the API key + GitHub source code + the Error Lens extensionVideo lesson
-
10The API classVideo lesson
-
11The APIService class: requesting an access tokenVideo lesson
Important note about Android Release apk builds.
Some students have reported that running requests with the APIService implemented in this video leads to SocketException errors in release mode.
Here's a relevant StackOverflow thread:
Flutter Http error SocketException: OS Error: Connection refused
To fix this, follow these two steps:
Ensure that the AndroidManifest.xml file contains the Internet permission: uses-permission android:name="android.permission.INTERNET"
Add an 'Accept': 'application/json' header when making the request:
final response = await http.post( api.tokenUri().toString(), headers: { 'Accept': 'application/json', 'Authorization': 'Basic ${api.apiKey}' }, );
-
12Parsing the http response and retrieving the access tokenVideo lesson
-
13Using the API Service to show the access tokenVideo lesson
-
14Adding the remaining endpoints to the API classVideo lesson
-
15Requesting and parsing data from the remaining endpointsVideo lesson
-
16Using the APIService class to show endpoint dataVideo lesson
-
17Recap on the APIService classVideo lesson
-
18Useful Links & ResourcesText lesson
-
19The Data RepositoryVideo lesson
-
20Loading and refreshing the access token when neededVideo lesson
-
21Adding a Provider for the DataRepositoryVideo lesson
-
22Creating a basic dashboard UIVideo lesson
-
23Creating a custom card widget to show endpoint dataVideo lesson
-
24Loading the initial endpoint data from the APIVideo lesson
-
25Adding a refresh indicatorVideo lesson
-
26Useful Links & ResourcesText lesson
-
27Loading data from multiple endpoints with Future.waitVideo lesson
-
28The EndpointsData classVideo lesson
-
29Improving the DataRepository class with generics and function argumentsVideo lesson
-
30Showing all the cardsVideo lesson
-
31Adding the icon assets to the projectVideo lesson
-
32Update the cards layout, image and colorVideo lesson
-
33Useful Links & ResourcesText lesson
-
34Showing when the data was last updated: client vs server approachVideo lesson
-
35Parsing date information from the API response dataVideo lesson
-
36Creating a new data model to hold the date and value from the APIVideo lesson
-
37Showing the last updated date in the UIVideo lesson
-
38Formatting dates with the intl packageVideo lesson
-
39Add thousands' separators with the NumberFormat classVideo lesson
-
40Useful Links & ResourcesText lesson
-
41Error handling overview, and understanding the call stackVideo lesson
-
42Showing an alert dialog to the userVideo lesson
-
43Completing the error handling codeVideo lesson
-
44Introduction to data persistence with Shared PreferencesVideo lesson
-
45Writing a DataCacheServiceVideo lesson
-
46Integrating the DataCacheService in the DataRepositoryVideo lesson
-
47Injecting the DataCacheService in main.dartVideo lesson
-
48Hot fix: The getter 'date' was called on nullVideo lesson
-
49Useful Links & ResourcesText lesson
External Links May Contain Affiliate Links read more