How to read data from Firebase Realtime Database and display it using Jetpack Compose
3 min readAug 5, 2022
We’ll be doing this in 2 ways:
Without Hilt
With Hilt
- Setup
- Creating the repository
- Implementing the repository
- Creating the AppModule
- Collecting the data from the repository in the ViewModel
- Display the data
Database schema
Get database reference
To get a reference to a database other than us-central1
the default database, you must pass the database URL todatabase()the
. For a us-central1
default database, you can call or database
without arguments.
You can find your Realtime Database URL in the Realtime Database section of the Firebase console. Depending on the location of the database, the database URL…