Your chat messages need to be stored on a cloud server. In this video, see how to set up a Firebase database to be the intermediary between your users.
we've updated our chat screen … so that we're able to start typing messages over here. … So, we could say, what's up? … And when I hit Send, … that message goes straight into our database … on our Firebase Cloud Firestore. … And we can see our new message pop up like so, right here. … So, that part is done … just underneath where we have our getCurrentUser, … I'm going to create a new method called getMessages. … And this method is going to go into our Firestore. … So, I'm going to tap into that Firestore I've got, … and tap into the right collection … which is the one called messages, … and then I'm going to call the getDocuments method. … And you can see that this returns a Future Query Snapshot. … Now, this Query Snapshot … is a data type that comes from Firebase … and it's a snapshot of the data … as we have it in our current collection. … So, if I go ahead and call this method … and I want to use the result of this method, … then, of course, I have to await for it. … So, let's save the data that we get back as a final …
This course was created by London App Brewery. We are pleased to host this content in our library.
- Refactoring routes
- Customizing Flutter animations
- Setting up a Firebase project
- Authenticating users with FirebaseAuth
- Streaming data from Firestore