skip to Main Content

I have a confusion with real time database and stream builder in flutter, as real time database is used for real time changes in the app, also stream builder performs same job for real time changes, now my question is why we use real time database instead of stream builder with firebase firestore, is there any specific reason behind that?

2

Answers


  1. Firebase real time data base is the cloud database that holds your data.

    Flutter StreamBuilder is a widget for rendering your UI from a stream.

    In this case the stream is coming from Firebase real time database, so you need both component.

    Login or Signup to reply.
  2. I think you asked about the difference between using Firestore database with StreamBuilder and Realtime database of firebase

    Firestore and Realtime Database are both real-time databases. The main difference between them is the data model.

    • Firestore uses a document-based data model, where data is stored as collections of documents and each document can have multiple fields. This data model is more flexible and scalable, making it suitable for complex data structures.

    • Realtime Database, uses a JSON data model where data is stored as a tree-like structure of key-value pairs. This data model is simpler, but may not be as scalable as Firestore for complex data structures.

    When using Firebase with Flutter, you can use either database with a StreamBuilder to receive real-time updates to the UI. The choice between Firestore and Realtime Database will depend on your specific use case and the data structure you require.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search