10 Working with data: HTTP, Firestore, and JSON

 

In this chapter:

  • Serialize JSON data
  • Using HTTP to talk to a backend
  • Using Firebase as a backend
  • Using Firestore NoSQL database
  • Dependency injection

At this point in the book, if you’ve been following along in order, you’re ready to build full, production apps 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.

But, there are an infinite number of topics that, although similar in Flutter to all SDKs, are pertinent writing good software. For the rest of the book, I’m going to depart from Flutter focus on topics you need to leverage in any mobile app, but they aren’t (necessarily) Flutter specific.

Particularly, 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 in JSON. That’s what this chapter is about.

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 this:

Working with data: HTTP, Firestore, and JSON

Pretty plain. But, there’s a lot to learn.

10.1  HTTP and Flutter

10.1.1  HTTP package

10.1.2  GET request

10.1.3  JSON Serialization

10.1.4  Bring it all together in the UI

10.2  Firebase and Flutter

10.2.1  Create a Firestore project

10.2.2  Configure your app

10.2.3  Add Firebase to your pubspec

10.2.4  Use Firestore

10.3  Dependency Injection

10.4  Summary

sitemap