Adam CJ
Adam CJ

Reputation: 59

How to retrieve all data from firebase realtime database in flutter

I'm trying to retrieve all data from realtime database with multiple children in flutter

This is how my database looks like

This is how my database looks like. Expanded

How do I retrieve all data. That is both accommodation and products?

This is how I fetch for them individually:

http.get(
        'https://flutter-buy.firebaseio.com/products.json?auth=${_authenticatedUser.token}')

I tried this but did not work:

http.get(
        'https://flutter-buy.firebaseio.com.json?auth=${_authenticatedUser.token}')

Upvotes: 0

Views: 986

Answers (1)

Guilherme Lemmi
Guilherme Lemmi

Reputation: 3493

Have you tried without specifying products or accommodation nodes in the request, like below (notice the .json):

http.get( 'https://flutter-buy.firebaseio.com/.json?auth=${_authenticatedUser.token}')

It seems like it is possible looking at their documentation.

Upvotes: 2

Related Questions