Chapter 10. Working with data: HTTP, Firestore, and JSON

 

This chapter covers

  • Serializing JSON data
  • Using HTTP to talk to a backend
  • Using Firebase as a backend
  • Using a Firestore NoSQL database
  • Using dependency injection for reusable code

At this point in the book, if you’ve been following along in order, you’re ready to build a full, production-ready frontend in Flutter. Truly, you’re finished! If you work at a company that’s considering building a Flutter app, you have all the information you need to start that project or to convince your manager it’s worth it.

But there are an infinite number of topics that, although similar in Flutter to various other SDKs, are pertinent in writing applications. For the rest of the book, I’m going to depart from a Flutter focus on topics you need to leverage in any mobile app. Particularly in the app we’re going to build in this chapter, you probably want to know how to work with a backend or data store. And to talk to almost any backend, you’ll probably want to turn Dart objects into some universal data format, like JSON. That’s what this chapter is about: talking to backends.

With that in mind, the UI work for the remainder of the book is light. In fact, the app that I’m going to make in this chapter looks like the one shown in figure 10.1.

Figure 10.1. Screenshot of the todo app built in this chapter

10.1. HTTP and Flutter

 
 

10.1.1. HTTP package

 
 
 

10.1.2. GET requests

 
 
 

10.2. JSON serialization

 
 

10.2.1. Manual serialization

 
 
 
 

10.2.2. Auto-generated JSON serialization

 
 
 
 

10.2.3. Updating the Todo class

 
 
 
 

10.2.4. Bringing it all together in the UI

 
 

10.3. Working with Firebase in Flutter

 
 

10.3.1. Installing Firestore

 
 
 

10.3.2. Create a Firestore project

 
 

10.3.3. Configure your app

 
 
 

10.3.4. Add Firebase to your pubspec

 
 
 

10.3.5. Using Firestore

 
 
 

10.4. Dependency injection

 
 

Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest