Beginning Firebase with Flutter

When writing mobile apps, saving the data users input is critical. You can save the data locally, but then you can’t save it permanently or share it with others. If you want to share your data, you need to save it in the cloud. One of the easiest solutions is Google’s Firebase Firestore database. Firestore is a NoSQL style database. Unlike traditional table-based databases that require much work to insert data, you save JSON blobs to collections. By Aldo Olivares.

Leave a rating/review
Download materials
Save for later
Comments
Share

Who is this for?

Intermediate level Android developers who want to learn about the basics of Google’s Firebase Firestore database. In particular, this course will be useful if you want to learn how to use the Firestore API in your Flutter projects.

Covered concepts

  • Create a new Firebase project.
  • Configure a Firestore database.
  • Use and create collections.
  • Add Firebase dependencies to your Flutter project.
  • Use streams.
  • Create models and repositories.

Part 1: Flutter Firebase

01
Toggle description

In this episode, create a firebase account and register a new firebase project for your PetMedical App. Also, get an introduction to all things that you are going to learn in this course as well as the prequisites.

Toggle description

Before you use Cloud Firestore or other Firebase services, you will need to initialize your Firebase App. In this episode you are going to add the firebase core plugin along with the cloud firestore plugin to your Flutter project.

Toggle description

In the previous episode you learned about the differences between firestore and realtime database. Now you will create your firestore database and start it in test mode and then add it to your dependencies.

Toggle description

To retrieve your data from Firestore, you need to create two model classes where you’ll put the data. In this episode, use Android Studio to create to model classes: Vaccination and Pet.

Toggle description

Now that your models are ready you will need to create a repository class to retrieve and save data. Remember that it is considered a best practice to isolate your connection to your data sources as much as possible.

Toggle description

Streams are a sequence of asynchronous data that sends when ready. Firestore sends updates to your list of pets when someone else adds or modifies a pet. In this episode, use a stream in your main file to listen for updates of your list of pets in your firestore database.

Toggle description

In this episode, build the last screen of your app which is going to show the details of a particular Pet. You’ll also get some links in case you want to learn more.